mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
style: Run formatting
This commit is contained in:
9 files changed
+106
-69
No files matched your search
@@ -571,7 +571,8 @@ impl Service {
|
||||
));
|
||||
}
|
||||
|
||||
let device_id = self.services
|
||||
let device_id = self
|
||||
.services
|
||||
.users
|
||||
.create_device(
|
||||
&authorizing_user,
|
||||
|
||||
@@ -72,7 +72,10 @@ impl std::fmt::Display for ValidTokenSource {
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
let registration_tokens_from_file = args.server.config.registration_token_file
|
||||
let registration_tokens_from_file = args
|
||||
.server
|
||||
.config
|
||||
.registration_token_file
|
||||
.clone()
|
||||
// If the token file option was set, read the path it points to
|
||||
.map(std::fs::read_to_string)
|
||||
@@ -80,7 +83,8 @@ impl crate::Service for Service {
|
||||
.map_err(|err| err!("Failed to read registration token file: {err}"))
|
||||
.map(|tokens| {
|
||||
if let Some(tokens) = tokens {
|
||||
// If the token file option was set, return the file's lines as tokens
|
||||
// If the token file option was set, return the file's lines
|
||||
// as tokens
|
||||
tokens.lines().map(ToOwned::to_owned).collect()
|
||||
} else {
|
||||
// Otherwise, if the option wasn't set, return no tokens
|
||||
|
||||
@@ -164,12 +164,12 @@ impl Service {
|
||||
}
|
||||
|
||||
let mut children: Vec<_> = summary
|
||||
.children_state
|
||||
.iter()
|
||||
// Ignore deserialization failures
|
||||
.flat_map(Raw::deserialize)
|
||||
// Filter out non-suggested children if suggested_only is set
|
||||
.filter(|child| !suggested_only || child.content.suggested)
|
||||
.children_state
|
||||
.iter()
|
||||
// Ignore deserialization failures
|
||||
.flat_map(Raw::deserialize)
|
||||
// Filter out non-suggested children if suggested_only is set
|
||||
.filter(|child| !suggested_only || child.content.suggested)
|
||||
.collect();
|
||||
children.sort();
|
||||
let children = children
|
||||
@@ -323,43 +323,46 @@ impl Service {
|
||||
};
|
||||
|
||||
let (accessible_children, inaccessible_children) = children_state
|
||||
.iter()
|
||||
// Ignore deserialization failures
|
||||
.flat_map(Raw::deserialize)
|
||||
// Fetch summaries for the children in parallel
|
||||
.stream()
|
||||
.broad_then(async |child| {
|
||||
let summary = {
|
||||
if let Some(summary) = self.build_local_room_summary(&child.state_key).await {
|
||||
if self.server_may_see_summary(querying_server, &summary).await {
|
||||
Accessibility::Accessible(summary)
|
||||
} else {
|
||||
Accessibility::Inaccessible
|
||||
}
|
||||
} else {
|
||||
Accessibility::NotFound
|
||||
}
|
||||
};
|
||||
.iter()
|
||||
// Ignore deserialization failures
|
||||
.flat_map(Raw::deserialize)
|
||||
// Fetch summaries for the children in parallel
|
||||
.stream()
|
||||
.broad_then(async |child| {
|
||||
let summary = {
|
||||
if let Some(summary) = self.build_local_room_summary(&child.state_key).await {
|
||||
if self.server_may_see_summary(querying_server, &summary).await {
|
||||
Accessibility::Accessible(summary)
|
||||
} else {
|
||||
Accessibility::Inaccessible
|
||||
}
|
||||
} else {
|
||||
Accessibility::NotFound
|
||||
}
|
||||
};
|
||||
|
||||
(child.state_key, summary)
|
||||
})
|
||||
// Sort the children into two Vecs by accessibility
|
||||
.ready_fold_default(|(mut accessible_children, mut inaccessible_children): (Vec<_>, Vec<_>), (room_id, summary)| {
|
||||
match summary {
|
||||
Accessibility::Accessible(summary) => {
|
||||
accessible_children.push(summary);
|
||||
},
|
||||
Accessibility::Inaccessible => {
|
||||
inaccessible_children.push(room_id);
|
||||
},
|
||||
Accessibility::NotFound => {
|
||||
// Skip inaccessible children
|
||||
}
|
||||
}
|
||||
(child.state_key, summary)
|
||||
})
|
||||
// Sort the children into two Vecs by accessibility
|
||||
.ready_fold_default(
|
||||
|(mut accessible_children, mut inaccessible_children): (Vec<_>, Vec<_>),
|
||||
(room_id, summary)| {
|
||||
match summary {
|
||||
| Accessibility::Accessible(summary) => {
|
||||
accessible_children.push(summary);
|
||||
},
|
||||
| Accessibility::Inaccessible => {
|
||||
inaccessible_children.push(room_id);
|
||||
},
|
||||
| Accessibility::NotFound => {
|
||||
// Skip inaccessible children
|
||||
},
|
||||
}
|
||||
|
||||
(accessible_children, inaccessible_children)
|
||||
})
|
||||
.await;
|
||||
(accessible_children, inaccessible_children)
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
Accessibility::Accessible(assign!(
|
||||
get_hierarchy::v1::Response::new(SpaceHierarchyParentSummary::new(summary, children_state)),
|
||||
|
||||
@@ -449,7 +449,12 @@ impl super::Service {
|
||||
// Don't notify the sender of their own events, and don't send from ignored users
|
||||
.ready_filter(|user| *user != pdu.sender())
|
||||
.filter_map(|recipient_user| async move {
|
||||
(!self.services.users.user_is_ignored(pdu.sender(), &recipient_user).await).then_some(recipient_user)
|
||||
(!self
|
||||
.services
|
||||
.users
|
||||
.user_is_ignored(pdu.sender(), &recipient_user)
|
||||
.await)
|
||||
.then_some(recipient_user)
|
||||
})
|
||||
.collect()
|
||||
.await;
|
||||
@@ -806,7 +811,7 @@ impl super::Service {
|
||||
.read()
|
||||
.await
|
||||
.values()
|
||||
.map(ToOwned::to_owned) // TODO: is this to_owned expensive?
|
||||
.map(ToOwned::to_owned) // TODO: is this to_owned expensive?
|
||||
.collect::<Vec<_>>();
|
||||
interested_appservices
|
||||
.stream()
|
||||
|
||||
@@ -449,7 +449,12 @@ impl super::Service {
|
||||
.rooms_joined(user_id)
|
||||
// Don't send key updates to unencrypted rooms
|
||||
.filter_map(async |room_id| {
|
||||
if self.services.state_accessor.is_encrypted_room(&room_id).await {
|
||||
if self
|
||||
.services
|
||||
.state_accessor
|
||||
.is_encrypted_room(&room_id)
|
||||
.await
|
||||
{
|
||||
Some(room_id)
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user