Backup support for quotes & quoted attachments
This commit is contained in:
parent
0f2b71b4a6
commit
e0dc4c412d
10 changed files with 653 additions and 289 deletions
|
@ -6,6 +6,7 @@ import type { ConversationModel } from '../models/conversations';
|
|||
import type {
|
||||
CustomError,
|
||||
MessageAttributesType,
|
||||
QuotedAttachmentType,
|
||||
QuotedMessageType,
|
||||
} from '../model-types.d';
|
||||
import type { ServiceIdString } from '../types/ServiceId';
|
||||
|
@ -136,6 +137,31 @@ export function isQuoteAMatch(
|
|||
);
|
||||
}
|
||||
|
||||
export const shouldTryToCopyFromQuotedMessage = ({
|
||||
referencedMessageNotFound,
|
||||
quoteAttachment,
|
||||
}: {
|
||||
referencedMessageNotFound: boolean;
|
||||
quoteAttachment: QuotedAttachmentType | undefined;
|
||||
}): boolean => {
|
||||
// If we've tried and can't find the message, try again.
|
||||
if (referencedMessageNotFound === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, try again in case we have not yet copied over the thumbnail from the
|
||||
// original attachment (maybe it had not been downloaded when we first checked)
|
||||
if (!quoteAttachment?.thumbnail) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (quoteAttachment.thumbnail.copied === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export function getAuthorId(
|
||||
message: Pick<MessageAttributesType, 'type' | 'source' | 'sourceServiceId'>
|
||||
): string | undefined {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue