style: Fix typo

This commit is contained in:
Jade Ellis
2025-12-31 20:08:53 +00:00
parent 078275964c
commit 7be20abcad
+15 -15
View File
@@ -427,20 +427,20 @@ impl Service {
} }
let d = vec![device]; let d = vec![device];
let mut notifi = Notification::new(d); let mut notify = Notification::new(d);
notifi.event_id = Some(event.event_id().to_owned()); notify.event_id = Some(event.event_id().to_owned());
notifi.room_id = Some(event.room_id().unwrap().to_owned()); notify.room_id = Some(event.room_id().unwrap().to_owned());
if http if http
.data .data
.get("org.matrix.msc4076.disable_badge_count") .get("org.matrix.msc4076.disable_badge_count")
.is_none() && http.data.get("disable_badge_count").is_none() .is_none() && http.data.get("disable_badge_count").is_none()
{ {
notifi.counts = NotificationCounts::new(unread, uint!(0)); notify.counts = NotificationCounts::new(unread, uint!(0));
} else { } else {
// counts will not be serialised if it's the default (0, 0) // counts will not be serialised if it's the default (0, 0)
// skip_serializing_if = "NotificationCounts::is_default" // skip_serializing_if = "NotificationCounts::is_default"
notifi.counts = NotificationCounts::default(); notify.counts = NotificationCounts::default();
} }
if !event_id_only { if !event_id_only {
@@ -449,30 +449,30 @@ impl Service {
.iter() .iter()
.any(|t| matches!(t, Tweak::Highlight(true) | Tweak::Sound(_))) .any(|t| matches!(t, Tweak::Highlight(true) | Tweak::Sound(_)))
{ {
notifi.prio = NotificationPriority::High; notify.prio = NotificationPriority::High;
} else { } else {
notifi.prio = NotificationPriority::Low; notify.prio = NotificationPriority::Low;
} }
notifi.sender = Some(event.sender().to_owned()); notify.sender = Some(event.sender().to_owned());
notifi.event_type = Some(event.kind().to_owned()); notify.event_type = Some(event.kind().to_owned());
notifi.content = serde_json::value::to_raw_value(event.content()).ok(); notify.content = serde_json::value::to_raw_value(event.content()).ok();
if *event.kind() == TimelineEventType::RoomMember { if *event.kind() == TimelineEventType::RoomMember {
notifi.user_is_target = notify.user_is_target =
event.state_key() == Some(event.sender().as_str()); event.state_key() == Some(event.sender().as_str());
} }
notifi.sender_display_name = notify.sender_display_name =
self.services.users.displayname(event.sender()).await.ok(); self.services.users.displayname(event.sender()).await.ok();
notifi.room_name = self notify.room_name = self
.services .services
.state_accessor .state_accessor
.get_name(event.room_id().unwrap()) .get_name(event.room_id().unwrap())
.await .await
.ok(); .ok();
notifi.room_alias = self notify.room_alias = self
.services .services
.state_accessor .state_accessor
.get_canonical_alias(event.room_id().unwrap()) .get_canonical_alias(event.room_id().unwrap())
@@ -480,7 +480,7 @@ impl Service {
.ok(); .ok();
} }
self.send_request(&http.url, send_event_notification::v1::Request::new(notifi)) self.send_request(&http.url, send_event_notification::v1::Request::new(notify))
.await?; .await?;
Ok(()) Ok(())