From 1dc27a6144ac06f40f8ef9536f8ab0f1df12d845 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 8 Jul 2022 16:09:46 -0700 Subject: [PATCH] enqueueMessageForSend: Capture storage service change on unarchive --- ts/models/conversations.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index b1442bef513..41d68f3dc12 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -4008,9 +4008,11 @@ export class ConversationModel extends window.Backbone const { clearUnreadMetrics } = window.reduxActions.conversations; clearUnreadMetrics(this.id); - const enableProfileSharing = Boolean( + const enabledProfileSharing = Boolean( mandatoryProfileSharingEnabled && !this.get('profileSharing') ); + const unarchivedConversation = Boolean(this.get('isArchived')); + this.doAddSingleMessage(model, { isJustSent: true }); const draftProperties = dontClearDraft @@ -4024,15 +4026,18 @@ export class ConversationModel extends window.Backbone this.set({ ...draftProperties, - ...(enableProfileSharing ? { profileSharing: true } : {}), + ...(enabledProfileSharing ? { profileSharing: true } : {}), ...this.incrementSentMessageCount({ dry: true }), active_at: now, timestamp: now, - isArchived: false, + ...(unarchivedConversation ? { isArchived: false } : {}), }); - if (enableProfileSharing) { - this.captureChange('mandatoryProfileSharing'); + if (enabledProfileSharing) { + this.captureChange('enqueueMessageForSend/mandatoryProfileSharing'); + } + if (unarchivedConversation) { + this.captureChange('enqueueMessageForSend/unarchive'); } extraReduxActions?.();