mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
chore: Reformat with latest nightly
This commit is contained in:
113 files changed
+981
-831
No files matched your search
@@ -85,8 +85,8 @@ pub(crate) async fn get_backfill_route(
|
||||
pdu.remove_transaction_id().log_err().ok();
|
||||
// Add age, as this is specified
|
||||
pdu.add_age().log_err().ok();
|
||||
// It's not clear if we should strip or add any more data, leave as is.
|
||||
// In particular: Redaction?
|
||||
// It's not clear if we should strip or add any more data, leave as
|
||||
// is. In particular: Redaction?
|
||||
Ok(pdu)
|
||||
})
|
||||
.try_filter_map(|pdu| async move {
|
||||
|
||||
+11
-11
@@ -75,8 +75,8 @@ pub(crate) async fn create_invite_route(
|
||||
.expect("must have create event in invite state by this point");
|
||||
|
||||
// We can now perform the banned remote server check with the create event.
|
||||
// N.B. this checks the sender field, which is technically incorrect for rooms
|
||||
// v10 and below. This usually isn't the case though so sue me
|
||||
// N.B. this checks the sender field, which is technically incorrect for
|
||||
// rooms v10 and below. This usually isn't the case though so sue me
|
||||
let creator = create_event_json
|
||||
.get("sender")
|
||||
.and_then(|v| v.as_str())
|
||||
@@ -122,8 +122,8 @@ pub(crate) async fn create_invite_route(
|
||||
return Err!(Request(Forbidden("Invite rejected by antispam service.")));
|
||||
}
|
||||
|
||||
// If we're already in the room, ensure that neither the origin nor ourselves
|
||||
// are ACL'd.
|
||||
// If we're already in the room, ensure that neither the origin nor
|
||||
// ourselves are ACL'd.
|
||||
let resident = services
|
||||
.rooms
|
||||
.state_cache
|
||||
@@ -159,15 +159,15 @@ pub(crate) async fn create_invite_route(
|
||||
|
||||
// If we are active in the room, the remote server will notify us about the
|
||||
// join/invite through /send. If we are not in the room, we need to manually
|
||||
// record the invited state for client /sync through update_membership(), and
|
||||
// send the invite PDU to the relevant appservices.
|
||||
// record the invited state for client /sync through update_membership(),
|
||||
// and send the invite PDU to the relevant appservices.
|
||||
if !resident {
|
||||
// We will start by recording the room's create event as an outlier.
|
||||
// This will allow us to recognise it later in case the sender revokes the
|
||||
// invite over federation later. We could store more state from the invite
|
||||
// request, but we will get that during send_join anyway.
|
||||
// This is safe to just add directly as an outlier as we already auth checked it
|
||||
// during validation.
|
||||
// This will allow us to recognise it later in case the sender revokes
|
||||
// the invite over federation later. We could store more state from
|
||||
// the invite request, but we will get that during send_join anyway.
|
||||
// This is safe to just add directly as an outlier as we already auth
|
||||
// checked it during validation.
|
||||
services
|
||||
.rooms
|
||||
.outlier
|
||||
|
||||
+13
-11
@@ -99,8 +99,8 @@ pub(crate) async fn create_join_event_template_route(
|
||||
);
|
||||
let join_authorized_via_users_server: Option<OwnedUserId> = {
|
||||
if is_joined || is_invited {
|
||||
// User is already joined or invited and consequently does not need an
|
||||
// authorising user
|
||||
// User is already joined or invited and consequently does not need
|
||||
// an authorising user
|
||||
None
|
||||
} else if !room_version_rules.authorization.restricted_join_rule {
|
||||
// room version does not support restricted join rules
|
||||
@@ -223,8 +223,9 @@ pub(crate) async fn user_can_perform_restricted_join(
|
||||
.server_in_room(services.globals.server_name(), &membership.room_id)
|
||||
.await
|
||||
{
|
||||
// Since we can't check this room, mark could_satisfy as false
|
||||
// so that we can return M_UNABLE_TO_AUTHORIZE_JOIN later.
|
||||
// Since we can't check this room, mark could_satisfy as
|
||||
// false so that we can return
|
||||
// M_UNABLE_TO_AUTHORIZE_JOIN later.
|
||||
could_satisfy = false;
|
||||
continue;
|
||||
}
|
||||
@@ -252,7 +253,8 @@ pub(crate) async fn user_can_perform_restricted_join(
|
||||
| Err(_) => Err!(Request(Forbidden("Antispam rejected join request."))),
|
||||
},
|
||||
| _ => {
|
||||
// We don't recognise this join rule, so we cannot satisfy the request.
|
||||
// We don't recognise this join rule, so we cannot satisfy the
|
||||
// request.
|
||||
could_satisfy = false;
|
||||
debug_info!(
|
||||
"Unsupported allow rule in restricted join for room {}: {:?}",
|
||||
@@ -264,16 +266,16 @@ pub(crate) async fn user_can_perform_restricted_join(
|
||||
}
|
||||
|
||||
if could_satisfy {
|
||||
// We were able to check all the restrictions and can be certain that the
|
||||
// prospective member is not permitted to join.
|
||||
// We were able to check all the restrictions and can be certain that
|
||||
// the prospective member is not permitted to join.
|
||||
Err!(Request(Forbidden(
|
||||
"You do not belong to any of the rooms or spaces required to join this room."
|
||||
)))
|
||||
} else {
|
||||
// We were unable to check all the restrictions. This usually means we aren't in
|
||||
// one of the rooms this one is restricted to, ergo can't check its state for
|
||||
// the user's membership, and consequently the user *might* be able to join if
|
||||
// they ask another server.
|
||||
// We were unable to check all the restrictions. This usually means we
|
||||
// aren't in one of the rooms this one is restricted to, ergo can't
|
||||
// check its state for the user's membership, and consequently the
|
||||
// user *might* be able to join if they ask another server.
|
||||
Err!(Request(UnableToAuthorizeJoin(
|
||||
"You do not belong to any of the recognised rooms or spaces required to join this \
|
||||
room, but this server is unable to verify every requirement. You may be able to \
|
||||
|
||||
@@ -173,9 +173,9 @@ async fn process_inbound_transaction(
|
||||
|
||||
debug!(pdus = body.pdus.len(), edus = body.edus.len(), "Processing transaction",);
|
||||
// We have an additional panic catch here because if there's a panic in the
|
||||
// handle, the sender will effectively become defederated until restart after
|
||||
// never being removed from the tracking map. Ideally the handle function
|
||||
// doesn't panic, but when has "ideally" ever worked for us.
|
||||
// handle, the sender will effectively become defederated until restart
|
||||
// after never being removed from the tracking map. Ideally the handle
|
||||
// function doesn't panic, but when has "ideally" ever worked for us.
|
||||
let handle_result =
|
||||
std::panic::AssertUnwindSafe(handle(&services, &body.identity, pdus, edus))
|
||||
.catch_unwind()
|
||||
@@ -319,9 +319,9 @@ async fn handle_room(
|
||||
.into_iter()
|
||||
.map(|(_, event_id, value)| (event_id, value))
|
||||
.collect();
|
||||
// Try to sort PDUs by their dependencies, but fall back to arbitrary order on
|
||||
// failure (e.g., cycles). This is best-effort; proper ordering is the sender's
|
||||
// responsibility.
|
||||
// Try to sort PDUs by their dependencies, but fall back to arbitrary order
|
||||
// on failure (e.g., cycles). This is best-effort; proper ordering is the
|
||||
// sender's responsibility.
|
||||
let sorted_event_ids = build_local_dag(&pdu_map, DagBuilderTree::PrevEvents)
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
|
||||
@@ -58,8 +58,8 @@ async fn create_join_event(
|
||||
.acl_check(origin, room_id)
|
||||
.await?;
|
||||
|
||||
// We need to return the state prior to joining, let's keep a reference to that
|
||||
// here
|
||||
// We need to return the state prior to joining, let's keep a reference to
|
||||
// that here
|
||||
let shortstatehash = services
|
||||
.rooms
|
||||
.state
|
||||
|
||||
Reference in new issue
Block a user