From 702875a78e5d1f11dddd68ccc15ed961f1820e3f Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 7 Dec 2018 21:01:43 +0900 Subject: [PATCH] Apply tag length limit from AP (#3536) --- src/services/note/create.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 6fe64d3ee..6043a537d 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -161,6 +161,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< const combinedTokens = tokens.concat(cwTokens); tags = data.apHashtags || extractHashtags(combinedTokens); + tags = tags.filter(tag => tag.length <= 100); emojis = data.apEmojis || extractEmojis(combinedTokens); @@ -467,9 +468,7 @@ function extractHashtags(tokens: ReturnType): string[] { const extract = (tokens: Node[]) => { tokens.filter(x => x.name === 'hashtag').forEach(x => { - if (x.props.hashtag.length <= 100) { - hashtags.push(x.props.hashtag); - } + hashtags.push(x.props.hashtag); }); tokens.filter(x => x.children).forEach(x => { extract(x.children);