From 485d6d657761370dc200d9cdb023ad564c23c4e9 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 11 Oct 2016 12:07:20 +0200 Subject: use proper return codes and handle failure cases Signed-off-by: Morris Jobke --- settings/js/users/users.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'settings/js') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 2a0b0c09a92..387709cd64c 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -949,7 +949,15 @@ $(document).ready(function () { OC.dialogs.alert(result.data.message, t('settings', 'Error while changing status of {user}', {user: uid})); } } - ); + ).fail(function(result){ + var message = 'Unknown error'; + if( result.responseJSON && + result.responseJSON.data && + result.responseJSON.data.message) { + message = result.responseJSON.data.message; + } + OC.dialogs.alert(message, t('settings', 'Error while changing status of {user}', {user: uid})); + }); }); // init the quota field select box after it is shown the first time -- cgit v1.2.3