From f44a7389e2b67e524c953843fcb4e007349c76c2 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki <nekomanma@pixiv.co.jp> Date: Thu, 5 Apr 2018 01:29:56 +0900 Subject: [PATCH] Implement Hashtag object --- src/remote/activitypub/create.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/remote/activitypub/create.ts b/src/remote/activitypub/create.ts index 710d56fd3..31e9dba86 100644 --- a/src/remote/activitypub/create.ts +++ b/src/remote/activitypub/create.ts @@ -55,9 +55,16 @@ class Creator { const { window } = new JSDOM(note.content); const mentions = []; + const tags = []; - for (const { href, type } of note.tags) { + for (const { href, name, type } of note.tags) { switch (type) { + case 'Hashtag': + if (name.startsWith('#')) { + tags.push(name.slice(1)); + } + break; + case 'Mention': mentions.push(resolvePerson(resolver, href)); break; @@ -78,7 +85,8 @@ class Creator { appId: null, viaMobile: false, geo: undefined, - uri: note.id + uri: note.id, + tags }, null, null, await Promise.all(mentions)); const promises = [];