mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
removed double post notification #1386
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
"new_notification": "New Notification",
|
"new_notification": "New Notification",
|
||||||
"you_have_unread_notifications": "You have unread notifications.",
|
"you_have_unread_notifications": "You have unread notifications.",
|
||||||
|
|
||||||
"user_made_post": "<strong>%1</strong> made a new post",
|
|
||||||
"new_message_from": "New message from <strong>%1</strong>",
|
"new_message_from": "New message from <strong>%1</strong>",
|
||||||
"upvoted_your_post": "<strong>%1</strong> has upvoted your post.",
|
"upvoted_your_post": "<strong>%1</strong> has upvoted your post.",
|
||||||
"favourited_your_post": "<strong>%1</strong> has favourited your post.",
|
"favourited_your_post": "<strong>%1</strong> has favourited your post.",
|
||||||
|
|||||||
@@ -33,15 +33,12 @@ SocketPosts.reply = function(socket, data, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (postData) {
|
if (postData) {
|
||||||
|
websockets.server.sockets.emit('event:new_post', {
|
||||||
|
posts: [postData]
|
||||||
|
});
|
||||||
|
|
||||||
module.parent.exports.emitTopicPostStats();
|
module.parent.exports.emitTopicPostStats();
|
||||||
|
|
||||||
var socketData = {
|
|
||||||
posts: [postData]
|
|
||||||
};
|
|
||||||
|
|
||||||
websockets.server.sockets.emit('event:new_post', socketData);
|
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -180,9 +180,8 @@ module.exports = function(Topics) {
|
|||||||
},
|
},
|
||||||
function(data, next) {
|
function(data, next) {
|
||||||
postData = data;
|
postData = data;
|
||||||
threadTools.notifyFollowers(tid, postData.pid, uid);
|
|
||||||
|
|
||||||
user.notifications.sendPostNotificationToFollowers(uid, tid, postData.pid);
|
threadTools.notifyFollowers(tid, postData.pid, uid);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -148,27 +148,6 @@ var async = require('async'),
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
UserNotifications.sendPostNotificationToFollowers = function(uid, tid, pid) {
|
|
||||||
user.getUserField(uid, 'username', function(err, username) {
|
|
||||||
db.getSetMembers('followers:' + uid, function(err, followers) {
|
|
||||||
if (followers && followers.length) {
|
|
||||||
topics.getTopicField(tid, 'slug', function(err, slug) {
|
|
||||||
var message = '[[notifications:user_made_post, ' + username + ']]';
|
|
||||||
|
|
||||||
notifications.create({
|
|
||||||
text: message,
|
|
||||||
path: nconf.get('relative_path') + '/topic/' + slug + '#' + pid,
|
|
||||||
uniqueId: 'topic:' + tid,
|
|
||||||
from: uid
|
|
||||||
}, function(nid) {
|
|
||||||
notifications.push(nid, followers);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
UserNotifications.pushCount = function(uid) {
|
UserNotifications.pushCount = function(uid) {
|
||||||
var websockets = require('./../socket.io');
|
var websockets = require('./../socket.io');
|
||||||
UserNotifications.getUnreadCount(uid, function(err, count) {
|
UserNotifications.getUnreadCount(uid, function(err, count) {
|
||||||
|
|||||||
Reference in New Issue
Block a user