refactor: Add function to state_accessor to get create event

This commit is contained in:
Ginger committed 2026-04-22 09:36:35 -04:00
1 parent b750117375
commit a68ef84004
5 files changed
+32 -53

No files matched your search

+7 -1
View File
@@ -147,7 +147,13 @@ pub(crate) async fn set_room_visibility_route(
return Err!(Request(Forbidden("Guests cannot publish to room directories")));
}
if !user_can_publish_room(&services, sender_user, &body.room_id).await? {
let room_power_levels = services
.rooms
.state_accessor
.get_room_power_levels(&body.room_id)
.await;
if !room_power_levels.user_can_send_state(user_id, StateEventType::RoomHistoryVisibility) {
return Err!(Request(Forbidden("User is not allowed to publish this room")));
}