v1.18.x
Barış Soner Uşaklı 7 years ago
parent 501cb2c086
commit 4ee2284066

@ -77,7 +77,7 @@ module.exports = function (Posts) {
function (next) { function (next) {
postData.cid = results.topic.cid; postData.cid = results.topic.cid;
postData.topic = results.topic; postData.topic = results.topic;
plugins.fireHook('action:post.edit', { post: _.clone(postData), uid: data.uid }); plugins.fireHook('action:post.edit', { post: _.clone(postData), data: data, uid: data.uid });
cache.del(String(postData.pid)); cache.del(String(postData.pid));
pubsub.publish('post:edit', String(postData.pid)); pubsub.publish('post:edit', String(postData.pid));

@ -179,26 +179,26 @@ module.exports = function (Topics) {
}, },
}, next); }, next);
}, },
function (data, next) { function (result, next) {
if (!Array.isArray(data.topicData) || !data.topicData.length) { if (!Array.isArray(result.topicData) || !result.topicData.length) {
return next(new Error('[[error:no-topic]]')); return next(new Error('[[error:no-topic]]'));
} }
data.topicData = data.topicData[0]; result.topicData = result.topicData[0];
data.topicData.unreplied = 1; result.topicData.unreplied = 1;
data.topicData.mainPost = data.postData; result.topicData.mainPost = result.postData;
data.postData.index = 0; result.postData.index = 0;
analytics.increment(['topics', 'topics:byCid:' + data.topicData.cid]); analytics.increment(['topics', 'topics:byCid:' + result.topicData.cid]);
plugins.fireHook('action:topic.post', { topic: data.topicData, post: data.postData }); plugins.fireHook('action:topic.post', { topic: result.topicData, post: result.postData, data: data });
if (parseInt(uid, 10)) { if (parseInt(uid, 10)) {
user.notifications.sendTopicNotificationToFollowers(uid, data.topicData, data.postData); user.notifications.sendTopicNotificationToFollowers(uid, result.topicData, result.postData);
} }
next(null, { next(null, {
topicData: data.topicData, topicData: result.topicData,
postData: data.postData, postData: result.postData,
}); });
}, },
], callback); ], callback);
@ -284,7 +284,7 @@ module.exports = function (Topics) {
Topics.notifyFollowers(postData, uid); Topics.notifyFollowers(postData, uid);
analytics.increment(['posts', 'posts:byCid:' + data.cid]); analytics.increment(['posts', 'posts:byCid:' + data.cid]);
plugins.fireHook('action:topic.reply', { post: _.clone(postData) }); plugins.fireHook('action:topic.reply', { post: _.clone(postData), data: data });
next(null, postData); next(null, postData);
}, },

Loading…
Cancel
Save