aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/controller/apicontroller.php6
-rw-r--r--apps/files/js/tagsplugin.js11
2 files changed, 11 insertions, 6 deletions
diff --git a/apps/files/controller/apicontroller.php b/apps/files/controller/apicontroller.php
index a8bea27e4bb..1bb07010a27 100644
--- a/apps/files/controller/apicontroller.php
+++ b/apps/files/controller/apicontroller.php
@@ -76,11 +76,11 @@ class ApiController extends Controller {
try {
$this->tagService->updateFileTags($path, $tags);
} catch (\OCP\Files\NotFoundException $e) {
- return new DataResponse($e->getMessage(), Http::STATUS_NOT_FOUND);
+ return new DataResponse(['message' => $e->getMessage()], Http::STATUS_NOT_FOUND);
} catch (\OCP\Files\StorageNotAvailableException $e) {
- return new DataResponse($e->getMessage(), Http::STATUS_SERVICE_UNAVAILABLE);
+ return new DataResponse(['message' => $e->getMessage()], Http::STATUS_SERVICE_UNAVAILABLE);
} catch (\Exception $e) {
- return new DataResponse($e->getMessage(), Http::STATUS_NOT_FOUND);
+ return new DataResponse(['message' => $e->getMessage()], Http::STATUS_NOT_FOUND);
}
$result['tags'] = $tags;
}
diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js
index b00aacfba57..b81f1ec5756 100644
--- a/apps/files/js/tagsplugin.js
+++ b/apps/files/js/tagsplugin.js
@@ -105,12 +105,12 @@
} else {
tags.push(OC.TAG_FAVORITE);
}
+ toggleStar($actionEl, !isFavorite);
self.applyFileTags(
dir + '/' + fileName,
tags
).then(function(result) {
- toggleStar($actionEl, !isFavorite);
// response from server should contain updated tags
var newTags = result.tags;
if (_.isUndefined(newTags)) {
@@ -171,8 +171,13 @@
}),
dataType: 'json',
type: 'POST'
- }).fail(function() {
- OC.Notification.showTemporary(t('files', 'An error occurred while trying to update the tags'));
+ }).fail(function(response) {
+ var message = '';
+ // show message if it is available
+ if(response.responseJSON && response.responseJSON.message) {
+ message = ': ' + response.responseJSON.message;
+ }
+ OC.Notification.showTemporary(t('files', 'An error occurred while trying to update the tags') + message);
});
}
};