From a4c7f3affdd05bd994223d7d10bd3d45edcbc08e Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 4 May 2025 10:19:48 -0400 Subject: [PATCH] when replying to a note, auto-fill mentions based on the backend data instead of parsing the OP text --- packages/frontend/src/components/MkPostForm.vue | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 5f4e40d513..59c23b090e 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -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;