Skip to content

Commit 5018572

Browse files
JSKittyclaude
andcommitted
fix(badge): refresh the OS unread badge on block/unblock
The unread sum already excludes blocked chats, but nothing recounted on the flip — the dock badge/overlay kept the blocked chat's unreads until the next unrelated message event. Block drops them immediately; unblock restores them, matching the mute toggle's existing pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e1b10fb commit 5018572

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src-tauri/src/profile.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,25 @@ pub async fn upload_avatar(filepath: String, upload_type: Option<String>) -> Res
319319

320320
/// Block a user by npub.
321321
#[tauri::command]
322-
pub async fn block_user(npub: String) -> bool {
323-
vector_core::profile::sync::block_user(npub, &crate::profile_sync::TauriProfileSyncHandler).await
322+
pub async fn block_user<R: tauri::Runtime>(handle: tauri::AppHandle<R>, npub: String) -> bool {
323+
let ok = vector_core::profile::sync::block_user(npub, &crate::profile_sync::TauriProfileSyncHandler).await;
324+
// The unread sum already excludes blocked chats — but nothing recounts
325+
// until the next message event, so the OS badge kept showing the blocked
326+
// chat's unreads. Refresh immediately on the flip (both directions).
327+
if ok {
328+
crate::commands::messaging::update_unread_counter(handle).await;
329+
}
330+
ok
324331
}
325332

326333
/// Unblock a user by npub.
327334
#[tauri::command]
328-
pub async fn unblock_user(npub: String) -> bool {
329-
vector_core::profile::sync::unblock_user(npub, &crate::profile_sync::TauriProfileSyncHandler).await
335+
pub async fn unblock_user<R: tauri::Runtime>(handle: tauri::AppHandle<R>, npub: String) -> bool {
336+
let ok = vector_core::profile::sync::unblock_user(npub, &crate::profile_sync::TauriProfileSyncHandler).await;
337+
if ok {
338+
crate::commands::messaging::update_unread_counter(handle).await;
339+
}
340+
ok
330341
}
331342

332343
/// Returns all blocked profiles.

0 commit comments

Comments
 (0)