moved core notifications all the way to the end

v1.18.x
barisusakli 11 years ago
parent 6e335ff29a
commit f31978aa2c

@ -135,6 +135,7 @@ var async = require('async'),
} }
async.parallel([ async.parallel([
async.apply(db.setObjectField, 'uid:' + uid + ':notifications:uniqueId:nid', notif_data.uniqueId, nid),
async.apply(db.sortedSetAdd, 'uid:' + uid + ':notifications:unread', notif_data.datetime, notif_data.uniqueId), async.apply(db.sortedSetAdd, 'uid:' + uid + ':notifications:unread', notif_data.datetime, notif_data.uniqueId),
async.apply(db.sortedSetRemove, 'uid:' + uid + ':notifications:read', notif_data.uniqueId) async.apply(db.sortedSetRemove, 'uid:' + uid + ':notifications:read', notif_data.uniqueId)
], function(err) { ], function(err) {
@ -151,8 +152,7 @@ var async = require('async'),
// Plugins // Plugins
notif_data.uid = uid; notif_data.uid = uid;
plugins.fireHook('action:notification.pushed', notif_data); plugins.fireHook('action:notification.pushed', notif_data);
next();
db.setObjectField('uid:' + uid + ':notifications:uniqueId:nid', notif_data.uniqueId, nid, next);
}); });
}); });
}, callback); }, callback);

@ -203,13 +203,6 @@ module.exports = function(Topics) {
}, },
function(data, next) { function(data, next) {
postData = data; postData = data;
if (parseInt(uid, 10)) {
Topics.notifyFollowers(tid, postData.pid, uid);
user.notifications.sendPostNotificationToFollowers(uid, tid, postData.pid);
}
next(); next();
}, },
function(next) { function(next) {
@ -242,6 +235,12 @@ module.exports = function(Topics) {
postData.selfPost = false; postData.selfPost = false;
postData.relativeTime = utils.toISOString(postData.timestamp); postData.relativeTime = utils.toISOString(postData.timestamp);
if (parseInt(uid, 10)) {
Topics.notifyFollowers(tid, postData.pid, uid);
user.notifications.sendPostNotificationToFollowers(uid, tid, postData.pid);
}
next(null, postData); next(null, postData);
} }
], callback); ], callback);

Loading…
Cancel
Save