mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #2357
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user