Move receipt queues into conversation queue to handle 428s

This commit is contained in:
Jamie Kyle
2023-02-06 09:24:34 -08:00
committed by GitHub
parent 3776a04c0b
commit 2bbcc4676e
20 changed files with 981 additions and 223 deletions

View File

@@ -55,11 +55,15 @@ import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
import { useBoundActions } from '../../hooks/useBoundActions';
import { verifyStoryListMembers as doVerifyStoryListMembers } from '../../util/verifyStoryListMembers';
import { viewSyncJobQueue } from '../../jobs/viewSyncJobQueue';
import { viewedReceiptsJobQueue } from '../../jobs/viewedReceiptsJobQueue';
import { getOwn } from '../../util/getOwn';
import { SHOW_TOAST } from './toast';
import { ToastType } from '../../types/Toast';
import type { ShowToastActionType } from './toast';
import {
conversationJobQueue,
conversationQueueJobEnum,
} from '../../jobs/conversationJobQueue';
import { ReceiptType } from '../../types/Receipt';
export type StoryDataType = ReadonlyDeep<
{
@@ -399,8 +403,11 @@ function markStoryRead(
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
const conversationId = message.get('conversationId');
const viewedReceipt = {
messageId,
conversationId,
senderE164: message.attributes.source,
senderUuid: message.attributes.sourceUuid,
timestamp: message.attributes.sent_at,
@@ -413,7 +420,14 @@ function markStoryRead(
}
if (window.Events.getStoryViewReceiptsEnabled()) {
drop(viewedReceiptsJobQueue.add({ viewedReceipt }));
drop(
conversationJobQueue.add({
type: conversationQueueJobEnum.enum.Receipts,
conversationId,
receiptsType: ReceiptType.Viewed,
receipts: [viewedReceipt],
})
);
}
await dataInterface.addNewStoryRead({