From 2bb68ccbcf21ee5649dc11e117588815261c9a30 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Wed, 24 May 2023 09:43:06 +1000 Subject: [PATCH] Fixed a few issues found during QA Fixed an issue where you could be left on the settings screen after deleting/leaving a conversation Fixed an issue where deleting the last contact/group/community from a device would result in linked devices not deleting the relevant conversation Fixed an issue where leaving a group created a race condition where linked devices wouldn't remove the group --- .../Settings/ThreadSettingsViewModel.swift | 7 ++++++- .../MessageReceiver+ClosedGroups.swift | 2 +- .../Config Handling/SessionUtil+Contacts.swift | 3 --- .../SessionUtil+ConvoInfoVolatile.swift | 3 --- .../Config Handling/SessionUtil+UserGroups.swift | 3 --- .../Shared Models/SessionThreadViewModel.swift | 13 +++---------- 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Session/Conversations/Settings/ThreadSettingsViewModel.swift b/Session/Conversations/Settings/ThreadSettingsViewModel.swift index 486644d3c..2a1592866 100644 --- a/Session/Conversations/Settings/ThreadSettingsViewModel.swift +++ b/Session/Conversations/Settings/ThreadSettingsViewModel.swift @@ -201,7 +201,12 @@ class ThreadSettingsViewModel: SessionTableViewModel () = { + // Only make this change if needed (want to avoid triggering a thread update + // if not needed) guard threadWasMarkedUnread == true else { return } Storage.shared.writeAsync { db in @@ -289,16 +291,7 @@ public struct SessionThreadViewModel: FetchableRecordWithRowId, Decodable, Equat let threadIsMessageRequest: Bool? = self.threadIsMessageRequest Storage.shared.writeAsync { db in - // Only make this change if needed (want to avoid triggering a thread update - // if not needed) - if threadWasMarkedUnread == true { - try SessionThread - .filter(id: threadId) - .updateAllAndConfig( - db, - SessionThread.Columns.markedAsUnread.set(to: false) - ) - } + markThreadAsReadIfNeeded() try Interaction.markAsRead( db,