mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
closes #2528
This commit is contained in:
@@ -2,15 +2,17 @@
|
|||||||
/*global io, templates, translator, ajaxify, utils, bootbox, RELATIVE_PATH, config*/
|
/*global io, templates, translator, ajaxify, utils, bootbox, RELATIVE_PATH, config*/
|
||||||
|
|
||||||
var socket,
|
var socket,
|
||||||
app = {
|
app = app || {};
|
||||||
'username': null,
|
|
||||||
'uid': null,
|
app.isFocused = true;
|
||||||
'isFocused': true,
|
app.isConnected = false;
|
||||||
'isConnected': false,
|
app.currentRoom = null;
|
||||||
'currentRoom': null,
|
app.widgets = {};
|
||||||
'widgets': {},
|
app.cacheBuster = null;
|
||||||
'cacheBuster': null
|
|
||||||
};
|
// TODO: deprecate in 0.7.0, use app.user
|
||||||
|
app.username = null;
|
||||||
|
app.uid = null;
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var showWelcomeMessage = false;
|
var showWelcomeMessage = false;
|
||||||
@@ -35,8 +37,6 @@ var socket,
|
|||||||
app.uid = data.uid;
|
app.uid = data.uid;
|
||||||
app.isAdmin = data.isAdmin;
|
app.isAdmin = data.isAdmin;
|
||||||
|
|
||||||
app.user = data;
|
|
||||||
|
|
||||||
app.showLoginMessage();
|
app.showLoginMessage();
|
||||||
app.replaceSelfLinks();
|
app.replaceSelfLinks();
|
||||||
$(window).trigger('action:connected');
|
$(window).trigger('action:connected');
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ middleware.renderHeader = function(req, res, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
templateValues.config = JSON.stringify(res.locals.config);
|
templateValues.configJSON = JSON.stringify(res.locals.config);
|
||||||
|
|
||||||
templateValues.metaTags = defaultMetaTags.concat(res.locals.metaTags || []).map(function(tag) {
|
templateValues.metaTags = defaultMetaTags.concat(res.locals.metaTags || []).map(function(tag) {
|
||||||
if(!tag || typeof tag.content !== 'string') {
|
if(!tag || typeof tag.content !== 'string') {
|
||||||
@@ -315,7 +315,14 @@ middleware.renderHeader = function(req, res, callback) {
|
|||||||
if (uid) {
|
if (uid) {
|
||||||
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'banned'], next);
|
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'banned'], next);
|
||||||
} else {
|
} else {
|
||||||
next();
|
next(null, {
|
||||||
|
username: '[[global:guest]]',
|
||||||
|
userslug: '',
|
||||||
|
picture: user.createGravatarURLFromEmail(''),
|
||||||
|
status: 'offline',
|
||||||
|
banned: false,
|
||||||
|
uid: 0
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
@@ -328,10 +335,12 @@ middleware.renderHeader = function(req, res, callback) {
|
|||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
results.user.isAdmin = results.isAdmin || false;
|
||||||
|
|
||||||
templateValues.browserTitle = results.title;
|
templateValues.browserTitle = results.title;
|
||||||
templateValues.isAdmin = results.isAdmin || false;
|
templateValues.isAdmin = results.user.isAdmin;
|
||||||
templateValues.user = results.user;
|
templateValues.user = results.user;
|
||||||
|
templateValues.userJSON = JSON.stringify(results.user);
|
||||||
templateValues.customCSS = results.customCSS;
|
templateValues.customCSS = results.customCSS;
|
||||||
templateValues.customJS = results.customJS;
|
templateValues.customJS = results.customJS;
|
||||||
templateValues.maintenanceHeader = parseInt(meta.config.maintenanceMode, 10) === 1 && !results.isAdmin;
|
templateValues.maintenanceHeader = parseInt(meta.config.maintenanceMode, 10) === 1 && !results.isAdmin;
|
||||||
|
|||||||
Reference in New Issue
Block a user