refactor(spaces): remove unused space_id param from sync_power_levels
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Failing after 5s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 5s
Update flake hashes / update-flake-hashes (pull_request) Failing after 5s
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Failing after 5s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 5s
Update flake hashes / update-flake-hashes (pull_request) Failing after 5s
sync_power_levels now queries all parent spaces internally via get_parent_spaces, making the space_id parameter redundant. This also eliminates redundant work where sync_power_levels_for_children was calling it once per child per parent space.
This commit is contained in:
parent
52de04403c
commit
5d4cf82c3d
1 changed files with 2 additions and 6 deletions
|
|
@ -525,11 +525,7 @@ pub async fn get_room_requirements_in_space(
|
|||
}
|
||||
|
||||
#[implement(Service)]
|
||||
pub async fn sync_power_levels(&self, space_id: &RoomId, room_id: &RoomId) -> Result {
|
||||
if !self.is_enabled_for_space(space_id).await {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
pub async fn sync_power_levels(&self, room_id: &RoomId) -> Result {
|
||||
let server_user = self.services.globals.server_user.as_ref();
|
||||
if !self
|
||||
.services
|
||||
|
|
@ -850,7 +846,7 @@ pub async fn check_join_allowed(&self, room_id: &RoomId, user_id: &UserId) -> Re
|
|||
async fn sync_power_levels_for_children(&self, space_id: &RoomId) {
|
||||
let child_rooms = self.get_child_rooms(space_id).await;
|
||||
for child_room_id in &child_rooms {
|
||||
if let Err(e) = self.sync_power_levels(space_id, child_room_id).await {
|
||||
if let Err(e) = self.sync_power_levels(child_room_id).await {
|
||||
debug_warn!(room_id = %child_room_id, error = ?e, "Failed to sync power levels");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue