mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-03 16:51:35 +00:00
Cleaning up oauth providers conversion. (#5280)
* Cleaning up oauth providers conversion. * Use into_iter
This commit is contained in:
parent
cc190aefdf
commit
76034f058d
1 changed files with 5 additions and 7 deletions
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue