v1.18.x
Baris Usakli 7 years ago
parent 189008af75
commit 6a6dc7ef06

@ -63,11 +63,15 @@ define('forum/topic/move', ['categorySelector'], function (categorySelector) {
}
function moveTopics() {
socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', {
var data = {
tids: Move.tids,
cid: selectedCategory.cid,
currentCid: Move.currentCid,
}, function (err) {
};
$(window).trigger('action:topic.move', data);
socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', data, function (err) {
modal.modal('hide');
if (err) {

@ -28,7 +28,8 @@ module.exports = function (SocketTopics) {
function (_topicData, next) {
topicData = _topicData;
topicData.tid = tid;
topics.tools.move(tid, data.cid, socket.uid, next);
data.uid = socket.uid;
topics.tools.move(tid, data, next);
},
function (next) {
socketHelpers.emitToTopicAndCategory('event:topic_moved', topicData);
@ -59,8 +60,9 @@ module.exports = function (SocketTopics) {
categories.getAllTopicIds(data.currentCid, 0, -1, next);
},
function (tids, next) {
data.uid = socket.uid;
async.eachLimit(tids, 50, function (tid, next) {
topics.tools.move(tid, data.cid, socket.uid, next);
topics.tools.move(tid, data, next);
}, next);
},
], callback);

@ -243,9 +243,10 @@ module.exports = function (Topics) {
], callback);
};
topicTools.move = function (tid, cid, uid, callback) {
topicTools.move = function (tid, data, callback) {
var topic;
var oldCid;
var cid = data.cid;
async.waterfall([
function (next) {
Topics.exists(tid, next);
@ -311,12 +312,11 @@ module.exports = function (Topics) {
});
},
function (next) {
plugins.fireHook('action:topic.move', {
tid: tid,
fromCid: oldCid,
toCid: cid,
uid: uid,
});
var hookData = _.clone(data);
hookData.fromCid = oldCid;
hookData.toCid = cid;
hookData.tid = tid;
plugins.fireHook('action:topic.move', hookData);
next();
},
], callback);

Loading…
Cancel
Save