v1.18.x
barisusakli 9 years ago
parent b534ba8cc1
commit cb2ea163a0

@ -33,7 +33,7 @@ settingsController.get = function(req, res, callback) {
user.getSettings(userData.uid, next);
},
userGroups: function(next) {
groups.getUserGroups([userData.uid], next);
groups.getUserGroupsFromSet('groups:createtime', [userData.uid], next);
},
languages: function(next) {
languages.list(next);
@ -49,7 +49,9 @@ settingsController.get = function(req, res, callback) {
},
function(results, next) {
userData.settings = results.settings;
userData.userGroups = results.userGroups[0];
userData.userGroups = results.userGroups[0].filter(function(group) {
return group && group.userTitleEnabled && !groups.isPrivilegeGroup(group.name);
});
userData.languages = results.languages;
userData.homePageRoutes = results.homePageRoutes;
userData.ips = results.ips;

@ -425,9 +425,13 @@ var utils = require('../public/src/utils');
};
Groups.getUserGroups = function(uids, callback) {
Groups.getUserGroupsFromSet('groups:visible:createtime', uids, callback);
};
Groups.getUserGroupsFromSet = function (set, uids, callback) {
async.waterfall([
function(next) {
db.getSortedSetRevRange('groups:visible:createtime', 0, -1, next);
db.getSortedSetRevRange(set, 0, -1, next);
},
function(groupNames, next) {
var groupSets = groupNames.map(function(name) {

Loading…
Cancel
Save