From 2fb2e523124119a13d045c95da98163b875a6f39 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Fri, 8 Nov 2024 09:55:26 -0500 Subject: [PATCH] add isPureRenotePacked --- packages/backend/src/misc/is-renote.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/backend/src/misc/is-renote.ts b/packages/backend/src/misc/is-renote.ts index c128fded14..f9209f05b3 100644 --- a/packages/backend/src/misc/is-renote.ts +++ b/packages/backend/src/misc/is-renote.ts @@ -69,6 +69,14 @@ type PackedQuote = fileIds: NonNullable['fileIds']> }); +type PurePackedRenote = PackedRenote & { + text: NonNullable['text']>; + cw: NonNullable['cw']>; + replyId: NonNullable['replyId']>; + poll: NonNullable['poll']>; + fileIds: NonNullable['fileIds']>; +} + export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote { return note.renoteId != null; } @@ -80,3 +88,7 @@ export function isQuotePacked(note: PackedRenote): note is PackedQuote { note.poll != null || (note.fileIds != null && note.fileIds.length > 0); } + +export function isPureRenotePacked(note: Packed<'Note'>): note is PurePackedRenote { + return isRenotePacked(note) && !isQuotePacked(note); +}