mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
fixed bug with notif merging
This commit is contained in:
@@ -340,7 +340,7 @@ var async = require('async'),
|
|||||||
'notifications:user_posted_to',
|
'notifications:user_posted_to',
|
||||||
'notifications:user_flagged_post_in'
|
'notifications:user_flagged_post_in'
|
||||||
],
|
],
|
||||||
isolated, modifyIndex;
|
isolated, differentiator, modifyIndex;
|
||||||
|
|
||||||
notifications = mergeIds.reduce(function(notifications, mergeId) {
|
notifications = mergeIds.reduce(function(notifications, mergeId) {
|
||||||
isolated = notifications.filter(function(notifObj) {
|
isolated = notifications.filter(function(notifObj) {
|
||||||
@@ -355,6 +355,8 @@ var async = require('async'),
|
|||||||
return notifications; // Nothing to merge
|
return notifications; // Nothing to merge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
differentiator = isolated[0].mergeId.split('|')[1];
|
||||||
|
|
||||||
modifyIndex = notifications.indexOf(isolated[0]);
|
modifyIndex = notifications.indexOf(isolated[0]);
|
||||||
|
|
||||||
switch(mergeId) {
|
switch(mergeId) {
|
||||||
@@ -370,16 +372,16 @@ var async = require('async'),
|
|||||||
|
|
||||||
// Update bodyShort
|
// Update bodyShort
|
||||||
if (numUsers === 2) {
|
if (numUsers === 2) {
|
||||||
isolated[0].bodyShort = '[[' + mergeId.split('|') + '_dual, ' + usernames.join(', ') + ', ' + isolated[0].topicTitle + ']]'
|
isolated[0].bodyShort = '[[' + mergeId + '_dual, ' + usernames.join(', ') + ', ' + isolated[0].topicTitle + ']]'
|
||||||
} else {
|
} else {
|
||||||
isolated[0].bodyShort = '[[' + mergeId.split('|') + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + isolated[0].topicTitle + ']]'
|
isolated[0].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + isolated[0].topicTitle + ']]'
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out duplicates
|
// Filter out duplicates
|
||||||
return notifications.filter(function(notifObj, idx) {
|
return notifications.filter(function(notifObj, idx) {
|
||||||
return notifObj.mergeId !== mergeId || idx === modifyIndex;
|
return notifObj.mergeId !== mergeId + '|' + differentiator || idx === modifyIndex;
|
||||||
});
|
});
|
||||||
}, notifications);
|
}, notifications);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user