check if user is allowed to invite for join_authorized_via_users_server in join_room_by_id_helper
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
@@ -945,14 +945,19 @@ pub(crate) async fn join_room_by_id_helper(
|
|||||||
.map(|(u, _)| u.to_owned())
|
.map(|(u, _)| u.to_owned())
|
||||||
})
|
})
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
// TODO: Check here if user is actually allowed to invite. Currently the auth
|
|
||||||
// check will just fail in this case.
|
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.room_members(restriction_room_id)
|
.room_members(restriction_room_id)
|
||||||
.filter_map(Result::ok)
|
.filter_map(Result::ok)
|
||||||
.find(|uid| uid.server_name() == services().globals.server_name())
|
.find(|uid| {
|
||||||
|
uid.server_name() == services().globals.server_name()
|
||||||
|
&& services()
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.user_can_invite(uid, restriction_room_id)
|
||||||
|
.unwrap_or(false)
|
||||||
|
})
|
||||||
});
|
});
|
||||||
Some(authorized_user)
|
Some(authorized_user)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user