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();
|
title = title.trim();
|
||||||
|
|
||||||
var topicData = {
|
var topicData = {
|
||||||
|
tid: tid,
|
||||||
title: title,
|
title: title,
|
||||||
slug: tid + '/' + utils.slugify(title)
|
slug: tid + '/' + utils.slugify(title)
|
||||||
};
|
};
|
||||||
@@ -75,7 +76,7 @@ var winston = require('winston'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
db.setObject('topic:' + tid, topicData, function(err) {
|
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) {
|
topics.updateTags(tid, options.tags, function(err) {
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ var winston = require('winston'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
function toggleDelete(tid, uid, isDelete, callback) {
|
function toggleDelete(tid, uid, isDelete, callback) {
|
||||||
topics.getTopicFields(tid, ['cid', 'deleted'], function(err, topicData) {
|
topics.getTopicFields(tid, ['tid', 'cid', 'deleted', 'title'], function(err, topicData) {
|
||||||
if(err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,13 +49,16 @@ var winston = require('winston'),
|
|||||||
isDelete: isDelete
|
isDelete: isDelete
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
|
ThreadTools[isDelete ? 'lock' : 'unlock'](tid);
|
||||||
|
if (isDelete) {
|
||||||
plugins.fireHook(isDelete ? 'action:topic.delete' : 'action:topic.restore', tid);
|
plugins.fireHook('action:topic.delete', tid);
|
||||||
|
} else {
|
||||||
|
plugins.fireHook('action:topic.restore', topicData);
|
||||||
|
}
|
||||||
|
|
||||||
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);
|
events[isDelete ? 'logTopicDelete' : 'logTopicRestore'](uid, tid);
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ module.exports = function(Topics) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
plugins.fireHook('action:topic.save', tid);
|
plugins.fireHook('action:topic.save', topicData);
|
||||||
callback(null, tid);
|
callback(null, tid);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user