]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove the group in case the last user has removed from that group
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 9 Jul 2014 13:29:38 +0000 (15:29 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 9 Jul 2014 13:29:38 +0000 (15:29 +0200)
settings/js/users/users.js

index f04761e6f1036c9954269b0bdf4e720711bac230..5775d83d09814afa8e1db2d1c4de3cd5589f6ffa 100644 (file)
@@ -393,6 +393,18 @@ var UserList = {
                                                        ) {
                                                                UserList.availableGroups.push(response.data.groupname);
                                                        }
+
+                                                       // in case this was the last user in that group the group has to be removed
+                                                       var groupElement = GroupList.getGroupLI(response.data.groupname);
+                                                       var userCount = GroupList.getUserCount(groupElement);
+                                                       if (response.data.action === 'remove' && userCount === 1) {
+                                                               _.without(UserList.availableGroups, response.data.groupname);
+                                                               GroupList.remove(response.data.groupname);
+                                                               $('.groupsselect option[value='+response.data.groupname+']').remove();
+                                                               $('.subadminsselect option[value='+response.data.groupname+']').remove();
+                                                       }
+
+
                                                }
                                                if (response.data.message) {
                                                        OC.Notification.show(response.data.message);