when replying to a note, auto-fill mentions based on the backend data instead of parsing the OP text

This commit is contained in:
Hazelnoot 2025-05-04 10:19:48 -04:00
parent 6c9dcb84ab
commit a4c7f3affd

View file

@ -316,20 +316,8 @@ if (props.reply && (props.reply.user.username !== $i.username || (props.reply.us
text.value = `@${props.reply.user.username}${props.reply.user.host != null ? '@' + toASCII(props.reply.user.host) : ''} `;
}
if (props.reply && props.reply.text != null) {
const ast = mfm.parse(props.reply.text);
const otherHost = props.reply.user.host;
for (const x of extractMentions(ast)) {
const mention = x.host ?
`@${x.username}@${toASCII(x.host)}` :
(otherHost == null || otherHost === host) ?
`@${x.username}` :
`@${x.username}@${toASCII(otherHost)}`;
//
if ($i.username === x.username && (x.host == null || x.host === host)) continue;
if (props.reply && props.reply.mentionHandles) {
for (const mention of Object.values(props.reply.mentionHandles)) {
//
if (text.value.includes(`${mention} `)) continue;