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_multiple": "<strong>%1</strong> and %2 others started following you.",
"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-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: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

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

Loading…
Cancel
Save