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