From 4dc4ac2f0c7bcc4f6c2dfed65c69b28ce6ca23fd 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 1c674729cb..9bf6c7cb1e 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 99f7efbe1c..f7f03e84a3 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 0bb6cc1f5c..9d5c0a58d5 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));