Skip to content

Node.js based forum software built for the modern web

got rid of extra call to user.getSettings

barisusakli751a6c68396d
diff --git a/src/controllers/api.js b/src/controllers/api.js
index 56308ef535..421673e7c4 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -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();
});
diff --git a/src/middleware/header.js b/src/middleware/header.js
index 6cedf1241a..8dcde8a93a 100644
--- a/src/middleware/header.js
+++ b/src/middleware/header.js
@@ -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);