From 76fde8efd71d066cdb4f6f73555a361ae77dda54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 10 Aug 2023 14:06:00 -0400 Subject: [PATCH] feat: #11897, show guest handles in post queue and after using POST /compose --- src/controllers/composer.js | 1 + src/posts/queue.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/controllers/composer.js b/src/controllers/composer.js index 9475fbdba5..bc1e4283c3 100644 --- a/src/controllers/composer.js +++ b/src/controllers/composer.js @@ -46,6 +46,7 @@ exports.post = async function (req, res) { req: req, timestamp: Date.now(), content: body.content, + handle: body.handle, fromQueue: false, }; req.body.noscript = 'true'; diff --git a/src/posts/queue.js b/src/posts/queue.js index 7cfdb462d8..2c485fb11e 100644 --- a/src/posts/queue.js +++ b/src/posts/queue.js @@ -38,6 +38,11 @@ module.exports = function (Posts) { postData.forEach((postData, index) => { if (postData) { postData.user = userData[index]; + if (postData.user.uid === 0 && postData.data.handle) { + postData.user.username = validator.escape(String(postData.data.handle)); + postData.user.displayname = postData.user.username; + postData.user.fullname = postData.user.username; + } postData.data.rawContent = validator.escape(String(postData.data.content)); postData.data.title = validator.escape(String(postData.data.title || '')); }