From 38d4a7fd56fe8fb9b027e16f27e907c865a9c754 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Tue, 20 May 2025 21:21:42 -0400 Subject: don't recursively render note previews --- packages/frontend/src/utility/get-self-note-ids.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/frontend/src/utility/get-self-note-ids.ts (limited to 'packages/frontend/src/utility') diff --git a/packages/frontend/src/utility/get-self-note-ids.ts b/packages/frontend/src/utility/get-self-note-ids.ts new file mode 100644 index 0000000000..b847615a06 --- /dev/null +++ b/packages/frontend/src/utility/get-self-note-ids.ts @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import type * as Misskey from 'misskey-js'; + +/** + * Gets IDs of notes that are visibly the "same" as the current note. + * These are IDs that should not be recursively resolved when starting from the provided note as entry. + */ +export function getSelfNoteIds(note: Misskey.entities.Note): string[] { + const ids = [note.id]; // Regular note + if (note.renote) ids.push(note.renote.id); // Renote or quote + if (note.renote?.renote) ids.push(note.renote.renote.id); // Renote *of* a quote + return ids; +} -- cgit v1.2.3-freya