Files
Desktop/ts/util/viewOnceEligibility.std.ts
2026-03-30 12:42:37 -07:00

17 lines
502 B
TypeScript

// Copyright 2026 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { AttachmentDraftType } from '../types/Attachment.std.ts';
import { isImageAttachment, isVideoAttachment } from './Attachment.std.ts';
export function isViewOnceEligible(
attachments: ReadonlyArray<AttachmentDraftType>,
hasQuote: boolean
): boolean {
return Boolean(
attachments.length === 1 &&
(isImageAttachment(attachments[0]) || isVideoAttachment(attachments[0])) &&
!hasQuote
);
}