From 058602352ca05d5a89f2b7abfd2ae99b52c5a689 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 8 May 2018 07:03:06 +0900 Subject: [PATCH] Fix #1574 --- src/remote/activitypub/models/note.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index a1967043f0..91e700ef6f 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -43,27 +43,21 @@ function parse(html: string): string { break; case 'a': - const cls = node.attrs - ? (node.attrs.find(x => x.name == 'class') || { value: '' }).value.split(' ') - : []; + const txt = getText(node); - // for Mastodon - if (cls.includes('mention')) { - const mention = getText(node); - - const part = mention.split('@'); + // メンション + if (txt.startsWith('@')) { + const part = txt.split('@'); if (part.length == 2) { //#region ホスト名部分が省略されているので復元する - const href = new URL(node.attrs.find(x => x.name == 'href').value); - const acct = mention + '@' + href.hostname; + const acct = txt + '@' + href.hostname; text += acct; break; - //#endregion } else if (part.length == 3) { - text += mention; + text += txt; break; } }