mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 10:30:49 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -18,6 +18,7 @@ const utils = require('./utils');
|
||||
const emailer = require('./emailer');
|
||||
const ttlCache = require('./cache/ttl');
|
||||
const cron = require('./cron');
|
||||
const translator = require('./translator');
|
||||
|
||||
const Notifications = module.exports;
|
||||
|
||||
@@ -567,21 +568,18 @@ Notifications.merge = async function (notifications) {
|
||||
const usernames = _.uniq(set.map(notifObj => notifObj && notifObj.user && notifObj.user.displayname));
|
||||
const numUsers = usernames.length;
|
||||
|
||||
const title = utils.decodeHTMLEntities(notifications[modifyIndex].topicTitle || '');
|
||||
let titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');
|
||||
titleEscaped = titleEscaped ? (`, ${titleEscaped}`) : '';
|
||||
const title = utils.decodeHTMLEntities(notifObj.topicTitle || '');
|
||||
|
||||
if (numUsers === 2 || numUsers === 3) {
|
||||
notifications[modifyIndex].bodyShort = `[[${mergeId}-${typeFromLength(usernames)}, ${usernames.join(', ')}${titleEscaped}]]`;
|
||||
} else if (numUsers > 2) {
|
||||
notifications[modifyIndex].bodyShort = `[[${mergeId}-${typeFromLength(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${numUsers - 2}${titleEscaped}]]`;
|
||||
}
|
||||
const txKey = `${mergeId}-${typeFromLength(usernames)}`;
|
||||
const displayNames = usernames.slice(0, numUsers <= 3 ? 3 : 2).join(', ');
|
||||
notifObj.bodyShort = translator.compile(txKey, displayNames, title || '');
|
||||
|
||||
notifications[modifyIndex].path = set[set.length - 1].path;
|
||||
} break;
|
||||
notifObj.path = set[set.length - 1].path;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'new-register':
|
||||
notifications[modifyIndex].bodyShort = `[[notifications:${mergeId}-multiple, ${set.length}]]`;
|
||||
notifObj.bodyShort = `[[notifications:${mergeId}-multiple, ${set.length}]]`;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user