From 71eeaf689f577dd800e565b79bf07437d02dce9a Mon Sep 17 00:00:00 2001 From: Taksh Date: Fri, 31 Jul 2026 14:40:14 +0300 Subject: [PATCH] fix: hide the open DM from the recent-messages section Skip the currently selected private peer so the people sheet doesn't list the thread you're already in. --- bitchat/App/PeerListModel.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bitchat/App/PeerListModel.swift b/bitchat/App/PeerListModel.swift index e7af0856..649d99b6 100644 --- a/bitchat/App/PeerListModel.swift +++ b/bitchat/App/PeerListModel.swift @@ -160,6 +160,13 @@ final class PeerListModel: ObservableObject { } .store(in: &cancellables) + conversations.$selectedPrivatePeerID + .receive(on: DispatchQueue.main) + .sink { [weak self] _ in + self?.refresh() + } + .store(in: &cancellables) + chatViewModel.groupStore.$groups .receive(on: DispatchQueue.main) .sink { [weak self] _ in @@ -283,8 +290,11 @@ final class PeerListModel: ObservableObject { private func buildRecentDirectRows(excluding myPeerID: PeerID) -> [RecentDirectRow] { let messagesByPeer = conversations.directMessagesByRoutingPeerID() + let selected = conversations.selectedPrivatePeerID return conversations.recentDirectRoutingPeerIDs(limit: 8).compactMap { peerID in guard peerID != myPeerID else { return nil } + // Already in that thread — no need to list it again here. + guard peerID != selected else { return nil } let messages = messagesByPeer[peerID] ?? [] guard let last = messages.last else { return nil } let preview = last.content