|
|
|
@ -8,18 +8,20 @@ import * as IndexedDB from '../IndexedDB';
|
|
|
|
|
import { Message } from '../Message';
|
|
|
|
|
|
|
|
|
|
export const initializeAttachmentMetadata = async (
|
|
|
|
|
message: Message,
|
|
|
|
|
message: Message
|
|
|
|
|
): Promise<Message> => {
|
|
|
|
|
if (message.type === 'verified-change') {
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const hasAttachments = IndexedDB.toIndexableBoolean(message.attachments.length > 0);
|
|
|
|
|
const hasAttachments = IndexedDB.toIndexableBoolean(
|
|
|
|
|
message.attachments.length > 0
|
|
|
|
|
);
|
|
|
|
|
const [hasVisualMediaAttachments, hasFileAttachments] = partition(
|
|
|
|
|
message.attachments,
|
|
|
|
|
Attachment.isVisualMedia,
|
|
|
|
|
Attachment.isVisualMedia
|
|
|
|
|
)
|
|
|
|
|
.map((attachments) => attachments.length > 0)
|
|
|
|
|
.map(attachments => attachments.length > 0)
|
|
|
|
|
.map(IndexedDB.toIndexableBoolean);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|