Skip to content

Node.js based forum software built for the modern web

fix: merged chat notifications if all the messages are from the same user

Barış Soner Uşaklı6147a4d0821f
diff --git a/src/notifications.js b/src/notifications.js
index d06108e8ca..e38ccd215f 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -519,7 +519,9 @@ Notifications.merge = async function (notifications) {
differentiators.forEach((differentiator) => {
function typeFromLength(items) {
- if (items.length === 2) {
+ if (items.length <= 1) {
+ return '';
+ } else if (items.length === 2) {
return 'dual';
} else if (items.length === 3) {
return 'triple';
@@ -553,7 +555,7 @@ Notifications.merge = async function (notifications) {
const type = typeFromLength(usernames);
const isMultiple = type === 'multiple';
const txArgs = [
- `${mergeId}-${type}`,
+ `${mergeId}${type ? '-type' : ''}`,
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
...(isMultiple ? [usernames.length - 2] : []),
notifObj.roomIcon,
@@ -574,7 +576,7 @@ Notifications.merge = async function (notifications) {
const type = typeFromLength(usernames);
const isMultiple = type === 'multiple';
const txArgs = [
- `${mergeId}-${type}`,
+ `${mergeId}${type ? '-type' : ''}`,
...usernames.slice(0, usernames.length <= 3 ? 3 : 2),
...(isMultiple ? [usernames.length - 2] : []),
utils.decodeHTMLEntities(notifObj.topicTitle || ''),