Cleaning up oauth providers conversion. (#5280)

* Cleaning up oauth providers conversion.

* Use into_iter
This commit is contained in:
Dessalines 2024-12-27 12:52:05 -05:00 committed by GitHub
parent cc190aefdf
commit 76034f058d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,13 +55,11 @@ impl OAuthProvider {
pub fn convert_providers_to_public(
oauth_providers: Vec<OAuthProvider>,
) -> Vec<PublicOAuthProvider> {
let mut result = Vec::<PublicOAuthProvider>::new();
for oauth_provider in &oauth_providers {
if oauth_provider.enabled {
result.push(PublicOAuthProvider(oauth_provider.clone()));
}
}
result
oauth_providers
.into_iter()
.filter(|x| x.enabled)
.map(PublicOAuthProvider)
.collect()
}
pub async fn get_all_public(pool: &mut DbPool<'_>) -> Result<Vec<PublicOAuthProvider>, Error> {