mirror of
https://github.com/chatmail/core.git
synced 2026-08-14 12:59:36 +03:00
feat: On Nauta, continue deleting messages immediately in single-device mode
This commit is contained in:
@@ -171,7 +171,8 @@ pub(crate) async fn download_msg(
|
||||
Box::pin(session.fetch_single_msg(context, &server_folder, server_uid, rfc724_mid)).await?;
|
||||
|
||||
let bcc_self = context.get_config_bool(Config::BccSelf).await?;
|
||||
if ephemeral::should_delete_all_downloaded_messages(bcc_self, session.is_chatmail()) {
|
||||
let is_nauta = ephemeral::is_nauta(context, transport_id).await?;
|
||||
if ephemeral::should_delete_all_downloaded_messages(bcc_self, session.is_chatmail(), is_nauta) {
|
||||
// Now that the message was downloaded, it likely needs to be deleted;
|
||||
// trigger a re-check by interrupting the inbox folder.
|
||||
// This is mainly needed to make the tests pass;
|
||||
|
||||
@@ -664,7 +664,9 @@ pub(crate) async fn delete_expired_imap_messages(
|
||||
let now = time();
|
||||
|
||||
let bcc_self = context.get_config_bool(Config::BccSelf).await?;
|
||||
if should_delete_all_downloaded_messages(bcc_self, is_chatmail) {
|
||||
let is_nauta = is_nauta(context, transport_id).await?;
|
||||
|
||||
if should_delete_all_downloaded_messages(bcc_self, is_chatmail, is_nauta) {
|
||||
// This is the only device using this relay.
|
||||
// Mark all downloaded messages for deletion, because they are not needed anymore.
|
||||
//
|
||||
@@ -741,8 +743,23 @@ pub(crate) async fn delete_expired_imap_messages(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn should_delete_all_downloaded_messages(bcc_self: bool, is_chatmail: bool) -> bool {
|
||||
!bcc_self && is_chatmail
|
||||
pub(crate) async fn is_nauta(context: &Context, transport_id: u32) -> Result<bool> {
|
||||
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");
|
||||
Ok(is_nauta)
|
||||
}
|
||||
|
||||
pub(crate) fn should_delete_all_downloaded_messages(
|
||||
bcc_self: bool,
|
||||
is_chatmail: bool,
|
||||
is_nauta: bool,
|
||||
) -> bool {
|
||||
!bcc_self && (is_chatmail || is_nauta)
|
||||
}
|
||||
|
||||
/// Start ephemeral timers for seen messages if they are not started
|
||||
|
||||
Reference in New Issue
Block a user