removed double post notification #1386

v1.18.x
barisusakli 11 years ago
parent f9897daad1
commit f0428f5f1f

@ -11,7 +11,6 @@
"new_notification": "New Notification",
"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>",
"upvoted_your_post": "<strong>%1</strong> has upvoted your post.",
"favourited_your_post": "<strong>%1</strong> has favourited your post.",

@ -33,14 +33,11 @@ SocketPosts.reply = function(socket, data, callback) {
}
if (postData) {
module.parent.exports.emitTopicPostStats();
var socketData = {
websockets.server.sockets.emit('event:new_post', {
posts: [postData]
};
});
websockets.server.sockets.emit('event:new_post', socketData);
module.parent.exports.emitTopicPostStats();
callback();
}

@ -180,9 +180,8 @@ module.exports = function(Topics) {
},
function(data, next) {
postData = data;
threadTools.notifyFollowers(tid, postData.pid, uid);
user.notifications.sendPostNotificationToFollowers(uid, tid, postData.pid);
threadTools.notifyFollowers(tid, postData.pid, uid);
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) {
var websockets = require('./../socket.io');
UserNotifications.getUnreadCount(uid, function(err, count) {

Loading…
Cancel
Save