diff --git a/autoconnect/autoconnect-ws/autoconnect-ws-sm/src/identified/on_client_msg.rs b/autoconnect/autoconnect-ws/autoconnect-ws-sm/src/identified/on_client_msg.rs index e66dba6e..a0529244 100644 --- a/autoconnect/autoconnect-ws/autoconnect-ws-sm/src/identified/on_client_msg.rs +++ b/autoconnect/autoconnect-ws/autoconnect-ws-sm/src/identified/on_client_msg.rs @@ -349,6 +349,8 @@ impl WebPushClient { self.flags.min_urgency = new_min; let status = if let Some(mut user) = self.app_state.db.get_user(&self.uaid).await? { + // If the user hasn't set a minimum urgency yet, they receive all messages, + // which is equivalent to setting very-low as a minimum let current_urgency = user.urgency.unwrap_or(Urgency::VeryLow); // We update the user user.urgency = Some(new_min); diff --git a/autoendpoint/src/routers/webpush.rs b/autoendpoint/src/routers/webpush.rs index 58792f2f..2df52fcb 100644 --- a/autoendpoint/src/routers/webpush.rs +++ b/autoendpoint/src/routers/webpush.rs @@ -49,6 +49,7 @@ impl Router for WebPushRouter { let notif_urgency = Urgency::from(notification.headers.urgency.as_ref()); // If the notification urgency is lower than the user one, we do not send it + // If the user hasn't set a minimum urgency, we accept all notifications if notif_urgency < user.urgency.unwrap_or(Urgency::VeryLow) { trace!( "✉ Notification has an urgency lower than the user one: {:?} < {:?}",