mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
dont call groups.get just to read 2 values
This commit is contained in:
@@ -647,13 +647,12 @@ var async = require('async'),
|
||||
uid: uid
|
||||
});
|
||||
|
||||
// If this is a hidden group, and it is now empty, delete it
|
||||
Groups.get(groupName, {}, function(err, group) {
|
||||
if (err || !group) {
|
||||
Groups.getGroupFields(groupName, ['hidden', 'memberCount'], function(err, groupData) {
|
||||
if (err || !groupData) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (group.hidden && group.memberCount === 0) {
|
||||
if (parseInt(groupData.hidden, 10) === 1 && parseInt(groupData.memberCount, 10) === 0) {
|
||||
Groups.destroy(groupName, callback);
|
||||
} else {
|
||||
callback();
|
||||
|
||||
Reference in New Issue
Block a user