From a41b18b331c81adb392f5dd90ebc5e993f76981c Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 16 Dec 2022 00:50:38 +0800 Subject: [PATCH] Fix auto-prepending mentions when replying Prepend not just the reply-to status's acct, but also all mentions' acct BUT excluding self --- src/components/compose.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/compose.jsx b/src/components/compose.jsx index b926a98a..0f4efcc2 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -89,10 +89,15 @@ function Compose({ spoilerTextRef.current.value = spoilerText; spoilerTextRef.current.focus(); } else { + const mentions = new Set([ + replyToStatus.account.acct, + ...replyToStatus.mentions.map((m) => m.acct), + ]); + textareaRef.current.value = `${[...mentions] + .filter((m) => m !== currentAccountInfo.acct) // Excluding self + .map((m) => `@${m}`) + .join(' ')} `; textareaRef.current.focus(); - if (replyToStatus.account.id !== currentAccount) { - textareaRef.current.value = `@${replyToStatus.account.acct} `; - } } setVisibility(visibility); setSensitive(sensitive);