mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-08-08 06:56:10 +00:00
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.
This commit is contained in:
parent
8de70cf50f
commit
71eeaf689f
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user