fix(friends): clear the "Rescanning…" status when the pass completes
The manual Rescan set a persistent "Rescanning friends…" status but nothing ever cleared it: the probe pass emits per-friend presence events with no "done" signal, so the banner stuck forever (an offline friend's probe can take up to the 10s IO timeout, and there was no terminal event after). Core now emits a `FriendsRescanned` UiEvent after the manual pass finishes (only the on-demand button, never the 15s auto-refresh, so the status bar isn't churned each interval). The GUI replaces the transient banner with "Friends rescanned." — guarded so it won't clobber a status the user has since triggered. Invisible mode probes no one, so the button now explains that instead of showing a banner that resolves with nothing changed. 469 lib tests pass, clippy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-3
@@ -1700,6 +1700,14 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
UiEvent::FriendPresence { id, presence } => {
|
||||
state.friend_presence.insert(id, presence);
|
||||
}
|
||||
UiEvent::FriendsRescanned => {
|
||||
// The manual pass finished; replace the transient "Rescanning…"
|
||||
// banner, but only if it's still showing (don't clobber a status
|
||||
// the user has since triggered, e.g. by joining a room).
|
||||
if state.status_message == "Rescanning friends…" {
|
||||
state.status_message = "Friends rescanned.".to_string();
|
||||
}
|
||||
}
|
||||
UiEvent::PresenceModeReverted { mode } => {
|
||||
// Core corrected the committed presence mode. Mirror + persist so
|
||||
// the picker reflects the discovery state the endpoint actually has.
|
||||
@@ -1898,9 +1906,17 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
}
|
||||
}
|
||||
AppMessage::RefreshFriends => {
|
||||
// Kick an immediate presence pass; the list updates as replies land.
|
||||
let _ = state.controller.send(CoreCommand::RefreshFriends);
|
||||
state.status_message = "Rescanning friends…".to_string();
|
||||
// Kick an immediate presence pass; the list updates as replies land and
|
||||
// the banner clears on the FriendsRescanned completion event. While
|
||||
// Invisible we probe no one, so say why instead of a banner that resolves
|
||||
// with nothing changed.
|
||||
if state.config.presence_mode == PresenceMode::Invisible {
|
||||
state.status_message =
|
||||
"You're invisible — turn on presence to scan friends.".to_string();
|
||||
} else {
|
||||
let _ = state.controller.send(CoreCommand::RefreshFriends);
|
||||
state.status_message = "Rescanning friends…".to_string();
|
||||
}
|
||||
}
|
||||
AppMessage::JoinFriendRoom(ticket) => {
|
||||
// Join via the friend's member ticket (same path as a manual join).
|
||||
|
||||
Reference in New Issue
Block a user