service(event_handler): use self instead of services()

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-06-07 03:42:33 -04:00
parent 82ac6b01b2
commit a061644b2d

View file

@ -93,7 +93,7 @@ impl Service {
} }
// 1.3.1 Check room ACL on origin field/server // 1.3.1 Check room ACL on origin field/server
services().rooms.event_handler.acl_check(origin, room_id)?; self.acl_check(origin, room_id)?;
// 1.3.2 Check room ACL on sender's server name // 1.3.2 Check room ACL on sender's server name
let sender: OwnedUserId = serde_json::from_value( let sender: OwnedUserId = serde_json::from_value(
@ -105,10 +105,7 @@ impl Service {
) )
.map_err(|_| Error::BadRequest(ErrorKind::BadJson, "User ID in sender is invalid"))?; .map_err(|_| Error::BadRequest(ErrorKind::BadJson, "User ID in sender is invalid"))?;
services() self.acl_check(sender.server_name(), room_id)?;
.rooms
.event_handler
.acl_check(sender.server_name(), room_id)?;
// Fetch create event // Fetch create event
let create_event = services() let create_event = services()
@ -199,9 +196,7 @@ impl Service {
.await .await
.insert(room_id.to_owned(), (event_id.to_owned(), start_time)); .insert(room_id.to_owned(), (event_id.to_owned(), start_time));
let r = services() let r = self
.rooms
.event_handler
.upgrade_outlier_to_timeline_pdu(incoming_pdu, val, &create_event, origin, room_id, pub_key_map) .upgrade_outlier_to_timeline_pdu(incoming_pdu, val, &create_event, origin, room_id, pub_key_map)
.await; .await;