|
|
|
@ -15,7 +15,7 @@ module.exports = function(Meta) {
|
|
|
|
|
isUserPage: /^user\/[^\/]+(\/[\w]+)?/
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Meta.title.build = function (urlFragment, language, callback) {
|
|
|
|
|
Meta.title.build = function (urlFragment, language, locals, callback) {
|
|
|
|
|
var uri = '';
|
|
|
|
|
try {
|
|
|
|
|
uri = decodeURIComponent(urlFragment);
|
|
|
|
@ -23,7 +23,8 @@ module.exports = function(Meta) {
|
|
|
|
|
winston.error('Invalid url fragment : ' + urlFragment, e.stack);
|
|
|
|
|
return callback(null, Meta.config.browserTitle || 'NodeBB');
|
|
|
|
|
}
|
|
|
|
|
Meta.title.parseFragment(uri, language, function(err, title) {
|
|
|
|
|
|
|
|
|
|
Meta.title.parseFragment(uri, language, locals, function(err, title) {
|
|
|
|
|
if (err) {
|
|
|
|
|
title = Meta.config.browserTitle || 'NodeBB';
|
|
|
|
|
} else {
|
|
|
|
@ -34,7 +35,7 @@ module.exports = function(Meta) {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Meta.title.parseFragment = function (urlFragment, language, callback) {
|
|
|
|
|
Meta.title.parseFragment = function (urlFragment, language, locals, callback) {
|
|
|
|
|
urlFragment = validator.escape(urlFragment);
|
|
|
|
|
var translated = ['', 'recent', 'unread', 'users', 'notifications'];
|
|
|
|
|
if (translated.indexOf(urlFragment) !== -1) {
|
|
|
|
@ -69,6 +70,10 @@ module.exports = function(Meta) {
|
|
|
|
|
return callback(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (locals.notFound) {
|
|
|
|
|
username = '[[error:no-user]]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!subpage) {
|
|
|
|
|
return callback(null, username);
|
|
|
|
|
}
|
|
|
|
|