fix(account): always include broadcasting relays in non-private sends
The ShortNotePost compose path went through
`signAndComputeBroadcast` → `computeRelayListToBroadcast(event)`, which
only mixed in the user's broadcasting relays indirectly via
`outboxRelays` — and only when `author == userProfile()`. Two real
paths dropped the broadcast list entirely:
* Anonymous posts (`signAnonymouslyAndBroadcast`) sign with a
throwaway pubkey, so `author != userProfile()` and the branch that
pulls in `outboxRelays.flow.value` is skipped.
* `MetadataEvent` / `AdvertisedRelayListEvent` returned early with
`followPlusAllMineWithIndex + availableRelays`, neither of which
includes the broadcast list.
Hoist `broadcastRelayList.flow.value` to the top of the function (after
the `GiftWrapEvent` / `WrappedEvent` early returns that defines what
"private" means) and seed it into every non-private return path. Sets
dedupe so the regular path stays unchanged in the common case where
broadcasting relays were already reachable through `outboxRelays`.
This commit is contained in:
@@ -937,10 +937,6 @@ class Account(
|
||||
private fun computeRelaysForChannels(event: Event): Set<NormalizedRelayUrl> = cache.getAnyChannel(event)?.relays() ?: emptySet()
|
||||
|
||||
fun computeRelayListToBroadcast(event: Event): Set<NormalizedRelayUrl> {
|
||||
if (event is MetadataEvent || event is AdvertisedRelayListEvent) {
|
||||
// everywhere
|
||||
return followPlusAllMineWithIndex.flow.value + client.availableRelaysFlow().value
|
||||
}
|
||||
if (event is GiftWrapEvent) {
|
||||
val receiver = event.recipientPubKey()
|
||||
if (receiver != null) {
|
||||
@@ -959,7 +955,16 @@ class Account(
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
// Non-private sends always go to the user's broadcasting relays.
|
||||
val broadcastRelays = broadcastRelayList.flow.value
|
||||
|
||||
if (event is MetadataEvent || event is AdvertisedRelayListEvent) {
|
||||
// everywhere
|
||||
return followPlusAllMineWithIndex.flow.value + client.availableRelaysFlow().value + broadcastRelays
|
||||
}
|
||||
|
||||
val relayList = mutableSetOf<NormalizedRelayUrl>()
|
||||
relayList.addAll(broadcastRelays)
|
||||
|
||||
val author = cache.getUserIfExists(event.pubKey)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user