mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 16:57:39 +00:00
Surface a soft "this content's relay may be stale" UX cue on addressable replaceable events (kind:30xxx) when every delivering relay's most recent NIP-66 kind:30166 Relay Discovery monitor report cached locally is older than 14 days (or has never been observed). Read-only: uses only what's already in LocalCache, populated by the existing RelayInfoNip66FilterSubAssembler. No new network fetches. Implementation: - New `StaleRelayHint` composable in `ui/note/elements/`, hooked into `NoteBody` after the zap-splits row. Skips quietly for non-addressable events, empty relay sets, or any relay still observed within 14 days. - Pure `isStaleByLatestMonitorReports(latestPerRelay, now, threshold)` predicate — `null` (never monitored) and "older than cutoff" both count as stale, but a single fresh relay short-circuits the hint to off. - Reactively tracks the note's relay set via `baseNote.flow().relays.stateFlow` so newly-observed relays update the hint without recomposition tricks. - Latest monitor `created_at` per relay is read from `LocalCache` with the same `Filter(kinds=[30166], #d=[relay.url], limit=1)` shape used on the Relay Information screen. Out of scope (per issue): - Auto-refreshing or hiding stale content. - Heuristics beyond the "all delivering relays stale" check. Tests: 9 unit tests for the pure predicate covering empty/single/mixed sets, null-handling, exact-cutoff boundary, and a custom threshold. Closes #2762.