refactor: get rid of helper function

This commit is contained in:
Barış Soner Uşaklı
2026-03-11 13:22:15 -04:00
parent 9fcaad380b
commit 1cc77343ba

View File

@@ -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,
});
});
}