Skip to content
Snippets Groups Projects
Commit 506a3400 authored by Thomas Müller's avatar Thomas Müller
Browse files

remove the group in case the last user has removed from that group

parent f76deb9f
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment