diff --git a/changelog.d/2454.bugfix.md b/changelog.d/2454.bugfix.md new file mode 100644 index 000000000..6dfd7b5df --- /dev/null +++ b/changelog.d/2454.bugfix.md @@ -0,0 +1 @@ +Fixed push notifications for membership events setting `user_is_target` based on the sender rather than the user being notified. diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 1dd51495a..778457f42 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -532,6 +532,7 @@ impl Service { let notify = self .build_notification( + user, pusher, &http.data, http.format.as_ref(), @@ -549,6 +550,7 @@ impl Service { | PusherKind::WebPush(data) => { let notify = self .build_notification( + user, pusher, &data.data, data.format.as_ref(), @@ -564,8 +566,10 @@ impl Service { } } + #[allow(clippy::too_many_arguments)] async fn build_notification( &self, + user: &UserId, pusher: &Pusher, data: &JsonObject, format: Option<&PushFormat>, @@ -614,7 +618,7 @@ impl Service { notify.content = serde_json::value::to_raw_value(event.content()).ok(); if *event.kind() == TimelineEventType::RoomMember { - notify.user_is_target = event.state_key() == Some(event.sender().as_str()); + notify.user_is_target = event.state_key() == Some(user.as_str()); } notify.sender_display_name =