mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 13:57:24 +02:00
fix: merged chat notifications if all the messages are from the same user
usernames.length ends up being 1 so need to use default translation string and not -dual/-triple/-multiple variants
This commit is contained in:
@@ -519,7 +519,9 @@ Notifications.merge = async function (notifications) {
|
|||||||
|
|
||||||
differentiators.forEach((differentiator) => {
|
differentiators.forEach((differentiator) => {
|
||||||
function typeFromLength(items) {
|
function typeFromLength(items) {
|
||||||
if (items.length === 2) {
|
if (items.length <= 1) {
|
||||||
|
return '';
|
||||||
|
} else if (items.length === 2) {
|
||||||
return 'dual';
|
return 'dual';
|
||||||
} else if (items.length === 3) {
|
} else if (items.length === 3) {
|
||||||
return 'triple';
|
return 'triple';
|
||||||
@@ -553,7 +555,7 @@ Notifications.merge = async function (notifications) {
|
|||||||
const type = typeFromLength(usernames);
|
const type = typeFromLength(usernames);
|
||||||
const isMultiple = type === 'multiple';
|
const isMultiple = type === 'multiple';
|
||||||
const txArgs = [
|
const txArgs = [
|
||||||
`${mergeId}-${type}`,
|
`${mergeId}${type ? '-type' : ''}`,
|
||||||
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
|
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
|
||||||
...(isMultiple ? [usernames.length - 2] : []),
|
...(isMultiple ? [usernames.length - 2] : []),
|
||||||
notifObj.roomIcon,
|
notifObj.roomIcon,
|
||||||
@@ -574,7 +576,7 @@ Notifications.merge = async function (notifications) {
|
|||||||
const type = typeFromLength(usernames);
|
const type = typeFromLength(usernames);
|
||||||
const isMultiple = type === 'multiple';
|
const isMultiple = type === 'multiple';
|
||||||
const txArgs = [
|
const txArgs = [
|
||||||
`${mergeId}-${type}`,
|
`${mergeId}${type ? '-type' : ''}`,
|
||||||
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
|
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
|
||||||
...(isMultiple ? [usernames.length - 2] : []),
|
...(isMultiple ? [usernames.length - 2] : []),
|
||||||
utils.decodeHTMLEntities(notifObj.topicTitle || ''),
|
utils.decodeHTMLEntities(notifObj.topicTitle || ''),
|
||||||
|
|||||||
Reference in New Issue
Block a user