mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-28 21:28:19 +01:00
add isPureRenotePacked
This commit is contained in:
parent
41536480ce
commit
2fb2e52312
1 changed files with 12 additions and 0 deletions
|
@ -69,6 +69,14 @@ type PackedQuote =
|
|||
fileIds: NonNullable<Packed<'Note'>['fileIds']>
|
||||
});
|
||||
|
||||
type PurePackedRenote = PackedRenote & {
|
||||
text: NonNullable<Packed<'Note'>['text']>;
|
||||
cw: NonNullable<Packed<'Note'>['cw']>;
|
||||
replyId: NonNullable<Packed<'Note'>['replyId']>;
|
||||
poll: NonNullable<Packed<'Note'>['poll']>;
|
||||
fileIds: NonNullable<Packed<'Note'>['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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue