summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-20 21:21:42 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-20 21:21:42 -0400
commit38d4a7fd56fe8fb9b027e16f27e907c865a9c754 (patch)
treeb93774d2a14b4aec864348030fc94d95b03bd094 /packages/frontend/src/utility
parentmerge: Fix "fetch linked note" button for AP previews (!1037) (diff)
downloadsharkey-38d4a7fd56fe8fb9b027e16f27e907c865a9c754.tar.gz
sharkey-38d4a7fd56fe8fb9b027e16f27e907c865a9c754.tar.bz2
sharkey-38d4a7fd56fe8fb9b027e16f27e907c865a9c754.zip
don't recursively render note previews
Diffstat (limited to 'packages/frontend/src/utility')
-rw-r--r--packages/frontend/src/utility/get-self-note-ids.ts17
1 files changed, 17 insertions, 0 deletions
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;
+}