mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
#621, moved everything out of parallel - poster doesn't need to wait for these functions to happen
also renamed topics.markUnRead to topics.markAsUnreadForAll
This commit is contained in:
49
src/posts.js
49
src/posts.js
@@ -135,38 +135,29 @@ var db = require('./database'),
|
||||
}
|
||||
|
||||
Posts.getCidByPid(postData.pid, function(err, cid) {
|
||||
db.delete('cid:' + cid + ':read_by_uid');
|
||||
});
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
topics.markUnRead(tid, function(err) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
topics.markAsRead(tid, uid);
|
||||
next();
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
topics.pushUnreadCount(null, next);
|
||||
},
|
||||
function(next) {
|
||||
threadTools.notifyFollowers(tid, uid);
|
||||
next();
|
||||
},
|
||||
function(next) {
|
||||
Posts.addUserInfoToPost(postData, function(err) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
], function(err, results) {
|
||||
if(err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
|
||||
db.delete('cid:' + cid + ':read_by_uid');
|
||||
});
|
||||
|
||||
topics.markAsUnreadForAll(tid, function(err) {
|
||||
if(err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
|
||||
topics.markAsRead(tid, uid);
|
||||
topics.pushUnreadCount();
|
||||
});
|
||||
|
||||
threadTools.notifyFollowers(tid, uid);
|
||||
|
||||
Posts.addUserInfoToPost(postData, function(err) {
|
||||
if(err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
|
||||
callback(null, postData);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -701,7 +701,7 @@ var async = require('async'),
|
||||
});
|
||||
}
|
||||
|
||||
Topics.markUnRead = function(tid, callback) {
|
||||
Topics.markAsUnreadForAll = function(tid, callback) {
|
||||
db.delete('tid:' + tid + ':read_by_uid', callback);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user