Do not confirm messages until we have handled them

This commit is contained in:
Josh Perez
2023-08-21 16:08:27 -04:00
committed by GitHub
parent 29aa188c0f
commit 04f716986c
16 changed files with 990 additions and 960 deletions

View File

@@ -1675,6 +1675,7 @@ export default class MessageReceiver
getEnvelopeId(envelope),
new DeliveryEvent(
{
envelopeId: envelope.id,
timestamp: envelope.timestamp,
envelopeTimestamp: envelope.timestamp,
source: envelope.source,
@@ -2857,6 +2858,7 @@ export default class MessageReceiver
receiptMessage.timestamp.map(async rawTimestamp => {
const ev = new EventClass(
{
envelopeId: envelope.id,
timestamp: rawTimestamp?.toNumber(),
envelopeTimestamp: envelope.timestamp,
source: envelope.source,
@@ -3255,6 +3257,7 @@ export default class MessageReceiver
const ev = new MessageRequestResponseEvent(
{
envelopeId: envelope.id,
threadE164: dropNull(sync.threadE164),
threadAci: sync.threadAci
? normalizeAci(
@@ -3393,6 +3396,7 @@ export default class MessageReceiver
for (const { timestamp, sender, senderAci } of read) {
const ev = new ReadSyncEvent(
{
envelopeId: envelope.id,
envelopeTimestamp: envelope.timestamp,
timestamp: timestamp?.toNumber(),
sender: dropNull(sender),
@@ -3420,6 +3424,7 @@ export default class MessageReceiver
viewed.map(async ({ timestamp, senderE164, senderAci }) => {
const ev = new ViewSyncEvent(
{
envelopeId: envelope.id,
envelopeTimestamp: envelope.timestamp,
timestamp: timestamp?.toNumber(),
senderE164: dropNull(senderE164),

View File

@@ -110,6 +110,7 @@ export class ConfirmableEvent extends Event {
}
export type DeliveryEventData = Readonly<{
envelopeId: string;
timestamp: number;
envelopeTimestamp: number;
source?: string;
@@ -240,6 +241,7 @@ export class MessageEvent extends ConfirmableEvent {
}
export type ReadOrViewEventData = Readonly<{
envelopeId: string;
timestamp: number;
envelopeTimestamp: number;
source?: string;
@@ -301,6 +303,7 @@ export class ViewOnceOpenSyncEvent extends ConfirmableEvent {
}
export type MessageRequestResponseOptions = {
envelopeId: string;
threadE164?: string;
threadAci?: AciString;
messageRequestResponseType: Proto.SyncMessage.IMessageRequestResponse['type'];
@@ -319,8 +322,11 @@ export class MessageRequestResponseEvent extends ConfirmableEvent {
public readonly groupV2Id?: string;
public readonly envelopeId?: string;
constructor(
{
envelopeId,
threadE164,
threadAci,
messageRequestResponseType,
@@ -331,6 +337,7 @@ export class MessageRequestResponseEvent extends ConfirmableEvent {
) {
super('messageRequestResponse', confirm);
this.envelopeId = envelopeId;
this.threadE164 = threadE164;
this.threadAci = threadAci;
this.messageRequestResponseType = messageRequestResponseType;
@@ -374,6 +381,7 @@ export class StickerPackEvent extends ConfirmableEvent {
}
export type ReadSyncEventData = Readonly<{
envelopeId: string;
timestamp?: number;
envelopeTimestamp: number;
sender?: string;
@@ -390,6 +398,7 @@ export class ReadSyncEvent extends ConfirmableEvent {
}
export type ViewSyncEventData = Readonly<{
envelopeId: string;
timestamp?: number;
envelopeTimestamp: number;
senderE164?: string;