|
|
|
@ -395,7 +395,8 @@ var async = require('async'),
|
|
|
|
|
'notifications:upvoted_your_post_in',
|
|
|
|
|
'notifications:user_started_following_you',
|
|
|
|
|
'notifications:user_posted_to',
|
|
|
|
|
'notifications:user_flagged_post_in'
|
|
|
|
|
'notifications:user_flagged_post_in',
|
|
|
|
|
'new_register'
|
|
|
|
|
],
|
|
|
|
|
isolated, differentiators, differentiator, modifyIndex, set;
|
|
|
|
|
|
|
|
|
@ -414,7 +415,7 @@ var async = require('async'),
|
|
|
|
|
|
|
|
|
|
// Each isolated mergeId may have multiple differentiators, so process each separately
|
|
|
|
|
differentiators = isolated.reduce(function(cur, next) {
|
|
|
|
|
differentiator = next.mergeId.split('|')[1];
|
|
|
|
|
differentiator = next.mergeId.split('|')[1] || 0;
|
|
|
|
|
if (cur.indexOf(differentiator) === -1) {
|
|
|
|
|
cur.push(differentiator);
|
|
|
|
|
}
|
|
|
|
@ -423,9 +424,14 @@ var async = require('async'),
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
differentiators.forEach(function(differentiator) {
|
|
|
|
|
set = isolated.filter(function(notifObj) {
|
|
|
|
|
return notifObj.mergeId === (mergeId + '|' + differentiator);
|
|
|
|
|
});
|
|
|
|
|
if (differentiator === 0 && differentiators.length === 1) {
|
|
|
|
|
set = isolated;
|
|
|
|
|
} else {
|
|
|
|
|
set = isolated.filter(function(notifObj) {
|
|
|
|
|
return notifObj.mergeId === (mergeId + '|' + differentiator);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modifyIndex = notifications.indexOf(set[0]);
|
|
|
|
|
if (modifyIndex === -1 || set.length === 1) {
|
|
|
|
|
return notifications;
|
|
|
|
@ -450,6 +456,10 @@ var async = require('async'),
|
|
|
|
|
notifications[modifyIndex].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + notifications[modifyIndex].topicTitle + ']]';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'new_register':
|
|
|
|
|
notifications[modifyIndex].bodyShort = '[[notifications:' + mergeId + '_multiple, ' + set.length + ']]';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Filter out duplicates
|
|
|
|
|