style: Run formatting

This commit is contained in:
Jade Ellis committed 2026-09-11 15:54:42 +01:00
1 parent 031039e879
commit 71e101a4dc
6 files changed
+29 -26

No files matched your search

+6 -5
View File
@@ -305,8 +305,8 @@ pub(crate) async fn upgrade_room_route(
return Err!(Request(Forbidden("Upgrading the admin room this way is not allowed."))); return Err!(Request(Forbidden("Upgrading the admin room this way is not allowed.")));
} }
// 1. Check that the user has permission to send m.room.tombstone events in the // 1. Check that the user has permission to send m.room.tombstone events in
// room. // the room.
let old_room_state_lock = services.rooms.state.mutex.lock(body.room_id.as_str()).await; let old_room_state_lock = services.rooms.state.mutex.lock(body.room_id.as_str()).await;
// Check tombstone permission by attempting to create (but not send) the // Check tombstone permission by attempting to create (but not send) the
@@ -556,8 +556,8 @@ pub(crate) async fn upgrade_room_route(
)?; )?;
} }
// 5. Send a `m.room.tombstone` event to the old room to indicate that it is not // 5. Send a `m.room.tombstone` event to the old room to indicate that it is
// intended to be used any further. // not intended to be used any further.
debug!(target=?body.room_id, "Sending tombstone to old room"); debug!(target=?body.room_id, "Sending tombstone to old room");
services services
.rooms .rooms
@@ -598,7 +598,8 @@ pub(crate) async fn upgrade_room_route(
power_levels.events_default = new_level; power_levels.events_default = new_level;
power_levels.invite = new_level; power_levels.invite = new_level;
// 6. Modify the power levels in the old room to prevent sending of events and // 6. Modify the power levels in the old room to prevent sending of events
// and
// inviting new users // inviting new users
// Spec dictates that this is allowed to fail. // Spec dictates that this is allowed to fail.
debug!(target=?body.room_id, ?new_level, "Raising power level in old room to lock it"); debug!(target=?body.room_id, ?new_level, "Raising power level in old room to lock it");
+2 -2
View File
@@ -74,8 +74,8 @@ pub(super) async fn load_left_room(
// return early if: // return early if:
// - this is an initial sync and the room filter doesn't include leaves, or // - this is an initial sync and the room filter doesn't include leaves, or
// - this is an incremental sync, and we've already synced the leave, and the // - this is an incremental sync, and we've already synced the leave, and
// room filter doesn't include leaves // the room filter doesn't include leaves
if last_sync_end_count.is_none_or(|last_sync_end_count| last_sync_end_count >= left_count) if last_sync_end_count.is_none_or(|last_sync_end_count| last_sync_end_count >= left_count)
&& !filter.room.include_leave && !filter.room.include_leave
{ {
+14 -13
View File
@@ -763,8 +763,8 @@ where
Ok(match target_membership { Ok(match target_membership {
| MembershipState::Join => { | MembershipState::Join => {
trace!("starting target_membership=join check"); trace!("starting target_membership=join check");
// 1. If the only previous event is an m.room.create and the state_key is the // 1. If the only previous event is an m.room.create and the
// creator, // state_key is the creator,
// allow // allow
let mut prev_events = current_event.prev_events(); let mut prev_events = current_event.prev_events();
@@ -1052,8 +1052,8 @@ where
allow allow
}, },
| MembershipState::Knock if room_version.authorization.knocking => { | MembershipState::Knock if room_version.authorization.knocking => {
// 1. If the `join_rule` is anything other than `knock` or `knock_restricted`, // 1. If the `join_rule` is anything other than `knock` or
// reject. // `knock_restricted`, reject.
if !matches!(join_rules, JoinRule::KnockRestricted(_) | JoinRule::Knock) { if !matches!(join_rules, JoinRule::KnockRestricted(_) | JoinRule::Knock) {
warn!( warn!(
"Join rule is not set to knock or knock_restricted, knocking is not allowed" "Join rule is not set to knock or knock_restricted, knocking is not allowed"
@@ -1062,8 +1062,8 @@ where
} else if matches!(join_rules, JoinRule::KnockRestricted(_)) } else if matches!(join_rules, JoinRule::KnockRestricted(_))
&& !room_version.authorization.knock_restricted_join_rule && !room_version.authorization.knock_restricted_join_rule
{ {
// 2. If the `join_rule` is `knock_restricted`, but the room does not support // 2. If the `join_rule` is `knock_restricted`, but the room
// `knock_restricted`, reject. // does not support `knock_restricted`, reject.
warn!( warn!(
"Join rule is set to knock_restricted but room version does not support \ "Join rule is set to knock_restricted but room version does not support \
knock_restricted, knocking is not allowed" knock_restricted, knocking is not allowed"
@@ -1081,8 +1081,8 @@ where
sender_membership, sender_membership,
MembershipState::Ban | MembershipState::Invite | MembershipState::Join MembershipState::Ban | MembershipState::Invite | MembershipState::Join
) { ) {
// 4. If the `sender`'s current membership is not `ban`, `invite`, or `join`, // 4. If the `sender`'s current membership is not `ban`,
// allow. // `invite`, or `join`, allow.
// 5. Otherwise, reject. // 5. Otherwise, reject.
warn!( warn!(
?target_user_membership_event_id, ?target_user_membership_event_id,
@@ -1175,11 +1175,12 @@ fn check_power_levels(
} }
// - If any of the keys users_default, events_default, state_default, ban, // - If any of the keys users_default, events_default, state_default, ban,
// redact, kick, or invite in content are present and not an integer, reject. // redact, kick, or invite in content are present and not an integer,
// - If either of the keys events or notifications in content are present and // reject.
// not a dictionary with values that are integers, reject. // - If either of the keys events or notifications in content are present
// - If users key in content is not a dictionary with keys that are valid user // and not a dictionary with values that are integers, reject.
// IDs with values that are integers, reject. // - If users key in content is not a dictionary with keys that are valid
// user IDs with values that are integers, reject.
let user_content: RoomPowerLevelsEventContent = let user_content: RoomPowerLevelsEventContent =
deserialize_power_levels(power_event.content().get(), room_version)?; deserialize_power_levels(power_event.content().get(), room_version)?;
+2 -2
View File
@@ -142,8 +142,8 @@ impl Service {
/// Returns a rate-limited error if the remote is unhealthy. /// Returns a rate-limited error if the remote is unhealthy.
fn ensure_remote_is_healthy(&self, server_name: &ServerName) -> Result<()> { fn ensure_remote_is_healthy(&self, server_name: &ServerName) -> Result<()> {
// Read the backoff window once. The remote can be marked healthy between two // Read the backoff window once. The remote can be marked healthy
// lookups. // between two lookups.
let Some(retry_after) = self let Some(retry_after) = self
.retry_after(server_name) .retry_after(server_name)
.filter(|retry_after| !retry_after.is_zero()) .filter(|retry_after| !retry_after.is_zero())
@@ -161,8 +161,8 @@ impl super::Service {
} }
} }
// 4. Reject "due to auth events" if the event doesn't pass auth based on the // 4. Reject "due to auth events" if the event doesn't pass auth based
// claimed auth events // on the claimed auth events
debug!("Checking based on auth events"); debug!("Checking based on auth events");
let mut auth_events_by_key: HashMap<_, _> = HashMap::with_capacity(auth_events.len()); let mut auth_events_by_key: HashMap<_, _> = HashMap::with_capacity(auth_events.len());
// Build map of auth events // Build map of auth events
+3 -2
View File
@@ -433,8 +433,9 @@ impl Service {
}, },
}); });
// Only claim the destination if we are actually going to send. A status // Only claim the destination if we are actually going to send. A
// inserted here without a transaction being queued is never cleared. // status inserted here without a transaction being queued is
// never cleared.
if allow { if allow {
trace!("Inserting running status for {dest:?}"); trace!("Inserting running status for {dest:?}");
entry.or_insert(TransactionStatus::Running); entry.or_insert(TransactionStatus::Running);