mirror of
https://github.com/chatmail/core.git
synced 2026-08-18 06:36:29 +03:00
refactor: Protect against 'nauta.cu' misspellings
This commit is contained in:
@@ -744,13 +744,20 @@ pub(crate) async fn delete_expired_imap_messages(
|
||||
}
|
||||
|
||||
pub(crate) async fn is_nauta(context: &Context, transport_id: u32) -> Result<bool> {
|
||||
let nauta_id = "nauta.cu";
|
||||
debug_assert!({
|
||||
// Check that the "nauta.cu" ID was spelled correctly:
|
||||
let nauta = crate::provider::get_provider_by_id(nauta_id);
|
||||
nauta.is_some_and(|p| p.id == nauta_id)
|
||||
});
|
||||
|
||||
let is_nauta = crate::transport::ConfiguredLoginParam::load_all(context)
|
||||
.await?
|
||||
.iter()
|
||||
.filter(|(tid, _)| *tid == transport_id)
|
||||
.filter_map(|(_, param)| param.provider)
|
||||
.next()
|
||||
.is_some_and(|provider| provider.id == "nauta.cu");
|
||||
.is_some_and(|provider| provider.id == nauta_id);
|
||||
Ok(is_nauta)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user