Skip to content

Commit

Permalink
Try to check group mute status for keeping archived.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-signal authored and alex-signal committed Feb 6, 2023
1 parent 418b486 commit 3b40b10
Showing 1 changed file with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2494,20 +2494,26 @@ private Optional<InsertResult> insertMessageInbox(IncomingMediaMessage retrieved
return Optional.empty();
}

boolean updateThread = retrieved.getStoryType() == StoryType.NONE;
boolean keepThreadArchived = SignalStore.settings().shouldKeepMutedChatsArchived() && Recipient.resolved(retrieved.getFrom()).isMuted();
long messageId = insertMediaMessage(threadId,
retrieved.getBody(),
retrieved.getAttachments(),
quoteAttachments,
retrieved.getSharedContacts(),
retrieved.getLinkPreviews(),
retrieved.getMentions(),
retrieved.getMessageRanges(),
contentValues,
null,
updateThread,
!keepThreadArchived);
boolean updateThread = retrieved.getStoryType() == StoryType.NONE;

RecipientId threadRecipientId = SignalDatabase.threads().getRecipientIdForThreadId(threadId);
if (threadRecipientId == null) {
threadRecipientId = retrieved.getFrom();
}
boolean keepThreadArchived = threadRecipientId != null && SignalStore.settings().shouldKeepMutedChatsArchived() && Recipient.resolved(threadRecipientId).isMuted();

long messageId = insertMediaMessage(threadId,
retrieved.getBody(),
retrieved.getAttachments(),
quoteAttachments,
retrieved.getSharedContacts(),
retrieved.getLinkPreviews(),
retrieved.getMentions(),
retrieved.getMessageRanges(),
contentValues,
null,
updateThread,
!keepThreadArchived);

boolean isNotStoryGroupReply = retrieved.getParentStoryId() == null || !retrieved.getParentStoryId().isGroupReply();
if (!MessageTypes.isPaymentsActivated(mailbox) && !MessageTypes.isPaymentsRequestToActivate(mailbox) && !MessageTypes.isExpirationTimerUpdate(mailbox) && !retrieved.getStoryType().isStory() && isNotStoryGroupReply) {
Expand Down

0 comments on commit 3b40b10

Please sign in to comment.