Node.js based forum software built for the modern web
closed #4098
Julian Lam9d0f53fcd64a
diff --git a/public/language/en_GB/notifications.json b/public/language/en_GB/notifications.jsonindex a02cada4a6..07ec757374 100644--- a/public/language/en_GB/notifications.json+++ b/public/language/en_GB/notifications.json@@ -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.",diff --git a/src/notifications.js b/src/notifications.jsindex 2351319413..1776103031 100644--- a/src/notifications.js+++ b/src/notifications.js@@ -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 separatelydifferentiators = 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 duplicatesdiff --git a/src/user/approval.js b/src/user/approval.jsindex a4a3981002..9ed17be898 100644--- a/src/user/approval.js+++ b/src/user/approval.js@@ -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);