From fcb381f922840f2904b51cc1865946954246c021 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 31 Dec 2015 12:03:48 -0500 Subject: [PATCH] Fixes #3695 Guests now trigger topic notifications, and the translator has been updated so that translations inside translations are handled in a way that doesn't cause the translator to explode. --- public/src/modules/translator.js | 9 +++++++-- src/topics/create.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index ca9cbb9f29..0b31e372c2 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -9,7 +9,7 @@ var languages = {}, regexes = { - match: /\[\[\w+:.*?\]\]/g, + match: /\[\[\w+:[^\[]*?\]\]/g, split: /[,][\s]*/, replace: /\]+$/ }; @@ -153,7 +153,12 @@ translateKey(key, data, language, function(translated) { --count; if (count <= 0) { - callback(translated.text); + keys = translated.text.match(regexes.match); + if (!keys) { + callback(translated.text); + } else { + translateKeys(keys, translated.text, language, callback); + } } }); }); diff --git a/src/topics/create.js b/src/topics/create.js index af576b9d03..5c8698dbe1 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -252,10 +252,10 @@ module.exports = function(Topics) { } if (parseInt(uid, 10)) { - Topics.notifyFollowers(postData, uid); user.setUserField(uid, 'lastonline', Date.now()); } + Topics.notifyFollowers(postData, uid); plugins.fireHook('action:topic.reply', postData); next(null, postData);