Skip to main content

tuwunel_api/client/
utils.rs

1use ruma::{RoomId, UserId};
2use tuwunel_core::{Err, Result, warn};
3use tuwunel_service::Services;
4
5pub(crate) async fn invite_check(
6	services: &Services,
7	sender_user: &UserId,
8	room_id: &RoomId,
9) -> Result {
10	if services.config.block_non_admin_invites && !services.admin.user_is_admin(sender_user).await
11	{
12		warn!("{sender_user} is not an admin and attempted to send an invite to {room_id}");
13		return Err!(Request(Forbidden("Invites are not allowed on this server.")));
14	}
15
16	Ok(())
17}