fix(desktop): populate last_message_at in channel browser#951
Merged
Conversation
The browse-channels pane showed 'No activity' for every channel because get_channels never back-filled last_message_at after constructing ChannelInfo from metadata events (the relay doesn't emit the kind:40901 summary sidecar that channel_info_from_event would parse it from). Add a batched relay query using per-channel filters — one filter per channel with a single #h value and limit:1 — to fetch the most recent kind:9 (stream message) or kind:40002 (v2 stream message) event per channel. Per-channel filters ensure the relay can push the query to its indexed channel_id column; multi-value #h would fall back to a global scan and silently drop quieter channels under the limit cap. No since bound on the recency query so channels quiet for weeks still show 'Active 3w ago' rather than misleading 'No activity'. Co-authored-by: Will Pfleger <wpfleger@squareup.com> Signed-off-by: Will Pfleger <wpfleger@squareup.com>
wesbillman
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Browse Channels" pane shows "No activity" for every channel because
get_channelsnever populated thelast_message_atfield onChannelInfo. The rendering path (formatRelativeTime) already handles the field correctly — it just never had data.Changes
Add a batched relay query after the existing member-count back-fill in
get_channels(desktop/src-tauri/src/commands/channels.rs). For each browse-pane channel, sends a per-channel filter:{"kinds": [9, 40002], "#h": ["<channel-id>"], "limit": 1}All filters go in one
/queryPOST — the relay loops per-filter, so each returns that channel's newest event with no cross-channel crowding. Per channel, takesMAX(created_at)and assigns tolast_message_at.Key decisions:
#hfilters — avoids the multi-value#hSQL-pushdown trap where a global limit truncates quieter channels.[9, 40002]— includesKIND_STREAM_MESSAGE_V2so v2-only channels don't show false "No activity". Excludes edits (40003), system messages (40099), and forum kinds (45001/45003).sincebound — channels quiet for weeks show "Active 3w ago" rather than misleading "No activity".formatRelativeTime(channel.lastMessageAt)already renders correctly on non-null values; the DTO bridge and TypeScript types already wire the field through.Also bumps
timestamp_to_isoinnostr_convert.rstopub(crate)visibility (was private, already existed).Files changed
desktop/src-tauri/src/commands/channels.rs— recency query + assignmentdesktop/src-tauri/src/nostr_convert.rs— visibility bump ontimestamp_to_iso