From cb2ea163a05d1311196bb66197f9a1903959f25f Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 30 Mar 2016 18:13:25 +0300 Subject: [PATCH] closes #4486 --- src/controllers/accounts/settings.js | 6 ++++-- src/groups.js | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/controllers/accounts/settings.js b/src/controllers/accounts/settings.js index 0b180be686..36d62d882b 100644 --- a/src/controllers/accounts/settings.js +++ b/src/controllers/accounts/settings.js @@ -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; diff --git a/src/groups.js b/src/groups.js index 10d9137b8c..2df5dc3ce2 100644 --- a/src/groups.js +++ b/src/groups.js @@ -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) {