change the way skipTimerInit is defined in MessageModel

This commit is contained in:
Brice-W 2021-07-26 15:11:20 +10:00
parent bec9bd553e
commit 54a2eef700
3 changed files with 3 additions and 10 deletions

View file

@ -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;

View file

@ -57,7 +57,7 @@ import { perfEnd, perfStart } from '../session/utils/Performance';
import { AttachmentTypeWithPath } from '../types/Attachment';
export class MessageModel extends Backbone.Model<MessageAttributes> {
constructor(attributes: MessageAttributesOptionals) {
constructor(attributes: MessageAttributesOptionals & { skipTimerInit?: boolean }) {
const filledAttrs = fillMessageAttributesWithDefaults(attributes);
super(filledAttrs);
@ -76,7 +76,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
}
// this.on('expired', this.onExpired);
if (!filledAttrs.skipTimerInit) {
if (!attributes.skipTimerInit) {
void this.setToExpire();
}
autoBind(this);

View file

@ -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;
}
/**