diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-03-19 15:36:08 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-03-20 19:09:04 +0100 |
commit | 1c440519c2653323dd49fb4ec3a06851d114c4fe (patch) | |
tree | d744a4fe5dfd3634185d4d724fdedc32e3a71584 /core/js/sharedialogview.js | |
parent | ed1452d7a067d383371dcd165ad86e01f174840b (diff) | |
download | nextcloud-server-1c440519c2653323dd49fb4ec3a06851d114c4fe.tar.gz nextcloud-server-1c440519c2653323dd49fb4ec3a06851d114c4fe.zip |
Show an error when getting the suggestions succeeds with failure content
Instead of silently failing now an error is shown to the user when the
ajax call to get the suggestions succeeds yet it returns failure content
(for example, if an "OCSBadRequestException" was thrown in the server).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js/sharedialogview.js')
-rw-r--r-- | core/js/sharedialogview.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 9e3de2636ce..7c31239d4a1 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -242,7 +242,7 @@ deferred.resolve(suggestions); } else { - deferred.resolve(null); + deferred.reject(result.ocs.meta.message); } } ).fail(function() { @@ -296,7 +296,7 @@ $loading.removeClass('inlineblock'); $confirm.removeClass('hidden'); - if (suggestions && suggestions.length > 0) { + if (suggestions.length > 0) { $shareWithField .autocomplete("option", "autoFocus", true); @@ -312,7 +312,7 @@ $('.ui-autocomplete').append('<li class="autocomplete-note">' + message + '</li>'); } - } else if (suggestions) { + } else { var title = t('core', 'No users or groups found for {search}', {search: $shareWithField.val()}); if (!view.configModel.get('allowGroupSharing')) { title = t('core', 'No users found for {search}', {search: $('.shareWithField').val()}); @@ -327,14 +327,17 @@ .tooltip('fixTitle') .tooltip('show'); response(); - } else { - response(); } - }).fail(function() { + }).fail(function(message) { $loading.addClass('hidden'); $loading.removeClass('inlineblock'); $confirm.removeClass('hidden'); - OC.Notification.showTemporary(t('core', 'An error occurred. Please try again')); + + if (message) { + OC.Notification.showTemporary(t('core', 'An error occurred ("{message}"). Please try again', { message: message })); + } else { + OC.Notification.showTemporary(t('core', 'An error occurred. Please try again')); + } }); }, |