added privateUserInfo and isLoggedIn for #1275

v1.18.x
barisusakli 11 years ago
parent be45ad163a
commit e5a5b8e8bf

@ -27,6 +27,7 @@ apiController.getConfig = function(req, res, next) {
config.allowGuestPosting = parseInt(meta.config.allowGuestPosting, 10) === 1; config.allowGuestPosting = parseInt(meta.config.allowGuestPosting, 10) === 1;
config.allowFileUploads = parseInt(meta.config.allowFileUploads, 10) === 1; config.allowFileUploads = parseInt(meta.config.allowFileUploads, 10) === 1;
config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1; config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1;
config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
config.usePagination = parseInt(meta.config.usePagination, 10) === 1; config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1; config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
config.topicsPerPage = meta.config.topicsPerPage || 20; config.topicsPerPage = meta.config.topicsPerPage || 20;
@ -35,6 +36,7 @@ apiController.getConfig = function(req, res, next) {
config['theme:id'] = meta.config['theme:id']; config['theme:id'] = meta.config['theme:id'];
config.defaultLang = meta.config.defaultLang || 'en_GB'; config.defaultLang = meta.config.defaultLang || 'en_GB';
config.environment = process.env.NODE_ENV; config.environment = process.env.NODE_ENV;
config.isLoggedIn = !!req.user;
if (!req.user) { if (!req.user) {
if (res.locals.isAPI) { if (res.locals.isAPI) {
@ -42,9 +44,9 @@ apiController.getConfig = function(req, res, next) {
} else { } else {
next(null, config); next(null, config);
} }
return;
} }
if(req.user) {
user.getSettings(req.user.uid, function(err, settings) { user.getSettings(req.user.uid, function(err, settings) {
config.usePagination = settings.usePagination; config.usePagination = settings.usePagination;
config.topicsPerPage = settings.topicsPerPage; config.topicsPerPage = settings.topicsPerPage;
@ -57,7 +59,7 @@ apiController.getConfig = function(req, res, next) {
next(err, config); next(err, config);
} }
}); });
}
}; };

Loading…
Cancel
Save