From ed96e603ab31cc328e3cc399031d250f38fe36ff Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Thu, 16 Dec 2021 11:45:56 -0600 Subject: [PATCH] Wait for `ConversationController` load in receipt and sync jobs --- ts/jobs/helpers/readAndViewSyncHelpers.ts | 2 ++ ts/util/lint/exceptions.json | 28 +++++++++++++++++++++++ ts/util/sendReceipts.ts | 2 ++ 3 files changed, 32 insertions(+) diff --git a/ts/jobs/helpers/readAndViewSyncHelpers.ts b/ts/jobs/helpers/readAndViewSyncHelpers.ts index 82a7cacdea..323d9c64b1 100644 --- a/ts/jobs/helpers/readAndViewSyncHelpers.ts +++ b/ts/jobs/helpers/readAndViewSyncHelpers.ts @@ -102,6 +102,8 @@ export async function runReadOrViewSyncJob({ return; } + await window.ConversationController.load(); + const ourConversation = window.ConversationController.getOurConversationOrThrow(); const sendOptions = await getSendOptions(ourConversation.attributes, { diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 1dcba83ff5..e786769b25 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -7851,6 +7851,20 @@ "reasonCategory": "usageTrusted", "updated": "2021-10-22T00:52:39.251Z" }, + { + "rule": "jQuery-load(", + "path": "ts/jobs/helpers/readAndViewSyncHelpers.js", + "line": " await window.ConversationController.load();", + "reasonCategory": "falseMatch", + "updated": "2021-12-15T19:58:28.089Z" + }, + { + "rule": "jQuery-load(", + "path": "ts/jobs/helpers/readAndViewSyncHelpers.ts", + "line": " await window.ConversationController.load();", + "reasonCategory": "falseMatch", + "updated": "2021-12-15T19:58:28.089Z" + }, { "rule": "jQuery-load(", "path": "ts/jobs/normalMessageSendJobQueue.js", @@ -8152,6 +8166,20 @@ "updated": "2021-08-18T18:22:55.307Z", "reasonDetail": "Legacy code" }, + { + "rule": "jQuery-load(", + "path": "ts/util/sendReceipts.js", + "line": " await window.ConversationController.load();", + "reasonCategory": "falseMatch", + "updated": "2021-12-15T19:58:28.089Z" + }, + { + "rule": "jQuery-load(", + "path": "ts/util/sendReceipts.ts", + "line": " await window.ConversationController.load();", + "reasonCategory": "falseMatch", + "updated": "2021-12-15T19:58:28.089Z" + }, { "rule": "jQuery-$(", "path": "ts/util/setupI18n.js", diff --git a/ts/util/sendReceipts.ts b/ts/util/sendReceipts.ts index 712a3d722b..73d33ba1e7 100644 --- a/ts/util/sendReceipts.ts +++ b/ts/util/sendReceipts.ts @@ -79,6 +79,8 @@ export async function sendReceipts({ new Map() ); + await window.ConversationController.load(); + await Promise.all( map(receiptsBySenderId, async ([senderId, receiptsForSender]) => { const sender = window.ConversationController.get(senderId);