From 1cc77343baf0c760f99cea945d4f6a0918e6262b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 11 Mar 2026 13:22:15 -0400 Subject: [PATCH] refactor: get rid of helper function --- public/src/client/topic/postTools.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 0e2fcce5d8..7160a1ed51 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -324,22 +324,17 @@ define('forum/topic/postTools', [ const username = getUserSlug(button); const toPid = getData(button, 'data-pid'); - function quote(text) { - hooks.fire('action:composer.addQuote', { - tid: tid, - pid: toPid, - username: username, - title: ajaxify.data.titleRaw, - text: text, - }); - } + const body = selectedNode.text && toPid && toPid === selectedNode.pid ? + selectedNode.text : + (await api.get(`/posts/${encodeURIComponent(toPid)}/raw`)).content; - if (selectedNode.text && toPid && toPid === selectedNode.pid) { - return quote(selectedNode.text); - } - - const { content } = await api.get(`/posts/${encodeURIComponent(toPid)}/raw`); - quote(content); + hooks.fire('action:composer.addQuote', { + tid: tid, + pid: toPid, + username: username, + title: ajaxify.data.titleRaw, + body: body, + }); }); }