mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-19 02:50:53 +01:00
fix: closes #13872, use translator.compile for notification text
so commas don't cause issues
This commit is contained in:
@@ -13,6 +13,7 @@ const notifications = require('../notifications');
|
|||||||
const plugins = require('../plugins');
|
const plugins = require('../plugins');
|
||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
const batch = require('../batch');
|
const batch = require('../batch');
|
||||||
|
const translator = require('../translator');
|
||||||
|
|
||||||
const SocketHelpers = module.exports;
|
const SocketHelpers = module.exports;
|
||||||
|
|
||||||
@@ -113,10 +114,11 @@ SocketHelpers.sendNotificationToPostOwner = async function (pid, fromuid, comman
|
|||||||
|
|
||||||
const title = utils.decodeHTMLEntities(topicTitle);
|
const title = utils.decodeHTMLEntities(topicTitle);
|
||||||
const titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');
|
const titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');
|
||||||
|
const bodyShort = translator.compile(notification, userData.displayname || userData.name, titleEscaped);
|
||||||
|
|
||||||
const notifObj = await notifications.create({
|
const notifObj = await notifications.create({
|
||||||
type: command,
|
type: command,
|
||||||
bodyShort: `[[${notification}, ${userData.displayname || userData.name}, ${titleEscaped}]]`,
|
bodyShort: bodyShort,
|
||||||
bodyLong: postObj.content,
|
bodyLong: postObj.content,
|
||||||
pid: pid,
|
pid: pid,
|
||||||
tid: postData.tid,
|
tid: postData.tid,
|
||||||
|
|||||||
Reference in New Issue
Block a user