mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 05:37:35 +02:00
fix: merge with txArgs
This commit is contained in:
@@ -545,13 +545,18 @@ Notifications.merge = async function (notifications) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'notifications:user-posted-in-public-room': {
|
case 'notifications:user-posted-in-public-room': {
|
||||||
const usernames = _.uniq(set.map(notifObj => notifObj && notifObj.user && notifObj.user.displayname));
|
const usernames = _.uniq(set.map(n => n?.user?.displayname)).filter(Boolean);
|
||||||
if (usernames.length === 2 || usernames.length === 3) {
|
const type = typeFromLength(usernames);
|
||||||
notifObj.bodyShort = `[[${mergeId}-${typeFromLength(usernames)}, ${usernames.join(', ')}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
|
const isMultiple = type === 'multiple';
|
||||||
} else if (usernames.length > 3) {
|
const txArgs = [
|
||||||
notifObj.bodyShort = `[[${mergeId}-${typeFromLength(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${usernames.length - 2}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
|
`${mergeId}-${type}`,
|
||||||
}
|
usernames.slice(0, usernames.length <= 3 ? 3 : 2).join(', '),
|
||||||
|
...(isMultiple ? [usernames.length - 2] : []),
|
||||||
|
notifObj.roomIcon,
|
||||||
|
notifObj.roomName,
|
||||||
|
];
|
||||||
|
|
||||||
|
notifObj.bodyShort = translator.compile(...txArgs);
|
||||||
notifObj.path = set[set.length - 1].path;
|
notifObj.path = set[set.length - 1].path;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -561,11 +566,16 @@ Notifications.merge = async function (notifications) {
|
|||||||
case 'notifications:user-flagged-post-in':
|
case 'notifications:user-flagged-post-in':
|
||||||
case 'notifications:user-flagged-user':
|
case 'notifications:user-flagged-user':
|
||||||
case 'notifications:activitypub.announce': {
|
case 'notifications:activitypub.announce': {
|
||||||
const usernames = _.uniq(set.map(notifObj => notifObj && notifObj.user && notifObj.user.displayname));
|
const usernames = _.uniq(set.map(n => n?.user?.displayname)).filter(Boolean);
|
||||||
const txKey = `${mergeId}-${typeFromLength(usernames)}`;
|
const type = typeFromLength(usernames);
|
||||||
const displayNames = usernames.slice(0, usernames.length <= 3 ? 3 : 2).join(', ');
|
const isMultiple = type === 'multiple';
|
||||||
const title = utils.decodeHTMLEntities(notifObj.topicTitle || '');
|
const txArgs = [
|
||||||
notifObj.bodyShort = translator.compile(txKey, displayNames, title || '');
|
`${mergeId}-${type}`,
|
||||||
|
usernames.slice(0, usernames.length <= 3 ? 3 : 2).join(', '),
|
||||||
|
...(isMultiple ? [usernames.length - 2] : []),
|
||||||
|
utils.decodeHTMLEntities(notifObj.topicTitle || ''),
|
||||||
|
];
|
||||||
|
notifObj.bodyShort = translator.compile(...txArgs);
|
||||||
notifObj.path = set[set.length - 1].path;
|
notifObj.path = set[set.length - 1].path;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user