Skip to content

Commit

Permalink
state-res: fix allow knock -> leave on same state_key and sender
Browse files Browse the repository at this point in the history
Signed-off-by: strawberry <[email protected]>
  • Loading branch information
girlbossceo committed Nov 21, 2024
1 parent d1f6357 commit 97e2fb6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/ruma-state-res/src/event_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,14 @@ fn valid_membership_change(
MembershipState::Leave => {
if sender == target_user {
let allow = target_user_current_membership == MembershipState::Join
|| target_user_current_membership == MembershipState::Invite;
|| target_user_current_membership == MembershipState::Invite
|| target_user_current_membership == MembershipState::Knock;
if !allow {
warn!(?target_user_membership_event_id, "Can't leave if not invited or joined");
warn!(
?target_user_membership_event_id,
?target_user_current_membership,
"Can't leave if sender is not already invited, knocked, or joined"
);
}
allow
} else if !sender_is_joined
Expand Down

0 comments on commit 97e2fb6

Please sign in to comment.