From e882a08486badd527a615ff38fce8bc3520b12de Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Fri, 5 Aug 2022 15:56:09 +0000 Subject: [PATCH] GUACAMOLE-1656: Ensure the preferences page refreshes on save in case a one-time-token was updated. --- .../directives/guacSettingsPreferences.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/frontend/src/app/settings/directives/guacSettingsPreferences.js b/guacamole/src/main/frontend/src/app/settings/directives/guacSettingsPreferences.js index 5824eb194..199b7ddfa 100644 --- a/guacamole/src/main/frontend/src/app/settings/directives/guacSettingsPreferences.js +++ b/guacamole/src/main/frontend/src/app/settings/directives/guacSettingsPreferences.js @@ -58,6 +58,20 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe } }; + /** + * An action which closes the current dialog, and refreshes + * the user data on dialog close. + */ + const ACKNOWLEDGE_ACTION_RELOAD = { + name : 'SETTINGS_PREFERENCES.ACTION_ACKNOWLEDGE', + // Handle action + callback : function acknowledgeCallback() { + userService.getUser(dataSource, username) + .then(user => $scope.user = user) + .then(guacNotification.showStatus(false)) + } + }; + /** * The user being modified. * @@ -237,7 +251,9 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe text : { key : 'SETTINGS_PREFERENCES.INFO_PREFERENCE_ATTRIBUTES_CHANGED' }, - actions : [ ACKNOWLEDGE_ACTION ] + + // Reload the user on successful save in case any attributes changed + actions : [ ACKNOWLEDGE_ACTION_RELOAD ] }), guacNotification.SHOW_REQUEST_ERROR); };