Removes groupv1 protos

This commit is contained in:
Josh Perez 2023-07-26 13:49:27 -04:00 committed by GitHub
parent 6c70cd450b
commit 8aac997b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 21 additions and 373 deletions

View file

@ -72,7 +72,7 @@ import type { EventHandler } from './EventTarget';
import EventTarget from './EventTarget';
import { downloadAttachment } from './downloadAttachment';
import type { IncomingWebSocketRequest } from './WebsocketResources';
import { ContactBuffer, GroupBuffer } from './ContactsParser';
import { ContactBuffer } from './ContactsParser';
import type { WebAPIType } from './WebAPI';
import type { Storage } from './Storage';
import { WarnOnlyError } from './Errors';
@ -112,8 +112,6 @@ import {
ReadSyncEvent,
ViewSyncEvent,
ContactSyncEvent,
GroupEvent,
GroupSyncEvent,
StoryRecipientUpdateEvent,
CallEventSyncEvent,
} from './messageReceiverEvents';
@ -622,16 +620,6 @@ export default class MessageReceiver
handler: (ev: ContactSyncEvent) => void
): void;
public override addEventListener(
name: 'group',
handler: (ev: GroupEvent) => void
): void;
public override addEventListener(
name: 'groupSync',
handler: (ev: GroupSyncEvent) => void
): void;
public override addEventListener(
name: 'envelopeQueued',
handler: (ev: EnvelopeQueuedEvent) => void
@ -2998,10 +2986,6 @@ export default class MessageReceiver
// before moving on since it updates conversation state.
return this.handleContacts(envelope, syncMessage.contacts);
}
if (syncMessage.groups) {
void this.handleGroups(envelope, syncMessage.groups);
return;
}
if (syncMessage.blocked) {
return this.handleBlocked(envelope, syncMessage.blocked);
}
@ -3454,63 +3438,6 @@ export default class MessageReceiver
log.info('handleContacts: finished');
}
private async handleGroups(
envelope: ProcessedEnvelope,
groups: Proto.SyncMessage.IGroups
): Promise<void> {
const logId = getEnvelopeId(envelope);
log.info('group sync');
log.info(`MessageReceiver: handleGroups ${logId}`);
const { blob } = groups;
this.removeFromCache(envelope);
logUnexpectedUrgentValue(envelope, 'groupSync');
if (!blob) {
throw new Error('MessageReceiver.handleGroups: blob field was missing');
}
// Note: we do not return here because we don't want to block the next message on
// this attachment download and a lot of processing of that attachment.
const attachmentPointer = await this.handleAttachment(blob, {
disableRetries: true,
timeout: 90 * SECOND,
});
const groupBuffer = new GroupBuffer(attachmentPointer.data);
let groupDetails = groupBuffer.next();
const promises = [];
while (groupDetails) {
const { id } = groupDetails;
strictAssert(id, 'Group details without id');
if (id.byteLength !== 16) {
log.error(
`onGroupReceived: Id was ${id} bytes, expected 16 bytes. Dropping group.`
);
continue;
}
const ev = new GroupEvent(
{
...groupDetails,
id: Bytes.toBinary(id),
},
envelope.receivedAtCounter
);
const promise = this.dispatchAndWait(logId, ev).catch(e => {
log.error('error processing group', e);
});
groupDetails = groupBuffer.next();
promises.push(promise);
}
await Promise.all(promises);
const ev = new GroupSyncEvent();
return this.dispatchAndWait(logId, ev);
}
private async handleBlocked(
envelope: ProcessedEnvelope,
blocked: Proto.SyncMessage.IBlocked