mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #1936
This commit is contained in:
@@ -54,33 +54,44 @@ var winston = require('winston'),
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
options.tags = options.tags || [];
|
||||
if (isMainPost) {
|
||||
title = title.trim();
|
||||
|
||||
var topicData = {
|
||||
title: title,
|
||||
slug: tid + '/' + utils.slugify(title)
|
||||
};
|
||||
if (options.topic_thumb) {
|
||||
topicData.thumb = options.topic_thumb;
|
||||
}
|
||||
|
||||
db.setObject('topic:' + tid, topicData, function(err) {
|
||||
plugins.fireHook('action:topic.edit', tid);
|
||||
if (!isMainPost) {
|
||||
return next(null, {
|
||||
tid: tid,
|
||||
isMainPost: false
|
||||
});
|
||||
|
||||
topics.updateTags(tid, options.tags);
|
||||
}
|
||||
|
||||
next(null, {
|
||||
tid: tid,
|
||||
title: validator.escape(title),
|
||||
isMainPost: isMainPost,
|
||||
tags: options.tags.map(function(tag) { return {name:tag}; })
|
||||
title = title.trim();
|
||||
|
||||
var topicData = {
|
||||
title: title,
|
||||
slug: tid + '/' + utils.slugify(title)
|
||||
};
|
||||
if (options.topic_thumb) {
|
||||
topicData.thumb = options.topic_thumb;
|
||||
}
|
||||
|
||||
db.setObject('topic:' + tid, topicData, function(err) {
|
||||
plugins.fireHook('action:topic.edit', tid);
|
||||
});
|
||||
|
||||
topics.updateTags(tid, options.tags, function(err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
topics.getTopicTagsObjects(tid, function(err, tags) {
|
||||
next(err, {
|
||||
tid: tid,
|
||||
title: validator.escape(title),
|
||||
isMainPost: isMainPost,
|
||||
tags: tags
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
content: function(next) {
|
||||
PostTools.parse(postData.content, next);
|
||||
|
||||
Reference in New Issue
Block a user