Skip to content

Commit

Permalink
Add comments when falling back to default urgency filter
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Jan 3, 2025
1 parent ea2d312 commit 459de07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions autoendpoint/src/routers/webpush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {:?} < {:?}",
Expand Down

0 comments on commit 459de07

Please sign in to comment.