Fix one-char space inserted when replying to own posts

This commit is contained in:
Lim Chee Aun 2022-12-17 17:25:04 +08:00
parent d0579a57d6
commit 1c18184ef4

View file

@ -93,11 +93,15 @@ function Compose({
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.dispatchEvent(new Event('input'));
const allMentions = [...mentions].filter(
(m) => m !== currentAccountInfo.acct,
);
if (allMentions.length > 0) {
textareaRef.current.value = `${allMentions
.map((m) => `@${m}`)
.join(' ')} `;
textareaRef.current.dispatchEvent(new Event('input'));
}
textareaRef.current.focus();
}
setVisibility(visibility);