From 2fe704bb7129e0e7107cdad83ff3555510452901 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 27 Sep 2019 05:18:09 +0900 Subject: [PATCH] Decrease tag limit --- src/remote/activitypub/models/person.ts | 4 ++-- src/server/api/endpoints/i/update.ts | 2 +- src/services/note/create.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 1c674729c..9bf6c7cb1 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -134,7 +134,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise tag.toLowerCase()).splice(0, 100); + const tags = extractHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32); const isBot = object.type == 'Service'; @@ -307,7 +307,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint const { fields, services } = analyzeAttachments(person.attachment || []); - const tags = extractHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 100); + const tags = extractHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32); const updates = { lastFetchedAt: new Date(), diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 99f7efbe1..f7f03e84a 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -257,7 +257,7 @@ export default define(meta, async (ps, user, app) => { if (newDescription != null) { const tokens = parse(newDescription); emojis = emojis.concat(extractEmojis(tokens!)); - tags = extractHashtags(tokens!).map(tag => tag.toLowerCase()).splice(0, 100); + tags = extractHashtags(tokens!).map(tag => tag.toLowerCase()).splice(0, 32); } updates.emojis = emojis; diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 0bb6cc1f5..9d5c0a58d 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -165,7 +165,7 @@ export default async (user: User, data: Option, silent = false) => new Promise Array.from(tag || '').length <= 128).splice(0, 100); + tags = tags.filter(tag => Array.from(tag || '').length <= 128).splice(0, 32); if (data.reply && (user.id !== data.reply.userId) && !mentionedUsers.some(u => u.id === data.reply!.userId)) { mentionedUsers.push(await Users.findOne(data.reply.userId).then(ensure));