Node.js based forum software built for the modern web
refactor: remove dupe
Barış Soner Uşaklı66ba21013af9
diff --git a/public/src/modules/translator.common.js b/public/src/modules/translator.common.jsindex 2f3a43d9f2..80295f6dd7 100644--- a/public/src/modules/translator.common.js+++ b/public/src/modules/translator.common.js@@ -499,10 +499,6 @@ module.exports = function (utils, load, warn) {isTranslationKey: isTranslationKey,hasTranslationKey: hasTranslationKey,- isTranslationKey: function (str) {- return typeof str === 'string' && /\[\[([a-zA-Z0-9_.-]+:[^[\]]+)\]\]/.test(str);- },-flush: function () {Object.keys(Translator.cache).forEach(function (code) {Translator.cache[code].translations = {};diff --git a/src/user/notifications.js b/src/user/notifications.jsindex e907816068..72e66a6905 100644--- a/src/user/notifications.js+++ b/src/user/notifications.js@@ -139,11 +139,11 @@ UserNotifications.getNotifications = async function (nids, uid) {n.bodyShort = posts.sanitize(await tx.translate(n.bodyShort, userSettings.userLang));}if (n?.bodyLong) {+ if (n.txBodyLong) {+ n.bodyLong = await tx.translate(n.bodyLong, userSettings.userLang);+ }n.bodyLong = posts.sanitize(n.bodyLong);}- if (n?.bodyLong && n?.txBodyLong) {- n.bodyLong = await tx.translate(n.bodyLong, userSettings.userLang);- }}));const result = await plugins.hooks.fire('filter:user.notifications.getNotifications', {diff --git a/test/topics/events.js b/test/topics/events.jsindex 36f989590c..37b08948bb 100644--- a/test/topics/events.js+++ b/test/topics/events.js@@ -127,7 +127,7 @@ describe('Topic Events', () => {const events = await topics.events.get(topicData.tid, uid);- assert.deepStrictEqual(events[0].text, `<span title=""><script>alert("xss")</script> [[global:posts]]" data-uid="${uid}" class="avatar avatar-rounded" component="avatar/icon" style="--avatar-size: 16px; background-color: #827717">B</span> <a href="${nconf.get('relative_path')}/user/bar">"><script>alert("xss")</script> [[global:posts]]</a> <a href="${nconf.get('relative_path')}/topic/${topicData.tid}">forked</a> this topic <span class="timeago timeline-text" title="${new Date(now).toISOString()}"></span>`);+ assert.deepStrictEqual(events[0].text, `<span title=""><script>alert("xss")</script> [[global:posts]]" data-uid="${uid}" class="avatar avatar-rounded" component="avatar/icon" style="--avatar-size: 16px; background-color: #827717">B</span> <a href="${nconf.get('relative_path')}/user/bar">"><script>alert("xss")</script> [[global:posts]]</a> <a href="${nconf.get('relative_path')}/topic/${topicData.tid}">forked</a> this topic <span class="timeago timeline-text" title="${new Date(now).toISOString()}"></span>`);meta.config.showFullnameAsDisplayName = oldVlaueShowFullnameAsDisplayName;});