v1.18.x
barisusakli 10 years ago
parent a31178ebd8
commit 718f61e3bd

@ -65,7 +65,7 @@
"already-unfavourited": "You have already unfavourited this post",
"cant-ban-other-admins": "You can't ban other admins!",
"cant-remove-last-admin": "You are the only administrator. Add another user as an administrator before removing yourself as admin"
"cant-remove-last-admin": "You are the only administrator. Add another user as an administrator before removing yourself as admin",
"invalid-image-type": "Invalid image type. Allowed types are: %1",
"invalid-image-extension": "Invalid image extension",

@ -12,7 +12,7 @@ var async = require('async'),
groupsController.list = function(req, res, next) {
var sort = req.query.sort || 'alpha';
groupsController.getGroupsFromSet(req.uid, sort, 0, 8, function(err, data) {
groupsController.getGroupsFromSet(req.uid, sort, 0, 14, function(err, data) {
if (err) {
return next(err);
}

@ -312,7 +312,7 @@ var async = require('async'),
Groups.existsBySlug = function(slug, callback) {
if (Array.isArray(slug)) {
db.isObjectFields('groupslug:groupName', slug, callback);
db.isObjectFields('groupslug:groupname', slug, callback);
} else {
db.isObjectField('groupslug:groupname', slug, callback);
}

@ -55,9 +55,7 @@ module.exports = function(Groups) {
tasks.push(async.apply(db.sortedSetAdd, 'groups:visible:name', 0, data.name.toLowerCase() + ':' + data.name));
}
if (!data.hidden) {
tasks.push(async.apply(db.setObjectField, 'groupslug:groupname', slug, data.name));
}
tasks.push(async.apply(db.setObjectField, 'groupslug:groupname', slug, data.name));
async.series(tasks, function(err) {
if (!err) {

@ -16,12 +16,15 @@ module.exports = function(Groups) {
async.apply(db.getObjectValues, 'groupslug:groupname'),
function(groupNames, next) {
groupNames = groupNames.filter(function(name) {
return name.toLowerCase().indexOf(query) !== -1 && name !== 'administrators';
return name.toLowerCase().indexOf(query) !== -1 && name !== 'administrators' && name !== 'registered-users' && !Groups.isPrivilegeGroup(name);
});
groupNames = groupNames.slice(0, 100);
Groups.getGroupsData(groupNames, next);
},
function(groupsData, next) {
groupsData = groupsData.filter(function(group) {
return group && !group.hidden;
});
groupsData.forEach(Groups.escapeGroupData);
next(null, groupsData);
},

@ -75,7 +75,6 @@ module.exports = function(Groups) {
async.apply(db.sortedSetRemove, 'groups:visible:createtime', groupName),
async.apply(db.sortedSetRemove, 'groups:visible:memberCount', groupName),
async.apply(db.sortedSetRemove, 'groups:visible:name', groupName.toLowerCase() + ':' + groupName),
async.apply(db.deleteObjectField, 'groupslug:groupname', utils.slugify(groupName))
], callback);
} else {
db.getObjectFields('group:' + groupName, ['createtime', 'memberCount'], function(err, groupData) {
@ -86,7 +85,6 @@ module.exports = function(Groups) {
async.apply(db.sortedSetAdd, 'groups:visible:createtime', groupData.createtime, groupName),
async.apply(db.sortedSetAdd, 'groups:visible:memberCount', groupData.memberCount, groupName),
async.apply(db.sortedSetAdd, 'groups:visible:name', 0, groupName.toLowerCase() + ':' + groupName),
async.apply(db.setObjectField, 'groupslug:groupname', utils.slugify(groupName), groupName)
], callback);
});
}

@ -214,7 +214,7 @@ SocketGroups.search = function(socket, data, callback) {
}
if (!data.query) {
var groupsPerPage = 9;
var groupsPerPage = 15;
groupsController.getGroupsFromSet(socket.uid, data.options.sort, 0, groupsPerPage - 1, function(err, data) {
callback(err, !err ? data.groups : null);
});

Loading…
Cancel
Save