New attachment storage system

This commit is contained in:
Fedor Indutny 2024-07-11 12:44:09 -07:00 committed by GitHub
parent 273e1ccb15
commit 28664a606f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
161 changed files with 2418 additions and 1562 deletions

View file

@ -18,6 +18,7 @@ import * as log from '../logging/log';
import { map, take, collect } from './iterables';
import { strictAssert } from './assert';
import { getMessageSentTimestamp } from './getMessageSentTimestamp';
import { getLocalAttachmentUrl } from './getLocalAttachmentUrl';
export async function makeQuote(
quotedMessage: MessageAttributesType
@ -58,8 +59,7 @@ export async function getQuoteAttachment(
preview?: Array<LinkPreviewType>,
sticker?: StickerType
): Promise<Array<QuotedAttachmentType>> {
const { getAbsoluteAttachmentPath, loadAttachmentData } =
window.Signal.Migrations;
const { loadAttachmentData } = window.Signal.Migrations;
if (attachments && attachments.length) {
const attachmentsToUse = Array.from(take(attachments, 1));
@ -84,7 +84,7 @@ export async function getQuoteAttachment(
? {
...(await loadAttachmentData(thumbnail)),
objectUrl: thumbnail.path
? getAbsoluteAttachmentPath(thumbnail.path)
? getLocalAttachmentUrl(thumbnail)
: undefined,
}
: undefined,
@ -107,7 +107,7 @@ export async function getQuoteAttachment(
? {
...(await loadAttachmentData(image)),
objectUrl: image.path
? getAbsoluteAttachmentPath(image.path)
? getLocalAttachmentUrl(image)
: undefined,
}
: undefined,
@ -124,7 +124,7 @@ export async function getQuoteAttachment(
contentType,
thumbnail: {
...(await loadAttachmentData(sticker.data)),
objectUrl: path ? getAbsoluteAttachmentPath(path) : undefined,
objectUrl: path ? getLocalAttachmentUrl(sticker.data) : undefined,
},
},
];