dont evict admins from room, allow admins to join banned rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
ed0c8e86f7
commit
c9364dc077
2 changed files with 47 additions and 9 deletions
|
@ -49,7 +49,9 @@ pub async fn join_room_by_id_route(
|
|||
) -> Result<join_room_by_id::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
if services().rooms.metadata.is_banned(&body.room_id)? {
|
||||
if services().rooms.metadata.is_banned(&body.room_id)?
|
||||
&& !services().users.is_admin(sender_user)?
|
||||
{
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"This room is banned on this homeserver.",
|
||||
|
@ -97,7 +99,9 @@ pub async fn join_room_by_id_or_alias_route(
|
|||
|
||||
let (servers, room_id) = match OwnedRoomId::try_from(body.room_id_or_alias) {
|
||||
Ok(room_id) => {
|
||||
if services().rooms.metadata.is_banned(&room_id)? {
|
||||
if services().rooms.metadata.is_banned(&room_id)?
|
||||
&& !services().users.is_admin(sender_user)?
|
||||
{
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"This room is banned on this homeserver.",
|
||||
|
@ -126,7 +130,9 @@ pub async fn join_room_by_id_or_alias_route(
|
|||
Err(room_alias) => {
|
||||
let response = get_alias_helper(room_alias).await?;
|
||||
|
||||
if services().rooms.metadata.is_banned(&response.room_id)? {
|
||||
if services().rooms.metadata.is_banned(&response.room_id)?
|
||||
&& !services().users.is_admin(sender_user)?
|
||||
{
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"This room is banned on this homeserver.",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue