Modify the group user count when changing membership of a user

This commit is contained in:
Joas Schilling 2015-10-02 08:55:53 +02:00
parent 3b4592718a
commit 3ce45863ab
2 changed files with 17 additions and 4 deletions

View File

@ -49,18 +49,26 @@ GroupList = {
return parseInt($groupLiElement.data('usercount'), 10);
},
modEveryoneCount: function(diff) {
var $li = GroupList.getGroupLI(GroupList.everyoneGID);
modGroupCount: function(gid, diff) {
var $li = GroupList.getGroupLI(gid);
var count = GroupList.getUserCount($li) + diff;
GroupList.setUserCount($li, count);
},
incEveryoneCount: function() {
GroupList.modEveryoneCount(1);
GroupList.modGroupCount(GroupList.everyoneGID, 1);
},
decEveryoneCount: function() {
GroupList.modEveryoneCount(-1);
GroupList.modGroupCount(GroupList.everyoneGID, -1);
},
incGroupCount: function(gid) {
GroupList.modGroupCount(gid, 1);
},
decGroupCount: function(gid) {
GroupList.modGroupCount(gid, -1);
},
getCurrentGID: function () {

View File

@ -470,6 +470,11 @@ var UserList = {
UserList.availableGroups.push(groupName);
}
if (response.data.action === 'add') {
GroupList.incGroupCount(groupName);
} else {
GroupList.decGroupCount(groupName);
}
}
if (response.data.message) {
OC.Notification.show(response.data.message);