mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 04:45:20 +00:00
Fix/geohash blocks (#483)
* fix(geo-block): enable block/unblock for geohash users and enforce blocks\n\n- Add persisted set of blocked Nostr pubkeys in SecureIdentityStateManager\n- Check Nostr blocks for incoming messages (public + geo DMs)\n- Prevent sending geo DMs to blocked users\n- Extend /block and /unblock to resolve geohash display names to pubkeys and act accordingly\n- Improve /block list to show geohash blocks (visible names or #suffix) * fix(geo-block): enforce blocks on geohash public and DM receive; add block/unblock actions to geohash people list * fix: mark handlePublicMessage as @MainActor to call isMessageBlocked safely * ui(block): show blocked indicator (nosign icon) next to blocked peers in mesh and geohash lists * fix(geo-block): early-drop blocked pubkeys on geohash receive; filter blocked users from participants list * fix(geo-block): purge existing geohash messages/DMs on block; block directly from chat using Nostr sender ID when available --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -71,6 +71,15 @@ struct GeohashPeopleList: View {
|
||||
.foregroundColor(rowColor)
|
||||
}
|
||||
}
|
||||
// Blocked indicator for geohash users
|
||||
if let me = myHex, person.id != me {
|
||||
if viewModel.isGeohashUserBlocked(pubkeyHexLowercased: person.id) {
|
||||
Image(systemName: "nosign")
|
||||
.font(.system(size: 10))
|
||||
.foregroundColor(.red)
|
||||
.help("Blocked in geochash")
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal)
|
||||
@@ -83,6 +92,18 @@ struct GeohashPeopleList: View {
|
||||
onTapPerson()
|
||||
}
|
||||
}
|
||||
.contextMenu {
|
||||
if let me = myHex, person.id == me {
|
||||
EmptyView()
|
||||
} else {
|
||||
let blocked = viewModel.isGeohashUserBlocked(pubkeyHexLowercased: person.id)
|
||||
if blocked {
|
||||
Button("Unblock") { viewModel.unblockGeohashUser(pubkeyHexLowercased: person.id, displayName: person.displayName) }
|
||||
} else {
|
||||
Button("Block") { viewModel.blockGeohashUser(pubkeyHexLowercased: person.id, displayName: person.displayName) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user