Skip to content

Node.js based forum software built for the modern web

feat: #11897, show guest handles in post queue and after using POST /compose

Barış Soner Uşaklı76fde8efd71d
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 || ''));
}