Split disable_room, ban_room functions

This commit is contained in:
dasha_uwu
2025-08-22 20:17:44 +05:00
parent a4f589f475
commit 4884c55be7
3 changed files with 20 additions and 34 deletions

View File

@@ -94,23 +94,19 @@ pub async fn is_public(&self, room_id: &RoomId) -> bool {
#[implement(Service)]
#[inline]
pub fn disable_room(&self, room_id: &RoomId, disabled: bool) {
if disabled {
self.db.disabledroomids.insert(room_id, []);
} else {
self.db.disabledroomids.remove(room_id);
}
}
pub fn disable_room(&self, room_id: &RoomId) { self.db.disabledroomids.insert(room_id, []); }
#[implement(Service)]
#[inline]
pub fn ban_room(&self, room_id: &RoomId, banned: bool) {
if banned {
self.db.bannedroomids.insert(room_id, []);
} else {
self.db.bannedroomids.remove(room_id);
}
}
pub fn enable_room(&self, room_id: &RoomId) { self.db.disabledroomids.remove(room_id); }
#[implement(Service)]
#[inline]
pub fn ban_room(&self, room_id: &RoomId) { self.db.bannedroomids.insert(room_id, []); }
#[implement(Service)]
#[inline]
pub fn unban_room(&self, room_id: &RoomId) { self.db.bannedroomids.remove(room_id); }
#[implement(Service)]
pub fn list_banned_rooms(&self) -> impl Stream<Item = &RoomId> + Send + '_ {