Generalize keepMutedChatsArchived check

This commit is contained in:
Fedor Indutny 2023-02-06 10:08:53 -08:00 committed by GitHub
parent f3b68677b3
commit dff924c0c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 7 deletions

View file

@ -90,6 +90,7 @@ import {
import { handleMessageSend } from '../util/handleMessageSend';
import { getSendOptions } from '../util/getSendOptions';
import { findAndFormatContact } from '../util/findAndFormatContact';
import { canConversationBeUnarchived } from '../util/canConversationBeUnarchived';
import {
getAttachmentsForMessage,
getMessagePropStatus,
@ -3167,11 +3168,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
const isGroupStoryReply =
isGroup(conversation.attributes) && message.get('storyId');
const keepMutedChatsArchived =
window.storage.get('keepMutedChatsArchived') ?? false;
const keepThisConversationArchived =
keepMutedChatsArchived && conversation.isMuted();
if (readSyncs.length !== 0 || viewSyncs.length !== 0) {
const markReadAt = Math.min(
Date.now(),
@ -3214,7 +3210,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
} else if (
isFirstRun &&
!isGroupStoryReply &&
!keepThisConversationArchived
canConversationBeUnarchived(conversation.attributes)
) {
conversation.setArchived(false);
}