fix: Compare push user_is_target against the notified user

`user_is_target` was set by comparing a member event's `state_key` to its
sender, rather than to the user receiving the notification.
This commit is contained in:
Bardi Harborow committed 2026-11-05 15:27:50 +11:00
1 parent 223e889459
commit db86d42801
2 files changed
+6 -1

No files matched your search

+1
View File
@@ -0,0 +1 @@
Fixed push notifications for membership events setting `user_is_target` based on the sender rather than the user being notified.
+5 -1
View File
@@ -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<E>(
&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 =