v1.18.x
Julian Lam 9 years ago
parent 3c7a42c959
commit 9d0f53fcd6

@ -32,6 +32,7 @@
"user_started_following_you_dual": "<strong>%1</strong> and <strong>%2</strong> started following you.", "user_started_following_you_dual": "<strong>%1</strong> and <strong>%2</strong> started following you.",
"user_started_following_you_multiple": "<strong>%1</strong> and %2 others started following you.", "user_started_following_you_multiple": "<strong>%1</strong> and %2 others started following you.",
"new_register": "<strong>%1</strong> sent a registration request.", "new_register": "<strong>%1</strong> sent a registration request.",
"new_register_multiple": "There are <strong>%1</strong> registration requests awaiting review.",
"email-confirmed": "Email Confirmed", "email-confirmed": "Email Confirmed",
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.", "email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",

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

@ -47,7 +47,8 @@ module.exports = function(User) {
notifications.create({ notifications.create({
bodyShort: '[[notifications:new_register, ' + username + ']]', bodyShort: '[[notifications:new_register, ' + username + ']]',
nid: 'new_register:' + username, nid: 'new_register:' + username,
path: '/admin/manage/registration' path: '/admin/manage/registration',
mergeId: 'new_register'
}, function(err, notification) { }, function(err, notification) {
if (err || !notification) { if (err || !notification) {
return callback(err); return callback(err);

Loading…
Cancel
Save