From eaefd9d24c1e1b92957ef1b9a4aa63cf10affbfe Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 26 Aug 2015 15:54:54 -0400 Subject: [PATCH] remove meta/title.js and meta.title.build #3481 --- public/language/en_GB/pages.json | 23 ++--- public/src/ajaxify.js | 2 +- public/src/app.js | 20 ++--- src/controllers/accounts.js | 18 ++-- src/controllers/api.js | 1 + src/controllers/categories.js | 4 +- src/controllers/groups.js | 2 + src/controllers/index.js | 8 +- src/controllers/popular.js | 3 +- src/controllers/recent.js | 1 + src/controllers/tags.js | 6 +- src/controllers/unread.js | 2 + src/controllers/users.js | 19 +++-- src/meta.js | 1 - src/meta/title.js | 142 ------------------------------- src/middleware/admin.js | 10 +-- src/middleware/middleware.js | 38 ++++----- src/socket.io/meta.js | 12 --- 18 files changed, 89 insertions(+), 223 deletions(-) delete mode 100644 src/meta/title.js diff --git a/public/language/en_GB/pages.json b/public/language/en_GB/pages.json index 5af14abe5e..6d6164ef9e 100644 --- a/public/language/en_GB/pages.json +++ b/public/language/en_GB/pages.json @@ -1,7 +1,10 @@ { "home": "Home", "unread": "Unread Topics", - "popular": "Popular Topics", + "popular-day": "Popular topics today", + "popular-week": "Popular topics this week", + "popular-month": "Popular topics this month", + "popular-alltime": "All time popular topics", "recent": "Recent Topics", "users/online": "Online Users", @@ -25,15 +28,15 @@ "chats": "Chats", "chat": "Chatting with %1", - "user.edit": "Editing \"%1\"", - "user.following": "People %1 Follows", - "user.followers": "People who Follow %1", - "user.posts": "Posts made by %1", - "user.topics": "Topics created by %1", - "user.groups": "%1's Groups", - "user.favourites": "%1's Favourite Posts", - "user.settings": "User Settings", - "user.watched": "Topics watched by %1", + "account/edit": "Editing \"%1\"", + "account/following": "People %1 follows", + "account/followers": "People who follow %1", + "account/posts": "Posts made by %1", + "account/topics": "Topics created by %1", + "account/groups": "%1's Groups", + "account/favourites": "%1's Favourite Posts", + "account/settings": "User Settings", + "account/watched": "Topics watched by %1", "maintenance.text": "%1 is currently undergoing maintenance. Please come back another time.", "maintenance.messageIntro": "Additionally, the administrator has left this message:" diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 622bc0afde..da8b2e6e9e 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -150,7 +150,7 @@ $(document).ready(function() { $('#content, #footer').removeClass('ajaxifying'); - app.refreshTitle(url); + app.refreshTitle(data.title); }); }); } diff --git a/public/src/app.js b/public/src/app.js index 35ba560613..8aeb81ea17 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -389,19 +389,13 @@ app.cacheBuster = null; } }; - app.refreshTitle = function(url) { - if (!url) { - var a = document.createElement('a'); - a.href = document.location; - url = a.pathname.slice(1); - } - - socket.emit('meta.buildTitle', url, function(err, title, numNotifications) { - if (err) { - return; - } - titleObj.titles[0] = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title; - app.alternatingTitle(''); + app.refreshTitle = function(title) { + require(['translator'], function(translator) { + translator.translate(title, function(translated) { + translated = translated ? (translated + ' | ' + config.browserTitle) : config.browserTitle; + titleObj.titles[0] = translated; + app.alternatingTitle(''); + }); }); }; diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index e9c78471af..cafcabafcb 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -230,6 +230,7 @@ function getFollow(tpl, name, req, res, next) { userData.users = users; userData.nextStart = 50; + userData.title = '[[pages:' + tpl + ', ' + userData.username + ']]'; res.render(tpl, userData); }); @@ -268,7 +269,7 @@ accountsController.getGroups = function(req, res, next) { userData.groups = groupsData[0]; userData.groups.forEach(groups.escapeGroupData); - + userData.title = '[[pages:account/groups, ' + userData.username + ']]'; res.render('account/groups', userData); }); }); @@ -321,6 +322,8 @@ function getFromUserSet(tpl, set, method, type, req, res, next) { var pagination = require('../pagination'); userData.pagination = pagination.create(page, pageCount); + userData.title = '[[pages:' + tpl + ', ' + userData.username + ']]'; + res.render(tpl, userData); }); }); @@ -377,7 +380,7 @@ accountsController.accountEdit = function(req, res, next) { } userData.hasPassword = !!password; - + userData.title = '[[pages:account/edit, ' + userData.username + ']]'; res.render('account/edit', userData); }); }; @@ -514,6 +517,8 @@ accountsController.accountSettings = function(req, res, next) { userData.disableCustomUserSkins = parseInt(meta.config.disableCustomUserSkins, 10) === 1; + userData.title = '[[pages:account/settings]]'; + res.render('account/settings', userData); }); }; @@ -563,7 +568,8 @@ accountsController.getNotifications = function(req, res, next) { return next(err); } res.render('notifications', { - notifications: notifications + notifications: notifications, + title: '[[pages:notifications]]' }); }); }; @@ -603,7 +609,8 @@ accountsController.getChats = function(req, res, next) { chats: results.recentChats.users, nextStart: results.recentChats.nextStart, contacts: results.contacts, - allowed: true + allowed: true, + title: '[[pages:chats]]' }); } @@ -631,7 +638,8 @@ accountsController.getChats = function(req, res, next) { contacts: results.contacts, meta: data.toUser, messages: data.messages, - allowed: data.allowed + allowed: data.allowed, + title: '[[pages:chat, ' + data.toUser.username + ']]' }); }); }); diff --git a/src/controllers/api.js b/src/controllers/api.js index cc51bfce52..ed0be22efe 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -27,6 +27,7 @@ apiController.getConfig = function(req, res, next) { config.websocketAddress = nconf.get('socket.io:address') || ''; config.version = nconf.get('version'); config.siteTitle = validator.escape(meta.config.title || meta.config.browserTitle || 'NodeBB'); + config.browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB'); config.showSiteTitle = parseInt(meta.config.showSiteTitle, 10) === 1; config.postDelay = meta.config.postDelay; config.minimumTitleLength = meta.config.minimumTitleLength; diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 6086640a5c..82c1cbc1e1 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -65,6 +65,8 @@ categoriesController.list = function(req, res, next) { return next(err); } + data.title = '[[pages:categories]]'; + plugins.fireHook('filter:categories.build', {req: req, res: res, templateData: data}, function(err, data) { if (err) { return next(err); @@ -250,7 +252,7 @@ categoriesController.get = function(req, res, next) { data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1; data.rssFeedUrl = nconf.get('relative_path') + '/category/' + data.cid + '.rss'; data.pagination = pagination.create(data.currentPage, data.pageCount); - + data.title = data.name; data.pagination.rel.forEach(function(rel) { res.locals.linkTags.push(rel); }); diff --git a/src/controllers/groups.js b/src/controllers/groups.js index 071ffcb975..a44307d41e 100644 --- a/src/controllers/groups.js +++ b/src/controllers/groups.js @@ -16,6 +16,7 @@ groupsController.list = function(req, res, next) { if (err) { return next(err); } + data.title = '[[pages:groups]]'; res.render('groups/list', data); }); }; @@ -97,6 +98,7 @@ groupsController.details = function(req, res, next) { return helpers.notFound(req, res); } + results.title = '[[pages:group, ' + results.group.displayName + ']]'; res.render('groups/details', results); }); }); diff --git a/src/controllers/index.js b/src/controllers/index.js index 0b99fea291..f6cf3c3c6d 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -61,7 +61,8 @@ Controllers.reset = function(req, res, next) { valid: valid, displayExpiryNotice: req.session.passwordExpired, code: req.params.code ? req.params.code : null, - breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]', url: '/reset'}, {text: '[[reset_password:update_password]]'}]) + breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]', url: '/reset'}, {text: '[[reset_password:update_password]]'}]), + title: '[[pages:reset]]' }); delete req.session.passwordExpired; @@ -69,7 +70,8 @@ Controllers.reset = function(req, res, next) { } else { res.render('reset', { code: req.params.code ? req.params.code : null, - breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]'}]) + breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]'}]), + title: '[[pages:reset]]' }); } @@ -90,6 +92,7 @@ Controllers.login = function(req, res, next) { data.allowLoginWith = '[[login:' + (meta.config.allowLoginWith || 'username-email') + ']]'; data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:login]]'}]); data.error = req.flash('error')[0]; + data.title = '[[pages:login]]'; res.render('login', data); }; @@ -128,6 +131,7 @@ Controllers.register = function(req, res, next) { data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[register:register]]'}]); data.regFormEntry = []; data.error = req.flash('error')[0]; + data.title = '[[pages:register]]'; plugins.fireHook('filter:register.build', {req: req, res: res, templateData: data}, next); } diff --git a/src/controllers/popular.js b/src/controllers/popular.js index 6f1b025bc1..9a39af45f6 100644 --- a/src/controllers/popular.js +++ b/src/controllers/popular.js @@ -36,7 +36,8 @@ popularController.get = function(req, res, next) { topics: topics, 'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1, rssFeedUrl: nconf.get('relative_path') + '/popular/' + (req.params.term || 'daily') + '.rss', - breadcrumbs: helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}]) + breadcrumbs: helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}]), + title: '[[pages:popular-' + term + ']]' }; if (!req.uid) { diff --git a/src/controllers/recent.js b/src/controllers/recent.js index 99b65bab88..a7f0cfca8a 100644 --- a/src/controllers/recent.js +++ b/src/controllers/recent.js @@ -21,6 +21,7 @@ recentController.get = function(req, res, next) { data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1; data.rssFeedUrl = nconf.get('relative_path') + '/recent.rss'; data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]); + data.title = '[[pages:recent]]'; plugins.fireHook('filter:recent.build', {req: req, res: res, templateData: data}, function(err, data) { if (err) { diff --git a/src/controllers/tags.js b/src/controllers/tags.js index c63e220cc8..6c9654006f 100644 --- a/src/controllers/tags.js +++ b/src/controllers/tags.js @@ -62,7 +62,8 @@ tagsController.getTag = function(req, res, next) { topics: results.topics, tag: tag, nextStart: stop + 1, - breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]', url: '/tags'}, {text: tag}]) + breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]', url: '/tags'}, {text: tag}]), + title: '[[pages:tag, ' + tag + ']]' }; res.render('tag', data); }); @@ -76,7 +77,8 @@ tagsController.getTags = function(req, res, next) { var data = { tags: tags, nextStart: 100, - breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]'}]) + breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]'}]), + title: '[[pages:tags]]' }; res.render('tags', data); }); diff --git a/src/controllers/unread.js b/src/controllers/unread.js index edf663ce8d..f9cccf3d3a 100644 --- a/src/controllers/unread.js +++ b/src/controllers/unread.js @@ -55,6 +55,8 @@ unreadController.get = function(req, res, next) { } data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[unread:title]]'}]); + data.title = '[[pages:unread]]'; + res.render('unread', data); }); }; diff --git a/src/controllers/users.js b/src/controllers/users.js index 1a0be53e5c..f1d5af1f83 100644 --- a/src/controllers/users.js +++ b/src/controllers/users.js @@ -49,7 +49,8 @@ usersController.getOnlineUsers = function(req, res, next) { loadmore_display: results.count > 50 ? 'block' : 'hide', users: results.users, anonymousUserCount: websockets.getOnlineAnonCount(), - defaultGravatar: user.createGravatarURLFromEmail('') + defaultGravatar: user.createGravatarURLFromEmail(''), + title: '[[pages:users/online]]' }; render(req, res, userData, next); @@ -57,18 +58,18 @@ usersController.getOnlineUsers = function(req, res, next) { }; usersController.getUsersSortedByPosts = function(req, res, next) { - usersController.getUsers('users:postcount', 0, 49, req, res, next); + usersController.getUsers('users:postcount', '[[pages:users/sort-posts]]', 0, 49, req, res, next); }; usersController.getUsersSortedByReputation = function(req, res, next) { - usersController.getUsers('users:reputation', 0, 49, req, res, next); + usersController.getUsers('users:reputation', '[[pages:users/sort-reputation]]', 0, 49, req, res, next); }; usersController.getUsersSortedByJoinDate = function(req, res, next) { - usersController.getUsers('users:joindate', 0, 49, req, res, next); + usersController.getUsers('users:joindate', '[[pages:users/latest]]', 0, 49, req, res, next); }; -usersController.getUsers = function(set, start, stop, req, res, next) { +usersController.getUsers = function(set, title, start, stop, req, res, next) { usersController.getUsersAndCount(set, req.uid, start, stop, function(err, data) { if (err) { return next(err); @@ -78,7 +79,8 @@ usersController.getUsers = function(set, start, stop, req, res, next) { search_display: 'hidden', loadmore_display: data.count > (stop - start + 1) ? 'block' : 'hide', users: data.users, - pagination: pagination.create(1, pageCount) + pagination: pagination.create(1, pageCount), + title: title }; userData['route_' + set] = true; render(req, res, userData, next); @@ -119,7 +121,8 @@ usersController.getUsersForSearch = function(req, res, next) { var userData = { search_display: 'block', loadmore_display: 'hidden', - users: data.users + users: data.users, + title: '[[pages:users/search]]' }; render(req, res, userData, next); @@ -195,7 +198,7 @@ usersController.getMap = function(req, res, next) { } }); - res.render('usersMap', {rooms: data}); + res.render('usersMap', {rooms: data, title: '[[pages:users/map]]'}); }); }; diff --git a/src/meta.js b/src/meta.js index 2def8dedff..a9b276c313 100644 --- a/src/meta.js +++ b/src/meta.js @@ -17,7 +17,6 @@ var async = require('async'), require('./meta/configs')(Meta); require('./meta/themes')(Meta); - require('./meta/title')(Meta); require('./meta/js')(Meta); require('./meta/css')(Meta); require('./meta/sounds')(Meta); diff --git a/src/meta/title.js b/src/meta/title.js deleted file mode 100644 index 8a100665b9..0000000000 --- a/src/meta/title.js +++ /dev/null @@ -1,142 +0,0 @@ -'use strict'; - -var winston = require('winston'), - validator = require('validator'), - user = require('../user'), - groups = require('../groups'), - plugins = require('../plugins'), - translator = require('../../public/src/modules/translator'); - -module.exports = function(Meta) { - Meta.title = {}; - - var tests = { - isCategory: /^category\/\d+\/?/, - isTopic: /^topic\/\d+\/?/, - isTag: /^tags\/[\s\S]+\/?/, - isUserPage: /^user\/[^\/]+(\/[\w]+)?/, - isGroup: /^groups\/[\s\S]+\/?/, - isChat: /^chats\/[\s\S]+\/?/ - }; - - Meta.title.build = function (urlFragment, language, callback) { - var uri = ''; - var fallbackTitle = validator.escape(Meta.config.browserTitle || Meta.config.title || 'NodeBB'); - try { - uri = decodeURIComponent(urlFragment); - } catch(e) { - winston.error('Invalid url fragment : ' + urlFragment, e.stack); - return callback(null, fallbackTitle); - } - - Meta.title.parseFragment(uri, language, function(err, title) { - if (err) { - title = fallbackTitle; - } else { - if (title) { - title = validator.escape(title); - } - title = (title ? title + ' | ' : '') + fallbackTitle; - } - - callback(null, title); - }); - }; - - Meta.title.parseFragment = function (urlFragment, language, callback) { - var translated = [ - '', 'recent', 'unread', 'notifications', 'popular', 'tags', 'chats', 'register', 'login', 'reset', 'categories', 'groups', - 'users/online', 'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/map', 'users/search' - ]; - - var onParsed = function(err, translated) { - if (err) { - return callback(err); - } - - plugins.fireHook('filter:parse.title', { - fragment: urlFragment, - language: language, - parsed: translated - }, function(err, data) { - if (err) { - return callback(err); - } - - callback(null, data.parsed); - }); - }; - - if (translated.indexOf(urlFragment) !== -1) { - if (!urlFragment.length) { - urlFragment = 'home'; - } - - translator.translate('[[pages:' + urlFragment + ']]', language, function(translated) { - onParsed(null, translated); - }); - } else if (tests.isCategory.test(urlFragment)) { - var cid = urlFragment.match(/category\/(\d+)/)[1]; - - require('../categories').getCategoryField(cid, 'name', onParsed); - } else if (tests.isTopic.test(urlFragment)) { - var tid = urlFragment.match(/topic\/(\d+)/)[1]; - - require('../topics').getTopicField(tid, 'title', onParsed); - } else if (tests.isTag.test(urlFragment)) { - var tag = urlFragment.match(/tags\/([\s\S]+)/)[1]; - - translator.translate('[[pages:tag, ' + tag + ']]', language, function(translated) { - onParsed(null, translated); - }); - } else if (tests.isGroup.test(urlFragment)) { - var slug = urlFragment.match(/groups\/([\s\S]+)/)[1]; - - groups.getGroupNameByGroupSlug(slug, function(err, groupname) { - if (err) { - return onParsed(err); - } - - translator.translate('[[pages:group, ' + groupname + ']]', language, function(translated) { - onParsed(null, translated); - }); - }); - } else if (tests.isChat.test(urlFragment)) { - var userslug = urlFragment.match(/chats\/([\s\S]+)/)[1]; - - user.getUsernameByUserslug(userslug, function(err, username) { - if (err) { - return onParsed(err); - } - - translator.translate('[[pages:chat, ' + username + ']]', language, function(translated) { - onParsed(null, translated); - }); - }); - } else if (tests.isUserPage.test(urlFragment)) { - var matches = urlFragment.match(/user\/([^\/]+)\/?([\w]+)?/), - userslug = matches[1], - subpage = matches[2]; - - user.getUsernameByUserslug(userslug, function(err, username) { - if (err) { - return onParsed(err); - } - - if (!username) { - username = '[[error:no-user]]'; - } - - if (!subpage) { - return onParsed(null, username); - } - - translator.translate('[[pages:user.' + subpage + ', ' + username + ']]', language, function(translated) { - onParsed(null, translated); - }); - }); - } else { - onParsed(null); - } - }; -}; \ No newline at end of file diff --git a/src/middleware/admin.js b/src/middleware/admin.js index ca02878335..cba2bc8bec 100644 --- a/src/middleware/admin.js +++ b/src/middleware/admin.js @@ -52,7 +52,7 @@ middleware.buildHeader = function(req, res, next) { }); }; -middleware.renderHeader = function(req, res, next) { +middleware.renderHeader = function(req, res, data, next) { var custom_header = { 'plugins': [], 'authentication': [] @@ -92,7 +92,7 @@ middleware.renderHeader = function(req, res, next) { } res.locals.config = results.config; - var data = { + var templateValues = { relative_path: nconf.get('relative_path'), configJSON: JSON.stringify(results.config), user: userData, @@ -104,10 +104,10 @@ middleware.renderHeader = function(req, res, next) { env: process.env.NODE_ENV ? true : false, }; - data.template = {name: res.locals.template}; - data.template[res.locals.template] = true; + templateValues.template = {name: res.locals.template}; + templateValues.template[res.locals.template] = true; - app.render('admin/header', data, next); + app.render('admin/header', templateValues, next); }); }); }; diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js index 7a3bc192b6..2e3386d44c 100644 --- a/src/middleware/middleware.js +++ b/src/middleware/middleware.js @@ -68,7 +68,7 @@ middleware.pageView = function(req, res, next) { middleware.pluginHooks = function(req, res, next) { async.each(plugins.loadedHooks['filter:router.page'] || [], function(hookObj, next) { - hookObj.method(req, res, next) + hookObj.method(req, res, next); }, function(req, res) { // If it got here, then none of the subscribed hooks did anything, or there were no hooks next(); @@ -143,12 +143,12 @@ middleware.checkAccountPermissions = function(req, res, next) { } user.isAdministrator(req.uid, next); - } + } ], function (err, allowed) { if (err || allowed) { return next(err); } - controllers.helpers.notAllowed(req, res); + controllers.helpers.notAllowed(req, res); }); }; @@ -202,7 +202,7 @@ middleware.buildHeader = function(req, res, next) { }); }; -middleware.renderHeader = function(req, res, callback) { +middleware.renderHeader = function(req, res, data, callback) { var registrationType = meta.config.registrationType || 'normal'; var templateValues = { bootswatchCSS: meta.config['theme:src'], @@ -237,23 +237,18 @@ middleware.renderHeader = function(req, res, callback) { templateValues.useCustomJS = parseInt(meta.config.useCustomJS, 10) === 1; next(null, templateValues.useCustomJS ? meta.config.customJS : ''); }, - title: function(next) { + settings: function(next) { if (req.uid) { - user.getSettings(req.uid, function(err, settings) { - if (err) { - return next(err); - } - - if (settings.bootswatchSkin && settings.bootswatchSkin !== 'default') { - templateValues.bootswatchCSS = '//maxcdn.bootstrapcdn.com/bootswatch/latest/' + settings.bootswatchSkin + '/bootstrap.min.css'; - } - - meta.title.build(req.url.slice(1), settings.userLang, next); - }); + user.getSettings(req.uid, next); } else { - meta.title.build(req.url.slice(1), meta.config.defaultLang, next); + next(); } }, + title: function(next) { + var title = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB'); + title = data.title ? (data.title + ' | ' + title) : title; + next(null, title); + }, isAdmin: function(next) { user.isAdministrator(req.uid, next); }, @@ -280,13 +275,16 @@ middleware.renderHeader = function(req, res, callback) { if (results.user && parseInt(results.user.banned, 10) === 1) { req.logout(); - res.redirect('/'); - return; + return res.redirect('/'); } results.user.isAdmin = results.isAdmin || false; 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/' + settings.bootswatchSkin + '/bootstrap.min.css'; + } + templateValues.browserTitle = results.title; templateValues.navigation = results.navigation; templateValues.metaTags = results.tags.meta; @@ -364,7 +362,7 @@ middleware.processRender = function(req, res, next) { if (res.locals.renderHeader || res.locals.renderAdminHeader) { var method = res.locals.renderHeader ? middleware.renderHeader : middleware.admin.renderHeader; - method(req, res, function(err, template) { + method(req, res, options, function(err, template) { if (err) { return fn(err); } diff --git a/src/socket.io/meta.js b/src/socket.io/meta.js index f0c9dd58ae..2b18044d33 100644 --- a/src/socket.io/meta.js +++ b/src/socket.io/meta.js @@ -35,18 +35,6 @@ emitter.on('nodebb:ready', function() { }); }); -SocketMeta.buildTitle = function(socket, text, callback) { - if (socket.uid) { - user.getSettings(socket.uid, function(err, settings) { - if (err) { - return callback(err); - } - meta.title.build(text, settings.userLang, callback); - }); - } else { - meta.title.build(text, meta.config.defaultLang, callback); - } -}; /* Rooms */