Skip to content

Node.js based forum software built for the modern web

closes #2759

Barış Soner Uşaklı5140e5db8d80
diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json
index 9c32b2d26e..265439e4ca 100644
--- a/public/language/en_GB/user.json
+++ b/public/language/en_GB/user.json
@@ -88,5 +88,7 @@
"topic_search_help": "If enabled, in-topic searching will override the browser's default page search behaviour and allow you to search through the entire topic, instead of what is only shown on screen.",
"follow_topics_you_reply_to": "Follow topics that you reply to.",
- "follow_topics_you_create": "Follow topics you create."
+ "follow_topics_you_create": "Follow topics you create.",
+
+ "grouptitle": "Select the group title you would like to display"
}
diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js
index eb78226145..a9577a9899 100644
--- a/src/controllers/accounts.js
+++ b/src/controllers/accounts.js
@@ -354,6 +354,9 @@ accountsController.accountSettings = function(req, res, next) {
settings: function(next) {
plugins.fireHook('filter:user.settings', [], next);
},
+ userGroups: function(next) {
+ groups.getUserGroups([userData.uid], next);
+ },
languages: function(next) {
languages.list(next);
}
@@ -364,6 +367,7 @@ accountsController.accountSettings = function(req, res, next) {
userData.settings = results.settings;
userData.languages = results.languages;
+ userData.userGroups = results.userGroups[0];
userData.disableEmailSubscriptions = parseInt(meta.config.disableEmailSubscriptions, 10) === 1;
diff --git a/src/posts/user.js b/src/posts/user.js
index 6b9f4f5e48..c2094d5707 100644
--- a/src/posts/user.js
+++ b/src/posts/user.js
@@ -17,6 +17,9 @@ module.exports = function(Posts) {
groups: function(next) {
groups.getUserGroups(uids, next);
},
+ userSettings: function(next){
+ user.getMultipleUserSettings(uids, next);
+ },
userData: function(next) {
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned', 'status'], next);
},
@@ -29,10 +32,16 @@ module.exports = function(Posts) {
}
var userData = results.userData;
- for(var i=0; i<userData.length; ++i) {
- userData[i].groups = results.groups[i];
- userData[i].status = user.getStatus(userData[i].status, results.online[i]);
- }
+ userData.forEach(function(userData, i) {
+ userData.groups = results.groups[i];
+ if (!results.userSettings[i].groupTitle) {
+ results.userSettings[i].groupTitle = results.groups[i][0] ? results.groups[i][0].name : '';
+ }
+ results.groups[i].forEach(function(group, index) {
+ group.selected = group.name === results.userSettings[i].groupTitle;
+ });
+ userData.status = user.getStatus(userData.status, results.online[i]);
+ });
async.map(userData, function(userData, next) {
userData.uid = userData.uid || 0;
diff --git a/src/user/settings.js b/src/user/settings.js
index 3daa3db869..93e2389f0e 100644
--- a/src/user/settings.js
+++ b/src/user/settings.js
@@ -103,7 +103,8 @@ module.exports = function(User) {
sendChatNotifications: data.sendChatNotifications,
sendPostNotifications: data.sendPostNotifications,
restrictChat: data.restrictChat,
- topicSearchEnabled: data.topicSearchEnabled
+ topicSearchEnabled: data.topicSearchEnabled,
+ groupTitle: data.groupTitle
}, next);
},
function(next) {