mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
parseInt member count, use getMemberCount in install js
This commit is contained in:
@@ -363,7 +363,12 @@ var async = require('async'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
Groups.getMemberCount = function(groupName, callback) {
|
Groups.getMemberCount = function(groupName, callback) {
|
||||||
db.getObjectField('group:' + groupName, 'memberCount', callback);
|
db.getObjectField('group:' + groupName, 'memberCount', function(err, count) {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
callback(null, parseInt(count, 10));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Groups.isMemberOfGroupList = function(uid, groupListKey, callback) {
|
Groups.isMemberOfGroupList = function(uid, groupListKey, callback) {
|
||||||
|
|||||||
@@ -294,8 +294,11 @@ function enableDefaultTheme(next) {
|
|||||||
|
|
||||||
function createAdministrator(next) {
|
function createAdministrator(next) {
|
||||||
var Groups = require('./groups');
|
var Groups = require('./groups');
|
||||||
Groups.get('administrators', {}, function (err, groupObj) {
|
Groups.getMemberCount('administrators', function (err, memberCount) {
|
||||||
if (!err && groupObj && groupObj.memberCount > 0) {
|
if (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
if (memberCount > 0) {
|
||||||
process.stdout.write('Administrator found, skipping Admin setup\n');
|
process.stdout.write('Administrator found, skipping Admin setup\n');
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user