From 0349169879105c625f43a8ae28b3191402176007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 17 Feb 2023 11:41:35 -0500 Subject: [PATCH] fix: #11306, show proper error if queued post doesn't exist was showing no-privileges if someone else accepted the post --- src/posts/queue.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/posts/queue.js b/src/posts/queue.js index 0b334742b1..24cc3a311c 100644 --- a/src/posts/queue.js +++ b/src/posts/queue.js @@ -303,14 +303,17 @@ module.exports = function (Posts) { } Posts.editQueuedContent = async function (uid, editData) { - const canEditQueue = await Posts.canEditQueue(uid, editData, 'edit'); + const [canEditQueue, data] = await Promise.all([ + Posts.canEditQueue(uid, editData, 'edit'), + getParsedObject(editData.id), + ]); + if (!data) { + throw new Error('[[error:no-post]]'); + } if (!canEditQueue) { throw new Error('[[error:no-privileges]]'); } - const data = await getParsedObject(editData.id); - if (!data) { - return; - } + if (editData.content !== undefined) { data.data.content = editData.content; }