mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-02 12:50:00 +01:00
bonus two for #3481 - chats/username route
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
"notifications": "Notifications",
|
||||
"tags": "Tags",
|
||||
"tag": "Topics tagged under \"%1\"",
|
||||
"chats": "Chats",
|
||||
"register": "Register an account",
|
||||
"login": "Login to your account",
|
||||
"reset": "Reset your account password",
|
||||
@@ -23,6 +22,9 @@
|
||||
"groups": "Groups",
|
||||
"group": "%1 group",
|
||||
|
||||
"chats": "Chats",
|
||||
"chat": "Chatting with %1",
|
||||
|
||||
"user.edit": "Editing \"%1\"",
|
||||
"user.following": "People %1 Follows",
|
||||
"user.followers": "People who Follow %1",
|
||||
|
||||
@@ -15,7 +15,8 @@ module.exports = function(Meta) {
|
||||
isTopic: /^topic\/\d+\/?/,
|
||||
isTag: /^tags\/[\s\S]+\/?/,
|
||||
isUserPage: /^user\/[^\/]+(\/[\w]+)?/,
|
||||
isGroup: /^groups\/[\s\S]+\/?/
|
||||
isGroup: /^groups\/[\s\S]+\/?/,
|
||||
isChat: /^chats\/[\s\S]+\/?/
|
||||
};
|
||||
|
||||
Meta.title.build = function (urlFragment, language, callback) {
|
||||
@@ -100,6 +101,18 @@ module.exports = function(Meta) {
|
||||
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],
|
||||
|
||||
Reference in New Issue
Block a user