diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-05-08 07:03:06 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-05-08 07:03:06 +0900 |
| commit | 058602352ca05d5a89f2b7abfd2ae99b52c5a689 (patch) | |
| tree | 5e58302267c01c8845b71df18da9a5b7b108efa1 /src/remote/activitypub/models | |
| parent | Update setup.ja.md (diff) | |
| download | sharkey-058602352ca05d5a89f2b7abfd2ae99b52c5a689.tar.gz sharkey-058602352ca05d5a89f2b7abfd2ae99b52c5a689.tar.bz2 sharkey-058602352ca05d5a89f2b7abfd2ae99b52c5a689.zip | |
Fix #1574
Diffstat (limited to 'src/remote/activitypub/models')
| -rw-r--r-- | src/remote/activitypub/models/note.ts | 18 |
1 files 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; } } |