mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +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'),
|
meta = require('./meta'),
|
||||||
websockets = require('./socket.io'),
|
websockets = require('./socket.io'),
|
||||||
events = require('./events'),
|
events = require('./events'),
|
||||||
Plugins = require('./plugins');
|
plugins = require('./plugins');
|
||||||
|
|
||||||
|
|
||||||
(function(ThreadTools) {
|
(function(ThreadTools) {
|
||||||
@@ -54,7 +54,7 @@ var winston = require('winston'),
|
|||||||
|
|
||||||
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
|
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);
|
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);
|
||||||
|
|
||||||
@@ -117,6 +117,11 @@ var winston = require('winston'),
|
|||||||
|
|
||||||
topics.setTopicField(tid, 'locked', lock ? 1 : 0);
|
topics.setTopicField(tid, 'locked', lock ? 1 : 0);
|
||||||
|
|
||||||
|
plugins.fireHook('action:topic.lock', {
|
||||||
|
tid: tid,
|
||||||
|
isLocked: lock
|
||||||
|
});
|
||||||
|
|
||||||
emitTo('topic_' + tid);
|
emitTo('topic_' + tid);
|
||||||
emitTo('category_' + cid);
|
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);
|
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('topic_' + tid);
|
||||||
emitTo('category_' + cid);
|
emitTo('category_' + cid);
|
||||||
|
|
||||||
@@ -195,6 +205,12 @@ var winston = require('winston'),
|
|||||||
categories.moveRecentReplies(tid, oldCid, cid);
|
categories.moveRecentReplies(tid, oldCid, cid);
|
||||||
|
|
||||||
topics.setTopicField(tid, 'cid', cid, callback);
|
topics.setTopicField(tid, 'cid', cid, callback);
|
||||||
|
|
||||||
|
plugins.fireHook('action:topic.move', {
|
||||||
|
tid: tid,
|
||||||
|
fromCid: oldCid,
|
||||||
|
toCid: cid
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user