debug: add logging to highlight creation isLocalOnly logic

- Add console.log to debug why isLocalOnly is not being set correctly
- Fix logic: isLocalOnly should be true when only local relays are connected
- Previous logic was checking expectedSuccessRelays instead of actual connections
- This will help identify why airplane icon doesn't show in flight mode
This commit is contained in:
Gigi
2025-10-30 20:34:23 +01:00
parent b6f151c711
commit 1cd85507a7

View File

@@ -127,10 +127,23 @@ export async function createHighlight(
.map(relay => relay.url) .map(relay => relay.url)
const hasRemoteConnection = connectedRelays.some(url => !isLocalRelay(url)) const hasRemoteConnection = connectedRelays.some(url => !isLocalRelay(url))
const hasLocalConnection = connectedRelays.some(url => isLocalRelay(url))
// Determine which relays we actually published to
const expectedSuccessRelays = hasRemoteConnection const expectedSuccessRelays = hasRemoteConnection
? RELAYS ? RELAYS // Published to all relays (local + remote)
: RELAYS.filter(isLocalRelay) : RELAYS.filter(isLocalRelay) // Only published to local relays
const isLocalOnly = areAllRelaysLocal(expectedSuccessRelays)
// isLocalOnly is true if we only have local connections (flight mode)
const isLocalOnly = hasLocalConnection && !hasRemoteConnection
console.log('🔍 Highlight creation debug:', {
connectedRelays,
hasRemoteConnection,
hasLocalConnection,
expectedSuccessRelays,
isLocalOnly
})
// Convert to Highlight with relay tracking info and return IMMEDIATELY // Convert to Highlight with relay tracking info and return IMMEDIATELY
const highlight = eventToHighlight(signedEvent) const highlight = eventToHighlight(signedEvent)