summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/misc
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2020-04-03 22:51:38 +0900
committerGitHub <noreply@github.com>2020-04-03 22:51:38 +0900
commit99fc77b6787bf16e772d46493067de75ea219bb7 (patch)
tree25c4ce00f3b827805f4fa36efc529abcc7735a47 /src/remote/activitypub/misc
parentAPIリファレンスのカテゴリ処理の修正 (#6218) (diff)
downloadsharkey-99fc77b6787bf16e772d46493067de75ea219bb7.tar.gz
sharkey-99fc77b6787bf16e772d46493067de75ea219bb7.tar.bz2
sharkey-99fc77b6787bf16e772d46493067de75ea219bb7.zip
APメンションはaudienceじゃなくてtagを参照するなど (#6128)
* APメンションはaudienceじゃなくてtagを参照するなど * AP/tag/Mentionではurlじゃなくてuriを提示する * createPersonでaliasが入力された場合に対応 * AP HTMLパースでMention/Hashtag判定にtagを使うように * fix * indent * use hashtag name * fix * URLエンコード不要だったら<>を使わないの条件が消えたたのを修正
Diffstat (limited to 'src/remote/activitypub/misc')
-rw-r--r--src/remote/activitypub/misc/html-to-mfm.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/remote/activitypub/misc/html-to-mfm.ts b/src/remote/activitypub/misc/html-to-mfm.ts
new file mode 100644
index 0000000000..5d3cf0b774
--- /dev/null
+++ b/src/remote/activitypub/misc/html-to-mfm.ts
@@ -0,0 +1,9 @@
+import { IObject } from '../type';
+import { extractApHashtagObjects } from '../models/tag';
+import { fromHtml } from '../../../mfm/fromHtml';
+
+export function htmlToMfm(html: string, tag?: IObject | IObject[]) {
+ const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null);
+
+ return fromHtml(html, hashtagNames);
+}