mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
refactor: use get_configured_provider() in ConfiguredLoginParam::load()
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::config::Config;
|
|||||||
use crate::constants::{DC_LP_AUTH_FLAGS, DC_LP_AUTH_NORMAL, DC_LP_AUTH_OAUTH2};
|
use crate::constants::{DC_LP_AUTH_FLAGS, DC_LP_AUTH_NORMAL, DC_LP_AUTH_OAUTH2};
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::net::load_connection_timestamp;
|
use crate::net::load_connection_timestamp;
|
||||||
use crate::provider::{get_provider_by_id, Protocol, Provider, Socket, UsernamePattern};
|
use crate::provider::{Protocol, Provider, Socket, UsernamePattern};
|
||||||
use crate::socks::Socks5Config;
|
use crate::socks::Socks5Config;
|
||||||
use crate::sql::Sql;
|
use crate::sql::Sql;
|
||||||
|
|
||||||
@@ -435,10 +435,7 @@ impl ConfiguredLoginParam {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let oauth2 = matches!(server_flags & DC_LP_AUTH_FLAGS, DC_LP_AUTH_OAUTH2);
|
let oauth2 = matches!(server_flags & DC_LP_AUTH_FLAGS, DC_LP_AUTH_OAUTH2);
|
||||||
|
|
||||||
let provider = context
|
let provider = context.get_configured_provider().await?;
|
||||||
.get_config(Config::ConfiguredProvider)
|
|
||||||
.await?
|
|
||||||
.and_then(|provider_id| get_provider_by_id(&provider_id));
|
|
||||||
|
|
||||||
let imap;
|
let imap;
|
||||||
let smtp;
|
let smtp;
|
||||||
@@ -672,6 +669,7 @@ impl ConfiguredLoginParam {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::provider::get_provider_by_id;
|
||||||
use crate::test_utils::TestContext;
|
use crate::test_utils::TestContext;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user