From a8e642ade2a6aeb43649af9de2c01a3479f8b165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 21 Apr 2022 12:23:37 -0400 Subject: [PATCH] refactor: skip content length check if submitting from post-queue --- src/topics/create.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/topics/create.js b/src/topics/create.js index 0fe4e399e6..a6d63d53dd 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -88,7 +88,9 @@ module.exports = function (Topics) { Topics.checkTitle(data.title); await Topics.validateTags(data.tags, data.cid, uid); data.tags = await Topics.filterTags(data.tags, data.cid); - Topics.checkContent(data.content); + if (!data.fromQueue) { + Topics.checkContent(data.content); + } const [categoryExists, canCreate, canTag] = await Promise.all([ categories.exists(data.cid), @@ -165,13 +167,13 @@ module.exports = function (Topics) { data.cid = topicData.cid; await guestHandleValid(data); - if (!data.fromQueue) { - await user.isReadyToPost(uid, data.cid); - } if (data.content) { data.content = utils.rtrim(data.content); } - Topics.checkContent(data.content); + if (!data.fromQueue) { + await user.isReadyToPost(uid, data.cid); + Topics.checkContent(data.content); + } // For replies to scheduled topics, don't have a timestamp older than topic's itself if (topicData.scheduled) {