From df42af2ed0facbd3c1411faa14679ed05cf2c226 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Mon, 27 Apr 2026 11:23:48 +0800 Subject: [PATCH] fix: remaining push notification unwrap in second code path - Fix second copy of push_subscription unwrap that was in a tokio::spawn block with different indentation - Replace constant UUID parse unwrap with expect() --- libs/room/src/service/ai_streaming.rs | 3 ++- libs/service/lib.rs | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libs/room/src/service/ai_streaming.rs b/libs/room/src/service/ai_streaming.rs index ddf22c1..76931cf 100644 --- a/libs/room/src/service/ai_streaming.rs +++ b/libs/room/src/service/ai_streaming.rs @@ -59,7 +59,8 @@ pub async fn process_message_ai_streaming( tokio::spawn(async move { let _lock_guard = lock_guard; - let ai_typing_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap(); + let ai_typing_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001") + .expect("constant UUID should always parse"); let ai_display_name_for_chunk = ai_display_name.clone(); let ai_display_name_for_final = ai_display_name.clone(); diff --git a/libs/service/lib.rs b/libs/service/lib.rs index 0340dba..cceecff 100644 --- a/libs/service/lib.rs +++ b/libs/service/lib.rs @@ -235,15 +235,11 @@ impl AppService { if let Ok(Some(prefs)) = prefs { if prefs.push_enabled - && prefs.push_subscription_endpoint.is_some() - && prefs.push_subscription_keys_p256dh.is_some() - && prefs.push_subscription_keys_auth.is_some() + && let Some(endpoint) = &prefs.push_subscription_endpoint + && let Some(p256dh) = &prefs.push_subscription_keys_p256dh + && let Some(auth) = &prefs.push_subscription_keys_auth { - let endpoint = prefs.push_subscription_endpoint.unwrap(); - let p256dh = prefs.push_subscription_keys_p256dh.unwrap(); - let auth = prefs.push_subscription_keys_auth.unwrap(); - - if let Err(e) = push.send(&endpoint, &p256dh, &auth, &payload).await { + if let Err(e) = push.send(endpoint, p256dh, auth, &payload).await { tracing::warn!(user_id = %user_id, error = %e, "WebPush send failed"); } }