From 2e7d1f33dc3e475b06fae8390797c39f4a63e3eb Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 24 Jul 2014 14:22:48 -0400 Subject: [PATCH] action:topic.lock, action:topic.pin, action:topic.move --- src/threadTools.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/threadTools.js b/src/threadTools.js index 65bfdd26ae..2a4279d3dd 100644 --- a/src/threadTools.js +++ b/src/threadTools.js @@ -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 + }); }); };