From 477bff68b906b03c9a8fda01647141afd9bce3a7 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Thu, 20 Dec 2018 02:20:56 +0900 Subject: [PATCH] Fix tag length limit from AP (#3688) --- src/services/note/create.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 75d9521bd..55d5eed14 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -163,14 +163,14 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< tags = data.apHashtags || extractHashtags(combinedTokens); - // MongoDBのインデックス対象は128文字以上にできない - tags = tags.filter(tag => tag.length <= 100); - emojis = data.apEmojis || extractEmojis(combinedTokens); mentionedUsers = data.apMentions || await extractMentionedUsers(user, combinedTokens); } + // MongoDBのインデックス対象は128文字以上にできない + tags = tags.filter(tag => tag.length <= 100); + if (data.reply && !user._id.equals(data.reply.userId) && !mentionedUsers.some(u => u._id.equals(data.reply.userId))) { mentionedUsers.push(await User.findOne({ _id: data.reply.userId })); }