|
|
|
@ -76,7 +76,7 @@ module.exports = function (Topics) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Topics.post = async function (data) {
|
|
|
|
|
const { uid } = data;
|
|
|
|
|
let { uid } = data;
|
|
|
|
|
data.title = String(data.title).trim();
|
|
|
|
|
data.tags = data.tags || [];
|
|
|
|
|
if (data.content) {
|
|
|
|
@ -105,8 +105,9 @@ module.exports = function (Topics) {
|
|
|
|
|
if (!data.fromQueue) {
|
|
|
|
|
await user.isReadyToPost(data.uid, data.cid);
|
|
|
|
|
}
|
|
|
|
|
const filteredData = await plugins.hooks.fire('filter:topic.post', data);
|
|
|
|
|
data = filteredData;
|
|
|
|
|
|
|
|
|
|
data = await plugins.hooks.fire('filter:topic.post', data);
|
|
|
|
|
({ uid } = data); // uid was explicitly destructured at top, so update if changed
|
|
|
|
|
const tid = await Topics.create(data);
|
|
|
|
|
|
|
|
|
|
let postData = data;
|
|
|
|
@ -152,6 +153,7 @@ module.exports = function (Topics) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Topics.reply = async function (data) {
|
|
|
|
|
data = await plugins.hooks.fire('filter:topic.reply', data);
|
|
|
|
|
const { tid } = data;
|
|
|
|
|
const { uid } = data;
|
|
|
|
|
|
|
|
|
@ -165,7 +167,6 @@ module.exports = function (Topics) {
|
|
|
|
|
if (!data.fromQueue) {
|
|
|
|
|
await user.isReadyToPost(uid, data.cid);
|
|
|
|
|
}
|
|
|
|
|
await plugins.hooks.fire('filter:topic.reply', data);
|
|
|
|
|
if (data.content) {
|
|
|
|
|
data.content = utils.rtrim(data.content);
|
|
|
|
|
}
|
|
|
|
|