From 3e73b30a9d4da868748dbf13f6d23688f9918d5f Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Tue, 4 Oct 2022 11:42:42 -0700 Subject: [PATCH] Dont forward group story replies into conversation --- ts/models/conversations.ts | 83 ++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index e8ddc38bf..f50742831 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -4027,53 +4027,56 @@ export class ConversationModel extends window.Backbone const renderStart = Date.now(); - // Perform asynchronous tasks before entering the batching mode - await this.beforeAddSingleMessage(); + // Don't update the conversation with a story reply + if (storyId == null) { + // Perform asynchronous tasks before entering the batching mode + await this.beforeAddSingleMessage(); - this.isInReduxBatch = true; - batchDispatch(() => { - try { - const { clearUnreadMetrics } = window.reduxActions.conversations; - clearUnreadMetrics(this.id); + this.isInReduxBatch = true; + batchDispatch(() => { + try { + const { clearUnreadMetrics } = window.reduxActions.conversations; + clearUnreadMetrics(this.id); - const enabledProfileSharing = Boolean( - mandatoryProfileSharingEnabled && !this.get('profileSharing') - ); - const unarchivedConversation = Boolean(this.get('isArchived')); + const enabledProfileSharing = Boolean( + mandatoryProfileSharingEnabled && !this.get('profileSharing') + ); + const unarchivedConversation = Boolean(this.get('isArchived')); - this.doAddSingleMessage(model, { isJustSent: true }); + this.doAddSingleMessage(model, { isJustSent: true }); - const draftProperties = dontClearDraft - ? {} - : { - draft: null, - draftTimestamp: null, - lastMessage: model.getNotificationText(), - lastMessageAuthor: model.getAuthorText(), - lastMessageStatus: 'sending' as const, - }; + const draftProperties = dontClearDraft + ? {} + : { + draft: null, + draftTimestamp: null, + lastMessage: model.getNotificationText(), + lastMessageAuthor: model.getAuthorText(), + lastMessageStatus: 'sending' as const, + }; - this.set({ - ...draftProperties, - ...(enabledProfileSharing ? { profileSharing: true } : {}), - ...this.incrementSentMessageCount({ dry: true }), - active_at: now, - timestamp: now, - ...(unarchivedConversation ? { isArchived: false } : {}), - }); + this.set({ + ...draftProperties, + ...(enabledProfileSharing ? { profileSharing: true } : {}), + ...this.incrementSentMessageCount({ dry: true }), + active_at: now, + timestamp: now, + ...(unarchivedConversation ? { isArchived: false } : {}), + }); - if (enabledProfileSharing) { - this.captureChange('enqueueMessageForSend/mandatoryProfileSharing'); + if (enabledProfileSharing) { + this.captureChange('enqueueMessageForSend/mandatoryProfileSharing'); + } + if (unarchivedConversation) { + this.captureChange('enqueueMessageForSend/unarchive'); + } + + extraReduxActions?.(); + } finally { + this.isInReduxBatch = false; } - if (unarchivedConversation) { - this.captureChange('enqueueMessageForSend/unarchive'); - } - - extraReduxActions?.(); - } finally { - this.isInReduxBatch = false; - } - }); + }); + } if (sticker) { await addStickerPackReference(model.id, sticker.packId);