mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
updating groups so that members leave a group when it is deleted
This commit is contained in:
@@ -178,6 +178,9 @@
|
||||
},
|
||||
function(next) {
|
||||
db.setRemove('groups', groupName, next);
|
||||
},
|
||||
function(next) {
|
||||
db.delete('group:' + groupName + ':members', next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -433,10 +433,11 @@ Upgrade.upgrade = function(callback) {
|
||||
function(next) {
|
||||
Groups.list({ showAllGroups: true }, function(err, groups) {
|
||||
async.each(groups, function(group, next) {
|
||||
// If empty, delete group
|
||||
if (group.memberCount === 0) {
|
||||
// If empty, delete group
|
||||
Groups.destroy(group.name, next);
|
||||
} else if (group.hidden && !isValidHiddenGroup.test(group.name)) {
|
||||
// If invalidly named hidden group, delete
|
||||
Groups.destroy(group.name, next);
|
||||
} else {
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user