Drop group messages that don't change group

This commit is contained in:
Josh Perez 2020-07-06 20:39:55 -04:00 committed by Scott Nonnenberg
parent 4289c28a38
commit ba6cb653bf
7 changed files with 158 additions and 117 deletions

View file

@ -20,8 +20,8 @@ import { IncomingIdentityKeyError } from './Errors';
import {
AttachmentPointerClass,
DataMessageClass,
DownloadAttachmentType,
EnvelopeClass,
ProtoBigNumberType,
ReceiptMessageClass,
SyncMessageClass,
TypingMessageClass,
@ -62,22 +62,6 @@ declare global {
}
}
type AttachmentType = {
cdnId?: string;
cdnKey?: string;
data: ArrayBuffer;
contentType?: string;
size?: number;
fileName?: string;
flags?: number;
width?: number;
height?: number;
caption?: string;
blurHash?: string;
uploadTimestamp?: ProtoBigNumberType;
cdnNumber?: number;
};
type CacheAddItemType = {
envelope: EnvelopeClass;
data: UnprocessedType;
@ -1591,7 +1575,9 @@ class MessageReceiverInner extends EventTarget {
digest: attachment.digest ? attachment.digest.toString('base64') : null,
};
}
async downloadAttachment(attachment: AttachmentPointerClass) {
async downloadAttachment(
attachment: AttachmentPointerClass
): Promise<DownloadAttachmentType> {
const encrypted = await this.server.getAttachment(
attachment.cdnId || attachment.cdnKey,
attachment.cdnNumber || 0
@ -1623,7 +1609,7 @@ class MessageReceiverInner extends EventTarget {
}
async handleAttachment(
attachment: AttachmentPointerClass
): Promise<AttachmentType> {
): Promise<DownloadAttachmentType> {
const cleaned = this.cleanAttachment(attachment);
return this.downloadAttachment(cleaned);
}
@ -1866,7 +1852,7 @@ export default class MessageReceiver {
close: () => Promise<void>;
downloadAttachment: (
attachment: AttachmentPointerClass
) => Promise<AttachmentType>;
) => Promise<DownloadAttachmentType>;
stopProcessing: () => Promise<void>;
unregisterBatchers: () => void;