From 83ecec8fd5c82ae54c4f2e8bd9cd47bf3e1075cd Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Wed, 28 Jan 2026 16:56:34 +0100 Subject: [PATCH 1/2] fix: Close thread view if "history_cleared" message is received Signed-off-by: Ivan Sein --- NextcloudTalk/Chat/ChatViewController.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NextcloudTalk/Chat/ChatViewController.swift b/NextcloudTalk/Chat/ChatViewController.swift index dffe39ee7..1865a1733 100644 --- a/NextcloudTalk/Chat/ChatViewController.swift +++ b/NextcloudTalk/Chat/ChatViewController.swift @@ -18,6 +18,7 @@ import SwiftUI public var chatController: NCChatController public var highlightMessageId = 0 public var presentThreadOnAppear = 0 + public var presentedThreadNavigationController: NCNavigationController? // MARK: - Private var private var hasPresentedLobby = false @@ -1154,6 +1155,7 @@ import SwiftUI let navController = NCNavigationController(rootViewController: chatViewController) navController.presentationController?.delegate = chatViewController self.present(navController, animated: true) + presentedThreadNavigationController = navController } // MARK: - Voice message player @@ -1814,6 +1816,13 @@ import SwiftUI self.chatController.clearHistoryAndResetChatController() self.hasRequestedInitialHistory = false self.chatController.getInitialChatHistory() + + // If a thread view is presented, we close it + if self.presentedViewController == presentedThreadNavigationController, + let threadViewController = presentedThreadNavigationController?.viewControllers.first as? ChatViewController { + threadViewController.leaveChat() + threadViewController.dismiss(animated: true) + } } } From af063ef1f3132d05ae74e0cee888ab0672660dd5 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Wed, 28 Jan 2026 16:57:17 +0100 Subject: [PATCH 2/2] fix: Remove all threads info from a room if "history_cleared" message is received Signed-off-by: Ivan Sein --- NextcloudTalk/Chat/NCChatController.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NextcloudTalk/Chat/NCChatController.m b/NextcloudTalk/Chat/NCChatController.m index 9961c189f..e6f46eb0d 100644 --- a/NextcloudTalk/Chat/NCChatController.m +++ b/NextcloudTalk/Chat/NCChatController.m @@ -255,6 +255,8 @@ - (void)removeAllStoredMessagesAndChatBlocks NSPredicate *query = [NSPredicate predicateWithFormat:@"accountId = %@ AND token = %@", _account.accountId, _room.token]; [realm deleteObjects:[NCChatMessage objectsWithPredicate:query]]; [realm deleteObjects:[NCChatBlock objectsWithPredicate:query]]; + NSPredicate *threadsQuery = [NSPredicate predicateWithFormat:@"accountId = %@ AND roomToken = %@", _account.accountId, _room.token]; + [realm deleteObjects:[NCThread objectsWithPredicate:threadsQuery]]; }]; }