mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
got rid of extra call to user.getSettings
This commit is contained in:
@@ -84,6 +84,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.categoryTopicSort = meta.config.categoryTopicSort || 'newest_to_oldest';
|
||||
config.csrf_token = req.csrfToken();
|
||||
config.searchEnabled = plugins.hasListeners('filter:search.query');
|
||||
config.bootswatchSkin = 'default';
|
||||
|
||||
if (!req.user) {
|
||||
return filterConfig();
|
||||
@@ -103,6 +104,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
|
||||
config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort;
|
||||
config.topicSearchEnabled = settings.topicSearchEnabled || false;
|
||||
config.bootswatchSkin = settings.bootswatchSkin || config.bootswatchSkin;
|
||||
|
||||
filterConfig();
|
||||
});
|
||||
|
||||
@@ -67,13 +67,6 @@ module.exports = function(app, middleware) {
|
||||
templateValues.configJSON = JSON.stringify(res.locals.config);
|
||||
|
||||
async.parallel({
|
||||
settings: function(next) {
|
||||
if (req.uid) {
|
||||
user.getSettings(req.uid, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
isAdmin: function(next) {
|
||||
user.isAdministrator(req.uid, next);
|
||||
},
|
||||
@@ -107,8 +100,8 @@ module.exports = function(app, middleware) {
|
||||
results.user.uid = parseInt(results.user.uid, 10);
|
||||
results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1;
|
||||
|
||||
if (results.settings && results.settings.bootswatchSkin && results.settings.bootswatchSkin !== 'default') {
|
||||
templateValues.bootswatchCSS = '//maxcdn.bootstrapcdn.com/bootswatch/latest/' + results.settings.bootswatchSkin + '/bootstrap.min.css';
|
||||
if (res.locals.config.bootswatchSkin !== 'default') {
|
||||
templateValues.bootswatchCSS = '//maxcdn.bootstrapcdn.com/bootswatch/latest/' + res.locals.config.bootswatchSkin + '/bootstrap.min.css';
|
||||
}
|
||||
|
||||
templateValues.browserTitle = controllers.helpers.buildTitle(data.title);
|
||||
|
||||
Reference in New Issue
Block a user