Skip to content

Commit

Permalink
fix /kick endpoint unbanning banned users
Browse files Browse the repository at this point in the history
Signed-off-by: strawberry <[email protected]>
  • Loading branch information
girlbossceo committed Jan 11, 2025
1 parent e220ac5 commit 5bad6a5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/api/client/membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,16 @@ pub(crate) async fn kick_user_route(
return Ok(kick_user::v3::Response::new());
};

if !matches!(
event.membership,
MembershipState::Invite | MembershipState::Knock | MembershipState::Join,
) {
return Err!(Request(Forbidden(
"Cannot kick a user who is not apart of the room (current membership: {})",
event.membership
)));
}

services
.rooms
.timeline
Expand Down Expand Up @@ -527,7 +537,7 @@ pub(crate) async fn unban_user_route(

if current_member_content.membership != MembershipState::Ban {
return Err!(Request(Forbidden(
"Cannot ban a user who is not banned (current membership: {})",
"Cannot unban a user who is not banned (current membership: {})",
current_member_content.membership
)));
}
Expand Down

0 comments on commit 5bad6a5

Please sign in to comment.