remove local room aliases and unpublish room when banning a room

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-08-18 16:46:19 -04:00 committed by Jason Volk
parent bc5ecb0c72
commit 4432c06c86

View file

@ -208,6 +208,25 @@ async fn ban_room(
} }
} }
// remove any local aliases, ignore errors
for ref local_alias in self
.services
.rooms
.alias
.local_aliases_for_room(&room_id)
.filter_map(Result::ok)
{
_ = self
.services
.rooms
.alias
.remove_alias(local_alias, &self.services.globals.server_user)
.await;
}
// unpublish from room directory, ignore errors
_ = self.services.rooms.directory.set_not_public(&room_id);
if disable_federation { if disable_federation {
self.services.rooms.metadata.disable_room(&room_id, true)?; self.services.rooms.metadata.disable_room(&room_id, true)?;
return Ok(RoomMessageEventContent::text_plain( return Ok(RoomMessageEventContent::text_plain(
@ -428,6 +447,25 @@ async fn ban_list_of_rooms(&self, force: bool, disable_federation: bool) -> Resu
} }
} }
// remove any local aliases, ignore errors
for ref local_alias in self
.services
.rooms
.alias
.local_aliases_for_room(&room_id)
.filter_map(Result::ok)
{
_ = self
.services
.rooms
.alias
.remove_alias(local_alias, &self.services.globals.server_user)
.await;
}
// unpublish from room directory, ignore errors
_ = self.services.rooms.directory.set_not_public(&room_id);
if disable_federation { if disable_federation {
self.services.rooms.metadata.disable_room(&room_id, true)?; self.services.rooms.metadata.disable_room(&room_id, true)?;
} }