v1.18.x
Baris Usakli 6 years ago
parent e2ecbae06c
commit a228dc2de9

@ -28,7 +28,7 @@ module.exports = function (SocketPosts) {
return next(new Error('[[error:no-privileges]]')); return next(new Error('[[error:no-privileges]]'));
} }
topics.movePostToTopic(pid, data.tid, next); topics.movePostToTopic(socket.uid, pid, data.tid, next);
}, },
function (next) { function (next) {
socketHelpers.sendNotificationToPostOwner(pid, socket.uid, 'move', 'notifications:moved_your_post'); socketHelpers.sendNotificationToPostOwner(pid, socket.uid, 'move', 'notifications:moved_your_post');

@ -52,8 +52,8 @@ module.exports = function (Topics) {
} }
Topics.create({ uid: results.postData.uid, title: title, cid: cid }, next); Topics.create({ uid: results.postData.uid, title: title, cid: cid }, next);
}, },
function (results, next) { function (tid, next) {
Topics.updateTopicBookmarks(fromTid, pids, function () { next(null, results); }); Topics.updateTopicBookmarks(fromTid, pids, function (err) { next(err, tid); });
}, },
function (_tid, next) { function (_tid, next) {
tid = _tid; tid = _tid;
@ -63,7 +63,7 @@ module.exports = function (Topics) {
return next(err || new Error(canEdit.message)); return next(err || new Error(canEdit.message));
} }
Topics.movePostToTopic(pid, tid, next); Topics.movePostToTopic(uid, pid, tid, next);
}); });
}, next); }, next);
}, },
@ -77,7 +77,7 @@ module.exports = function (Topics) {
], callback); ], callback);
}; };
Topics.movePostToTopic = function (pid, tid, callback) { Topics.movePostToTopic = function (callerUid, pid, tid, callback) {
var postData; var postData;
async.waterfall([ async.waterfall([
function (next) { function (next) {
@ -125,7 +125,7 @@ module.exports = function (Topics) {
}); });
}, },
function (next) { function (next) {
plugins.fireHook('action:post.move', { post: postData, tid: tid }); plugins.fireHook('action:post.move', { uid: callerUid, post: postData, tid: tid });
next(); next();
}, },
], callback); ], callback);

@ -17,7 +17,7 @@ module.exports = function (Topics) {
}, },
function (pids, next) { function (pids, next) {
async.eachSeries(pids, function (pid, next) { async.eachSeries(pids, function (pid, next) {
Topics.movePostToTopic(pid, mergeIntoTid, next); Topics.movePostToTopic(uid, pid, mergeIntoTid, next);
}, next); }, next);
}, },
function (next) { function (next) {

@ -508,7 +508,7 @@ describe('Topic\'s', function () {
function (categoryData, next) { function (categoryData, next) {
assert.equal(categoryData[0].post_count, 4); assert.equal(categoryData[0].post_count, 4);
assert.equal(categoryData[1].post_count, 2); assert.equal(categoryData[1].post_count, 2);
topics.movePostToTopic(movedPost.pid, tid2, next); topics.movePostToTopic(1, movedPost.pid, tid2, next);
}, },
function (next) { function (next) {
checkCidSets(previousPost, topic2LastReply, next); checkCidSets(previousPost, topic2LastReply, next);

Loading…
Cancel
Save