From 333225917645b271b32e6b35f34fc0387db25e27 Mon Sep 17 00:00:00 2001 From: Steven Choi Date: Wed, 20 Sep 2023 09:24:24 +1000 Subject: [PATCH] #700 change codes for removing disabled button --- .../profileEditor/controllers/UserAccessController.js | 5 +++-- grails-app/views/opus/_editAccessControl.gsp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/grails-app/assets/javascripts/profileEditor/controllers/UserAccessController.js b/grails-app/assets/javascripts/profileEditor/controllers/UserAccessController.js index 13568c64..84c4e3fe 100644 --- a/grails-app/assets/javascripts/profileEditor/controllers/UserAccessController.js +++ b/grails-app/assets/javascripts/profileEditor/controllers/UserAccessController.js @@ -84,8 +84,8 @@ profileEditor.controller('UserAccessController', function (messageService, util, if (self.opus.privateCollection) { self.roles.push(userRole); } else { - self.roles.splice(4, 1) - if (form.$dirty) { + var hasRole_USER = self.users.find(it=>it.role === 'ROLE_USER') + if (form.$dirty && hasRole_USER) { self.users = self.users.filter(it => it.role !== 'ROLE_USER') var data = {privateCollection: self.opus.privateCollection, authorities: self.users}; var promise = profileService.updateUsers(self.opusId, data); @@ -95,6 +95,7 @@ profileEditor.controller('UserAccessController', function (messageService, util, messageService.alert("An error has occurred while updating user access."); }); } + self.roles.splice(4, 1) } }; diff --git a/grails-app/views/opus/_editAccessControl.gsp b/grails-app/views/opus/_editAccessControl.gsp index b23949c9..c3a50c83 100644 --- a/grails-app/views/opus/_editAccessControl.gsp +++ b/grails-app/views/opus/_editAccessControl.gsp @@ -122,9 +122,9 @@
- - +