Skip to content

Commit e8096ee

Browse files
committed
refactor(notification client): simplify get_notification_with_sliding_sync
1 parent 6814e70 commit e8096ee

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

crates/matrix-sdk-ui/src/notification_client.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -684,30 +684,23 @@ impl NotificationClient {
684684
continue;
685685
}
686686

687-
let status =
687+
let notification_item =
688688
match NotificationItem::new(&room, raw_event, push_actions.as_deref(), Vec::new())
689689
.await
690-
.map(|event| NotificationStatus::Event(Box::new(event)))
691690
{
692-
Ok(status) => status,
691+
Ok(item) => item,
693692
Err(err) => {
694693
// Could not build the notification item, return an error.
695694
batch_result.insert(event_id, Err(err));
696695
continue;
697696
}
698697
};
699698

700-
match status {
701-
NotificationStatus::Event(event) => {
702-
if self.client.is_user_ignored(event.event.sender()).await {
703-
batch_result.insert(event_id, Ok(NotificationStatus::EventFilteredOut));
704-
} else {
705-
batch_result.insert(event_id, Ok(NotificationStatus::Event(event)));
706-
}
707-
}
708-
_ => {
709-
batch_result.insert(event_id, Ok(status));
710-
}
699+
if self.client.is_user_ignored(notification_item.event.sender()).await {
700+
batch_result.insert(event_id, Ok(NotificationStatus::EventFilteredOut));
701+
} else {
702+
batch_result
703+
.insert(event_id, Ok(NotificationStatus::Event(Box::new(notification_item))));
711704
}
712705
}
713706

0 commit comments

Comments
 (0)