updated middleware.renderHeader so that navbar config is retrieved in parallel like everything else, instead of retrieved first. (ping @psychobunny)

v1.18.x
Julian Lam 10 years ago
parent 625a0dcbfa
commit cc4e626f5f

@ -23,6 +23,7 @@ var async = require('async'),
require('./meta/sounds')(Meta);
require('./meta/settings')(Meta);
require('./meta/logs')(Meta);
require('./meta/tags')(Meta);
Meta.templates = require('./meta/templates');
/* Assorted */

@ -191,11 +191,6 @@ middleware.buildHeader = function(req, res, next) {
};
middleware.renderHeader = function(req, res, callback) {
navigation.get(function(err, menuItems) {
if (err) {
return callback(err);
}
var defaultMetaTags = [{
name: 'viewport',
content: 'width=device-width, initial-scale=1.0, user-scalable=no'
@ -229,7 +224,6 @@ middleware.renderHeader = function(req, res, callback) {
'cache-buster': meta.config['cache-buster'] ? 'v=' + meta.config['cache-buster'] : '',
'brand:logo': meta.config['brand:logo'] || '',
'brand:logo:display': meta.config['brand:logo']?'':'hide',
navigation: menuItems,
allowRegistration: meta.config.allowRegistration === undefined || parseInt(meta.config.allowRegistration, 10) === 1,
searchEnabled: plugins.hasListeners('filter:search.query')
};
@ -299,7 +293,8 @@ middleware.renderHeader = function(req, res, callback) {
uid: 0
});
}
}
},
navigation: async.apply(navigation.get)
}, function(err, results) {
if (err) {
return callback(err);
@ -315,6 +310,7 @@ middleware.renderHeader = function(req, res, callback) {
results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1;
templateValues.browserTitle = results.title;
templateValues.navigation = results.navigation
templateValues.isAdmin = results.user.isAdmin;
templateValues.user = results.user;
templateValues.userJSON = JSON.stringify(results.user);
@ -327,7 +323,6 @@ middleware.renderHeader = function(req, res, callback) {
app.render('header', templateValues, callback);
});
});
};
middleware.processRender = function(req, res, next) {

Loading…
Cancel
Save