Use Action covenience methods

Now Action::Coalesce will also generate a notification.
This commit is contained in:
Jonas Platte
2023-03-13 14:22:07 +01:00
committed by Jonas Platte
parent e9058f58be
commit 59edc22a35
2 changed files with 3 additions and 4 deletions

View File

@@ -411,7 +411,7 @@ impl BaseClient {
if let Some(context) = &push_context {
let actions = push_rules.get_actions(&event.event, context);
if actions.iter().any(|a| matches!(a, Action::Notify)) {
if actions.iter().any(Action::should_notify) {
changes.add_notification(
room_id,
Notification::new(

View File

@@ -35,7 +35,7 @@ use ruma::{
relation::Annotation,
AnyMessageLikeEventContent, AnySyncTimelineEvent,
},
push::{Action, Tweak},
push::Action,
serde::Raw,
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedTransactionId, OwnedUserId,
TransactionId, UserId,
@@ -691,8 +691,7 @@ async fn handle_remote_event<P: RoomDataProvider>(
} else {
Default::default()
};
let is_highlighted =
push_actions.iter().any(|a| matches!(a, Action::SetTweak(Tweak::Highlight(true))));
let is_highlighted = push_actions.iter().any(Action::is_highlight);
let event_meta = TimelineEventMetadata {
sender,
sender_profile,