From a228dc2de98797e4d4a59a9ff668857f340d0a7b Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Tue, 23 Oct 2018 17:50:36 -0400 Subject: [PATCH] closes #6797 --- src/socket.io/posts/move.js | 2 +- src/topics/fork.js | 10 +++++----- src/topics/merge.js | 2 +- test/topics.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/socket.io/posts/move.js b/src/socket.io/posts/move.js index fb1cc20756..1716d066f3 100644 --- a/src/socket.io/posts/move.js +++ b/src/socket.io/posts/move.js @@ -28,7 +28,7 @@ module.exports = function (SocketPosts) { return next(new Error('[[error:no-privileges]]')); } - topics.movePostToTopic(pid, data.tid, next); + topics.movePostToTopic(socket.uid, pid, data.tid, next); }, function (next) { socketHelpers.sendNotificationToPostOwner(pid, socket.uid, 'move', 'notifications:moved_your_post'); diff --git a/src/topics/fork.js b/src/topics/fork.js index de34054c3f..5ea1ca1f87 100644 --- a/src/topics/fork.js +++ b/src/topics/fork.js @@ -52,8 +52,8 @@ module.exports = function (Topics) { } Topics.create({ uid: results.postData.uid, title: title, cid: cid }, next); }, - function (results, next) { - Topics.updateTopicBookmarks(fromTid, pids, function () { next(null, results); }); + function (tid, next) { + Topics.updateTopicBookmarks(fromTid, pids, function (err) { next(err, tid); }); }, function (_tid, next) { tid = _tid; @@ -63,7 +63,7 @@ module.exports = function (Topics) { return next(err || new Error(canEdit.message)); } - Topics.movePostToTopic(pid, tid, next); + Topics.movePostToTopic(uid, pid, tid, next); }); }, next); }, @@ -77,7 +77,7 @@ module.exports = function (Topics) { ], callback); }; - Topics.movePostToTopic = function (pid, tid, callback) { + Topics.movePostToTopic = function (callerUid, pid, tid, callback) { var postData; async.waterfall([ function (next) { @@ -125,7 +125,7 @@ module.exports = function (Topics) { }); }, function (next) { - plugins.fireHook('action:post.move', { post: postData, tid: tid }); + plugins.fireHook('action:post.move', { uid: callerUid, post: postData, tid: tid }); next(); }, ], callback); diff --git a/src/topics/merge.js b/src/topics/merge.js index 0477de3b41..e97261f8d7 100644 --- a/src/topics/merge.js +++ b/src/topics/merge.js @@ -17,7 +17,7 @@ module.exports = function (Topics) { }, function (pids, next) { async.eachSeries(pids, function (pid, next) { - Topics.movePostToTopic(pid, mergeIntoTid, next); + Topics.movePostToTopic(uid, pid, mergeIntoTid, next); }, next); }, function (next) { diff --git a/test/topics.js b/test/topics.js index 27f867e7d3..06153cf192 100644 --- a/test/topics.js +++ b/test/topics.js @@ -508,7 +508,7 @@ describe('Topic\'s', function () { function (categoryData, next) { assert.equal(categoryData[0].post_count, 4); assert.equal(categoryData[1].post_count, 2); - topics.movePostToTopic(movedPost.pid, tid2, next); + topics.movePostToTopic(1, movedPost.pid, tid2, next); }, function (next) { checkCidSets(previousPost, topic2LastReply, next);