Skip to content

Node.js based forum software built for the modern web

fix acp for header changes

barisusakli4ce6341d85d8
diff --git a/src/middleware/admin.js b/src/middleware/admin.js
index 003ffbed00..bd7e46dd19 100644
--- a/src/middleware/admin.js
+++ b/src/middleware/admin.js
@@ -45,6 +45,8 @@ middleware.buildHeader = function(req, res, next) {
return next(err);
}
+ userData.uid = uid;
+
async.parallel({
scripts: function(next) {
plugins.fireHook('filter:admin.scripts.get', [], function(err, scripts) {
@@ -61,16 +63,22 @@ middleware.buildHeader = function(req, res, next) {
},
custom_header: function(next) {
plugins.fireHook('filter:admin.header.build', custom_header, next);
+ },
+ config: function(next) {
+ controllers.api.getConfig(req, res, next);
}
- }, function(err, pluginData) {
+ }, function(err, results) {
if (err) {
return next(err);
}
+ res.locals.config = results.config;
var data = {
relative_path: nconf.get('relative_path'),
- plugins: pluginData.custom_header.plugins,
- authentication: pluginData.custom_header.authentication,
- scripts: pluginData.scripts,
+ configJSON: JSON.stringify(results.config),
+ userJSON: JSON.stringify(userData),
+ plugins: results.custom_header.plugins,
+ authentication: results.custom_header.authentication,
+ scripts: results.scripts,
userpicture: userData.picture,
username: userData.username,
userslug: userData.userslug,
@@ -88,12 +96,6 @@ middleware.buildHeader = function(req, res, next) {
});
});
},
- function(next) {
- controllers.api.getConfig(req, res, function(err, config) {
- res.locals.config = config;
- next(err);
- });
- },
function(next) {
app.render('admin/footer', {}, function(err, template) {
res.locals.adminFooter = template;
diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl
index c68e0fbfaa..2b14ff8e1f 100644
--- a/src/views/admin/header.tpl
+++ b/src/views/admin/header.tpl
@@ -11,6 +11,9 @@
<script>
var RELATIVE_PATH = "{relative_path}";
+ var config = JSON.parse('{configJSON}');
+ var app = {};
+ app.user = JSON.parse('{userJSON}');
</script>
<!--[if lt IE 9]>