Skip to content

Node.js based forum software built for the modern web

closes #2357

barisusakli642136f6f86b
diff --git a/src/postTools.js b/src/postTools.js
index 0de522ec1a..c9f51b07c3 100644
--- a/src/postTools.js
+++ b/src/postTools.js
@@ -67,6 +67,7 @@ var winston = require('winston'),
title = title.trim();
var topicData = {
+ tid: tid,
title: title,
slug: tid + '/' + utils.slugify(title)
};
@@ -75,7 +76,7 @@ var winston = require('winston'),
}
db.setObject('topic:' + tid, topicData, function(err) {
- plugins.fireHook('action:topic.edit', tid);
+ plugins.fireHook('action:topic.edit', topicData);
});
topics.updateTags(tid, options.tags, function(err) {
diff --git a/src/threadTools.js b/src/threadTools.js
index d1924bbfe2..b6609b6046 100644
--- a/src/threadTools.js
+++ b/src/threadTools.js
@@ -32,8 +32,8 @@ var winston = require('winston'),
};
function toggleDelete(tid, uid, isDelete, callback) {
- topics.getTopicFields(tid, ['cid', 'deleted'], function(err, topicData) {
- if(err) {
+ topics.getTopicFields(tid, ['tid', 'cid', 'deleted', 'title'], function(err, topicData) {
+ if (err) {
return callback(err);
}
@@ -49,13 +49,16 @@ var winston = require('winston'),
isDelete: isDelete
});
}
- if(err) {
+ if (err) {
return callback(err);
}
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
-
- plugins.fireHook(isDelete ? 'action:topic.delete' : 'action:topic.restore', tid);
+ if (isDelete) {
+ plugins.fireHook('action:topic.delete', tid);
+ } else {
+ plugins.fireHook('action:topic.restore', topicData);
+ }
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);
diff --git a/src/topics/create.js b/src/topics/create.js
index 56c1f5dd8f..2f8bf088be 100644
--- a/src/topics/create.js
+++ b/src/topics/create.js
@@ -84,7 +84,7 @@ module.exports = function(Topics) {
if (err) {
return callback(err);
}
- plugins.fireHook('action:topic.save', tid);
+ plugins.fireHook('action:topic.save', topicData);
callback(null, tid);
});
});