dont allow sending/receiving room invites with ignored users

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-09-28 23:15:43 -04:00
parent 2083c38c76
commit 4413793f7e
2 changed files with 26 additions and 2 deletions

View file

@ -364,6 +364,14 @@ pub(crate) async fn invite_user_route(
user_id,
} = &body.recipient
{
if services.users.user_is_ignored(sender_user, user_id).await {
return Err!(Request(Forbidden("You cannot invite users you have ignored to rooms.")));
} else if services.users.user_is_ignored(user_id, sender_user).await {
// silently drop the invite to the recipient if they've been ignored by the
// sender, pretend it worked
return Ok(invite_user::v3::Response {});
}
invite_helper(&services, sender_user, user_id, &body.room_id, body.reason.clone(), false).await?;
Ok(invite_user::v3::Response {})
} else {