fix(account): only skip broadcast for channel events that declare home relays

Tighten the channel/community arm of wantsBroadcastRelays. The previous
revision dropped broadcasting relays for every PollEvent /
MeetingSpaceEvent / MeetingRoomEvent / LiveActivitiesEvent and for any
event LocalCache resolves to a channel. That's wrong when the event
itself doesn't carry a relay set — without broadcast there's no
destination left.

Only treat a channel/community event as "self-routing" when its own
relays() / allRelayUrls() (or its channel's relays()) is non-empty.
Otherwise fall through to the broadcasting list.
This commit is contained in:
Claude
2026-05-13 03:15:02 +00:00
parent 88fefc96b8
commit 007161c7b4
@@ -940,8 +940,10 @@ class Account(
private fun computeRelaysForChannels(event: Event): Set<NormalizedRelayUrl> = cache.getAnyChannel(event)?.relays() ?: emptySet()
// Personal events the user stores just for themselves — drafts, app settings, bookmark
// lists — and channel/community events that already declare their own relay set should
// not be replicated to the user's broadcasting relays.
// lists — and channel/community events that already declare their own home relays
// should not be replicated to the user's broadcasting relays. Channel/community events
// that don't define any home relays fall through to broadcast, since there's nowhere
// else for them to land.
private fun wantsBroadcastRelays(event: Event): Boolean {
if (event is DraftWrapEvent ||
event is AppSpecificDataEvent ||
@@ -951,14 +953,14 @@ class Account(
) {
return false
}
if (event is PollEvent ||
event is MeetingSpaceEvent ||
event is MeetingRoomEvent ||
event is LiveActivitiesEvent ||
cache.getAnyChannel(event) != null
) {
return false
}
if (event is PollEvent && event.relays().isNotEmpty()) return false
if (event is MeetingSpaceEvent && event.allRelayUrls().isNotEmpty()) return false
if (event is MeetingRoomEvent && event.allRelayUrls().isNotEmpty()) return false
if (event is LiveActivitiesEvent && event.allRelayUrls().isNotEmpty()) return false
val channelRelays = cache.getAnyChannel(event)?.relays()
if (channelRelays != null && channelRelays.isNotEmpty()) return false
return true
}