2022-12-08 07:43:48 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import type { AttachmentDraftType } from '../types/Attachment';
|
|
|
|
|
|
|
|
export function hasDraftAttachments(
|
2022-12-14 19:05:32 +00:00
|
|
|
draftAttachments: ReadonlyArray<AttachmentDraftType> | undefined,
|
2022-12-08 07:43:48 +00:00
|
|
|
options: { includePending: boolean }
|
|
|
|
): boolean {
|
|
|
|
if (!draftAttachments) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.includePending) {
|
|
|
|
return draftAttachments.length > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return draftAttachments.some(item => !item.pending);
|
|
|
|
}
|