mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
closes #3912
This commit is contained in:
@@ -14,15 +14,23 @@
|
||||
|
||||
"new_message_from": "New message from <strong>%1</strong>",
|
||||
"upvoted_your_post_in": "<strong>%1</strong> has upvoted your post in <strong>%2</strong>.",
|
||||
"upvoted_your_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> have upvoted your post in <strong>%3</strong>.",
|
||||
"upvoted_your_post_in_multiple": "<strong>%1</strong> and %2 others have upvoted your post in <strong>%3</strong>.",
|
||||
"moved_your_post": "<strong>%1</strong> has moved your post to <strong>%2</strong>",
|
||||
"moved_your_topic": "<strong>%1</strong> has moved <strong>%2</strong>",
|
||||
"favourited_your_post_in": "<strong>%1</strong> has favourited your post in <strong>%2</strong>.",
|
||||
"favourited_your_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> have favourited your post in <strong>%3</strong>.",
|
||||
"favourited_your_post_in_multiple": "<strong>%1</strong> and %2 others have favourited your post in <strong>%3</strong>.",
|
||||
"user_flagged_post_in": "<strong>%1</strong> flagged a post in <strong>%2</strong>",
|
||||
"user_flagged_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a post in <strong>%3</strong>",
|
||||
"user_flagged_post_in_multiple": "<strong>%1</strong> and %2 others flagged a post in <strong>%3</strong>",
|
||||
"user_posted_to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>",
|
||||
"user_posted_to_dual" : "<strong>%1</strong> and <strong>%2</strong> have posted replies to: <strong>%3</strong>",
|
||||
"user_posted_to_multiple" : "<strong>%1</strong> and %2 others have posted replies to: <strong>%3</strong>",
|
||||
"user_posted_topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>",
|
||||
"user_started_following_you": "<strong>%1</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.",
|
||||
"new_register": "<strong>%1</strong> sent a registration request.",
|
||||
|
||||
"email-confirmed": "Email Confirmed",
|
||||
|
||||
@@ -333,12 +333,18 @@ var async = require('async'),
|
||||
|
||||
Notifications.merge = function(notifications, callback) {
|
||||
// When passed a set of notification objects, merge any that can be merged
|
||||
var mergeIds = ['notifications:favourited_your_post_in'],
|
||||
var mergeIds = [
|
||||
'notifications:favourited_your_post_in',
|
||||
'notifications:upvoted_your_post_in',
|
||||
'notifications:user_started_following_you',
|
||||
'notifications:user_posted_to',
|
||||
'notifications:user_flagged_post_in'
|
||||
],
|
||||
isolated, modifyIndex;
|
||||
|
||||
notifications = mergeIds.reduce(function(notifications, mergeId) {
|
||||
isolated = notifications.filter(function(notifObj) {
|
||||
return notifObj.mergeId === mergeId;
|
||||
return notifObj.mergeId.split('|')[0] === mergeId;
|
||||
});
|
||||
|
||||
if (isolated.length <= 1) {
|
||||
@@ -348,7 +354,11 @@ var async = require('async'),
|
||||
modifyIndex = notifications.indexOf(isolated[0]);
|
||||
|
||||
switch(mergeId) {
|
||||
case 'notifications:favourited_your_post_in':
|
||||
case 'notifications:favourited_your_post_in': // intentional fall-through
|
||||
case 'notifications:upvoted_your_post_in':
|
||||
case 'notifications:user_started_following_you':
|
||||
case 'notifications:user_posted_to':
|
||||
case 'notifications:user_flagged_post_in':
|
||||
var usernames = isolated.map(function(notifObj) {
|
||||
return notifObj.user.username;
|
||||
});
|
||||
@@ -356,9 +366,9 @@ var async = require('async'),
|
||||
|
||||
// Update bodyShort
|
||||
if (numUsers === 2) {
|
||||
isolated[0].bodyShort = '[[notifications:favourited_your_post_in_dual, ' + usernames.join(', ') + ', Welcome to your NodeBB!]]'
|
||||
isolated[0].bodyShort = '[[' + mergeId.split('|') + '_dual, ' + usernames.join(', ') + ', ' + isolated[0].topicTitle + ']]'
|
||||
} else {
|
||||
isolated[0].bodyShort = '[[notifications:favourited_your_post_in_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', Welcome to your NodeBB!]]'
|
||||
isolated[0].bodyShort = '[[' + mergeId.split('|') + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + isolated[0].topicTitle + ']]'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ SocketHelpers.sendNotificationToPostOwner = function(pid, fromuid, notification)
|
||||
pid: pid,
|
||||
nid: 'post:' + pid + ':uid:' + fromuid,
|
||||
from: fromuid,
|
||||
mergeId: notification
|
||||
mergeId: notification + '|' + postData.tid,
|
||||
topicTitle: results.topicTitle
|
||||
}, function(err, notification) {
|
||||
if (!err && notification) {
|
||||
notifications.push(notification, [postData.uid]);
|
||||
|
||||
@@ -84,7 +84,9 @@ module.exports = function(SocketPosts) {
|
||||
bodyLong: post.content,
|
||||
pid: data.pid,
|
||||
nid: 'post_flag:' + data.pid + ':uid:' + socket.uid,
|
||||
from: socket.uid
|
||||
from: socket.uid,
|
||||
mergeId: 'notifications:user_flagged_post_in|' + data.pid,
|
||||
topicTitle: post.topic.title
|
||||
}, function(err, notification) {
|
||||
if (err || !notification) {
|
||||
return next(err);
|
||||
|
||||
@@ -142,7 +142,8 @@ SocketUser.follow = function(socket, data, callback) {
|
||||
bodyShort: '[[notifications:user_started_following_you, ' + userData.username + ']]',
|
||||
nid: 'follow:' + data.uid + ':uid:' + socket.uid,
|
||||
from: socket.uid,
|
||||
path: '/user/' + userData.userslug
|
||||
path: '/user/' + userData.userslug,
|
||||
mergeId: 'notifications:user_started_following_you'
|
||||
}, next);
|
||||
},
|
||||
function(notification, next) {
|
||||
|
||||
@@ -137,7 +137,9 @@ module.exports = function(Topics) {
|
||||
pid: postData.pid,
|
||||
nid: 'new_post:tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + exceptUid,
|
||||
tid: postData.topic.tid,
|
||||
from: exceptUid
|
||||
from: exceptUid,
|
||||
mergeId: 'notifications:user_posted_to|' + postData.topic.tid,
|
||||
topicTitle: title
|
||||
}, function(err, notification) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
Reference in New Issue
Block a user