Merge pull request #19520 from owncloud/issue-17420-modify-group-count-when-changing-memberships

Modify the group user count when changing membership of a user
This commit is contained in:
Jörn Friedrich Dreyer 2015-10-02 10:34:57 +02:00
commit aaabe356b5
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);