mirror of
https://github.com/dergigi/boris.git
synced 2026-02-06 15:44:20 +01:00
fix: add fallback logic for detecting flight mode highlights
- Add isEventOfflineCreated function to check offline sync service - Use offline sync service as fallback if isLocalOnly is undefined - Also check if publishedRelays only contains local relays - This provides multiple fallback mechanisms to detect flight mode highlights - Should finally fix the airplane icon not showing
This commit is contained in:
@@ -307,18 +307,34 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
}
|
||||
|
||||
// Check if this highlight was only published to local relays
|
||||
const isLocalOnly = highlight.isLocalOnly
|
||||
let isLocalOnly = highlight.isLocalOnly
|
||||
const publishedRelays = highlight.publishedRelays || []
|
||||
|
||||
// Debug: Log what we're working with (remove after fixing)
|
||||
if (highlight.id && (isLocalOnly !== undefined || publishedRelays.length > 0)) {
|
||||
console.log('🔍 [HIGHLIGHT-UI-DEBUG] Highlight data:', {
|
||||
// Fallback 1: Check if this highlight was marked for offline sync (flight mode)
|
||||
if (isLocalOnly === undefined) {
|
||||
const { isEventOfflineCreated } = require('../services/offlineSyncService')
|
||||
if (isEventOfflineCreated(highlight.id)) {
|
||||
isLocalOnly = true
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback 2: If publishedRelays only contains local relays, it's local-only
|
||||
if (isLocalOnly === undefined && publishedRelays.length > 0) {
|
||||
const { isLocalRelay } = require('../utils/helpers')
|
||||
const hasOnlyLocalRelays = publishedRelays.every(url => isLocalRelay(url))
|
||||
const hasRemoteRelays = publishedRelays.some(url => !isLocalRelay(url))
|
||||
if (hasOnlyLocalRelays && !hasRemoteRelays) {
|
||||
isLocalOnly = true
|
||||
}
|
||||
}
|
||||
|
||||
// Debug: Log for flight mode highlights
|
||||
if (highlight.id && (isLocalOnly === true || publishedRelays.some(url => url.includes('localhost')))) {
|
||||
console.log('🔍 [HIGHLIGHT-UI-DEBUG] Flight mode highlight:', {
|
||||
highlightId: highlight.id,
|
||||
isLocalOnly,
|
||||
publishedRelays,
|
||||
seenOnRelays: highlight.seenOnRelays,
|
||||
willUsePublishedRelays: !!(highlight.publishedRelays && highlight.publishedRelays.length > 0),
|
||||
willUseSeenOnRelays: !!(highlight.seenOnRelays && highlight.seenOnRelays.length > 0)
|
||||
willShowAirplane: isLocalOnly === true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,13 @@ export function markEventAsOfflineCreated(eventId: string): void {
|
||||
offlineCreatedEvents.add(eventId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an event was created during offline period (flight mode)
|
||||
*/
|
||||
export function isEventOfflineCreated(eventId: string): boolean {
|
||||
return offlineCreatedEvents.has(eventId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an event is currently being synced
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user