From 1e2045bf339b2781bc5007a7674ad5c8cc17f512 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 3 Nov 2023 13:48:40 +0100 Subject: [PATCH] [backend] Correctly handle tags on edit --- packages/backend/src/services/note/edit.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/services/note/edit.ts b/packages/backend/src/services/note/edit.ts index 1cf02496f..b72a9f9d3 100644 --- a/packages/backend/src/services/note/edit.ts +++ b/packages/backend/src/services/note/edit.ts @@ -23,6 +23,7 @@ import type { IPoll } from "@/models/entities/poll.js"; import { deliverToRelays } from "../relay.js"; import renderUpdate from "@/remote/activitypub/renderer/update.js"; import { extractMentionedUsers, index } from "@/services/note/create.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; type Option = { text?: string | null; @@ -49,7 +50,11 @@ export default async function ( .parse(data.text || "") .concat(mfm.parse(data.cw || "")); - const tags: string[] = extractHashtags(tokens); + const tags: string[] = extractHashtags(tokens) + .filter((tag) => Array.from(tag || "").length <= 128) + .splice(0, 32) + .map(normalizeForSearch); + const emojis = extractCustomEmojisFromMfm(tokens); const mentionUsers = (await extractMentionedUsers(user, tokens));