From a42769121ef128d497f2e62f89607c2fdd3d2826 Mon Sep 17 00:00:00 2001 From: Ginger Date: Thu, 11 Sep 2025 13:16:59 -0400 Subject: [PATCH] fix: Only ignore invites targeting the user with the filters --- src/api/client/message.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/api/client/message.rs b/src/api/client/message.rs index c32fcd33a..7adef55d5 100644 --- a/src/api/client/message.rs +++ b/src/api/client/message.rs @@ -305,18 +305,26 @@ where return true; } - if *event.kind() == RoomMember - && event + if *event.kind() == RoomMember { + if event .get_content::() .is_ok_and(|content| content.membership == MembershipState::Invite) - && services - .users - .invite_filter_level(sender_user, recipient_user) - .await == FilterLevel::Ignore - { - // this PDU is an invite from a sender that the recipient has ignored invites - // from - return true; + { + if event + .state_key() + .is_some_and(|key| key == recipient_user.as_str()) + { + if services + .users + .invite_filter_level(sender_user, recipient_user) + .await == FilterLevel::Ignore + { + // this PDU is inviting the recipient to a room and is from a sender that the + // recipient has ignored invites from + return true; + } + } + } } false