Modify the group user count when changing membership of a user
This commit is contained in:
parent
3b4592718a
commit
3ce45863ab
|
@ -49,18 +49,26 @@ GroupList = {
|
||||||
return parseInt($groupLiElement.data('usercount'), 10);
|
return parseInt($groupLiElement.data('usercount'), 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
modEveryoneCount: function(diff) {
|
modGroupCount: function(gid, diff) {
|
||||||
var $li = GroupList.getGroupLI(GroupList.everyoneGID);
|
var $li = GroupList.getGroupLI(gid);
|
||||||
var count = GroupList.getUserCount($li) + diff;
|
var count = GroupList.getUserCount($li) + diff;
|
||||||
GroupList.setUserCount($li, count);
|
GroupList.setUserCount($li, count);
|
||||||
},
|
},
|
||||||
|
|
||||||
incEveryoneCount: function() {
|
incEveryoneCount: function() {
|
||||||
GroupList.modEveryoneCount(1);
|
GroupList.modGroupCount(GroupList.everyoneGID, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
decEveryoneCount: function() {
|
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 () {
|
getCurrentGID: function () {
|
||||||
|
|
|
@ -470,6 +470,11 @@ var UserList = {
|
||||||
UserList.availableGroups.push(groupName);
|
UserList.availableGroups.push(groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.data.action === 'add') {
|
||||||
|
GroupList.incGroupCount(groupName);
|
||||||
|
} else {
|
||||||
|
GroupList.decGroupCount(groupName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (response.data.message) {
|
if (response.data.message) {
|
||||||
OC.Notification.show(response.data.message);
|
OC.Notification.show(response.data.message);
|
||||||
|
|
Loading…
Reference in New Issue