mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
action:topic.lock, action:topic.pin, action:topic.move
This commit is contained in:
@@ -13,7 +13,7 @@ var winston = require('winston'),
|
||||
meta = require('./meta'),
|
||||
websockets = require('./socket.io'),
|
||||
events = require('./events'),
|
||||
Plugins = require('./plugins');
|
||||
plugins = require('./plugins');
|
||||
|
||||
|
||||
(function(ThreadTools) {
|
||||
@@ -54,7 +54,7 @@ var winston = require('winston'),
|
||||
|
||||
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
|
||||
|
||||
Plugins.fireHook(isDelete ? 'action:topic.delete' : 'action:topic.restore', tid);
|
||||
plugins.fireHook(isDelete ? 'action:topic.delete' : 'action:topic.restore', tid);
|
||||
|
||||
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);
|
||||
|
||||
@@ -117,6 +117,11 @@ var winston = require('winston'),
|
||||
|
||||
topics.setTopicField(tid, 'locked', lock ? 1 : 0);
|
||||
|
||||
plugins.fireHook('action:topic.lock', {
|
||||
tid: tid,
|
||||
isLocked: lock
|
||||
});
|
||||
|
||||
emitTo('topic_' + tid);
|
||||
emitTo('category_' + cid);
|
||||
|
||||
@@ -155,6 +160,11 @@ var winston = require('winston'),
|
||||
db.sortedSetAdd('categories:' + topicData.cid + ':tid', pin ? Math.pow(2, 53) : topicData.lastposttime, tid);
|
||||
});
|
||||
|
||||
plugins.fireHook('action:topic.pin', {
|
||||
tid: tid,
|
||||
isPinned: pin
|
||||
});
|
||||
|
||||
emitTo('topic_' + tid);
|
||||
emitTo('category_' + cid);
|
||||
|
||||
@@ -195,6 +205,12 @@ var winston = require('winston'),
|
||||
categories.moveRecentReplies(tid, oldCid, cid);
|
||||
|
||||
topics.setTopicField(tid, 'cid', cid, callback);
|
||||
|
||||
plugins.fireHook('action:topic.move', {
|
||||
tid: tid,
|
||||
fromCid: oldCid,
|
||||
toCid: cid
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user