From 54a2eef700df6d27e753507a6b49639d2c750c16 Mon Sep 17 00:00:00 2001 From: Brice-W Date: Mon, 26 Jul 2021 15:11:20 +1000 Subject: [PATCH] change the way skipTimerInit is defined in MessageModel --- ts/interactions/conversationInteractions.ts | 2 +- ts/models/message.ts | 4 ++-- ts/models/messageType.ts | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ts/interactions/conversationInteractions.ts b/ts/interactions/conversationInteractions.ts index e9082230d..5b08d275f 100644 --- a/ts/interactions/conversationInteractions.ts +++ b/ts/interactions/conversationInteractions.ts @@ -439,7 +439,7 @@ export async function deleteMessagesById( askUserForConfirmation: boolean ) { const conversationModel = getConversationController().getOrThrow(conversationId); - const selectedMessages = _.compact(await Promise.all(messageIds.map(getMessageById))); + const selectedMessages = _.compact(await Promise.all(messageIds.map(m => getMessageById(m)))); const moreThanOne = selectedMessages.length > 1; diff --git a/ts/models/message.ts b/ts/models/message.ts index 4e0d11964..405fc0180 100644 --- a/ts/models/message.ts +++ b/ts/models/message.ts @@ -57,7 +57,7 @@ import { perfEnd, perfStart } from '../session/utils/Performance'; import { AttachmentTypeWithPath } from '../types/Attachment'; export class MessageModel extends Backbone.Model { - constructor(attributes: MessageAttributesOptionals) { + constructor(attributes: MessageAttributesOptionals & { skipTimerInit?: boolean }) { const filledAttrs = fillMessageAttributesWithDefaults(attributes); super(filledAttrs); @@ -76,7 +76,7 @@ export class MessageModel extends Backbone.Model { } // this.on('expired', this.onExpired); - if (!filledAttrs.skipTimerInit) { + if (!attributes.skipTimerInit) { void this.setToExpire(); } autoBind(this); diff --git a/ts/models/messageType.ts b/ts/models/messageType.ts index cfa14270e..353215118 100644 --- a/ts/models/messageType.ts +++ b/ts/models/messageType.ts @@ -102,12 +102,6 @@ export interface MessageAttributes { * We display a small message just below the message referenced */ dataExtractionNotification?: DataExtractionNotificationMsg; - - /** - * This is used to choose whether to initialize the timer or not in the MessageModel object. - * If false or undefined, timer will be in itialized. - */ - skipTimerInit?: boolean; } export interface DataExtractionNotificationMsg { @@ -173,7 +167,6 @@ export interface MessageAttributesOptionals { sync?: boolean; snippet?: any; direction?: any; - skipTimerInit?: boolean; } /**