|
|
|
@ -209,18 +209,17 @@ module.exports = function (Topics) {
|
|
|
|
|
var uid = data.uid;
|
|
|
|
|
var content = data.content;
|
|
|
|
|
var postData;
|
|
|
|
|
var cid;
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
|
function (next) {
|
|
|
|
|
Topics.getTopicField(tid, 'cid', next);
|
|
|
|
|
},
|
|
|
|
|
function (_cid, next) {
|
|
|
|
|
cid = _cid;
|
|
|
|
|
function (cid, next) {
|
|
|
|
|
data.cid = cid;
|
|
|
|
|
async.parallel({
|
|
|
|
|
topicData: async.apply(Topics.getTopicData, tid),
|
|
|
|
|
canReply: async.apply(privileges.topics.can, 'topics:reply', tid, uid),
|
|
|
|
|
isAdminOrMod: async.apply(privileges.categories.isAdminOrMod, cid, uid),
|
|
|
|
|
isAdminOrMod: async.apply(privileges.categories.isAdminOrMod, data.cid, uid),
|
|
|
|
|
}, next);
|
|
|
|
|
},
|
|
|
|
|
function (results, next) {
|
|
|
|
@ -243,7 +242,7 @@ module.exports = function (Topics) {
|
|
|
|
|
guestHandleValid(data, next);
|
|
|
|
|
},
|
|
|
|
|
function (next) {
|
|
|
|
|
user.isReadyToPost(uid, cid, next);
|
|
|
|
|
user.isReadyToPost(uid, data.cid, next);
|
|
|
|
|
},
|
|
|
|
|
function (next) {
|
|
|
|
|
plugins.fireHook('filter:topic.reply', data, next);
|
|
|
|
@ -284,7 +283,7 @@ module.exports = function (Topics) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Topics.notifyFollowers(postData, uid);
|
|
|
|
|
analytics.increment(['posts', 'posts:byCid:' + cid]);
|
|
|
|
|
analytics.increment(['posts', 'posts:byCid:' + data.cid]);
|
|
|
|
|
plugins.fireHook('action:topic.reply', { post: _.clone(postData) });
|
|
|
|
|
|
|
|
|
|
next(null, postData);
|
|
|
|
|