refactor(appservices): avoid cloning frequently

This commit is contained in:
Matthias Ahouansou 2024-03-22 18:27:14 +00:00
parent 5c650bb67e
commit b20483aa13
No known key found for this signature in database
7 changed files with 44 additions and 40 deletions

View file

@ -80,10 +80,11 @@ where
let mut json_body = serde_json::from_slice::<CanonicalJsonValue>(&body).ok();
let appservices = services().appservice.all().await;
let appservice_registration = appservices
.iter()
.find(|info| Some(info.registration.as_token.as_str()) == token);
let appservice_registration = if let Some(token) = token {
services().appservice.find_from_token(token).await
} else {
None
};
let (sender_user, sender_device, sender_servername, from_appservice) =
if let Some(info) = appservice_registration {