mirror of
https://github.com/chatmail/core.git
synced 2026-05-14 04:16:30 +03:00
feat: Sync Config::MvboxMove across devices (#5680)
NB: We don't restart IO from the synchronisation code, so `MvboxMove` isn't effective immediately if `ConfiguredMvboxFolder` is unset, but only after a reconnect to IMAP.
This commit is contained in:
@@ -378,14 +378,14 @@ impl Config {
|
|||||||
/// multiple users are sharing an account. Another example is `Self::SyncMsgs` itself which
|
/// multiple users are sharing an account. Another example is `Self::SyncMsgs` itself which
|
||||||
/// mustn't be controlled by other devices.
|
/// mustn't be controlled by other devices.
|
||||||
pub(crate) fn is_synced(&self) -> bool {
|
pub(crate) fn is_synced(&self) -> bool {
|
||||||
// We don't restart IO from the synchronisation code, so this is to be on the safe side.
|
// NB: We don't restart IO from the synchronisation code, so `MvboxMove` isn't effective
|
||||||
if self.needs_io_restart() {
|
// immediately if `ConfiguredMvboxFolder` is unset, but only after a reconnect (see
|
||||||
return false;
|
// `Imap::prepare()`).
|
||||||
}
|
|
||||||
matches!(
|
matches!(
|
||||||
self,
|
self,
|
||||||
Self::Displayname
|
Self::Displayname
|
||||||
| Self::MdnsEnabled
|
| Self::MdnsEnabled
|
||||||
|
| Self::MvboxMove
|
||||||
| Self::ShowEmails
|
| Self::ShowEmails
|
||||||
| Self::Selfavatar
|
| Self::Selfavatar
|
||||||
| Self::Selfstatus,
|
| Self::Selfstatus,
|
||||||
@@ -981,15 +981,12 @@ mod tests {
|
|||||||
sync(&alice0, &alice1).await;
|
sync(&alice0, &alice1).await;
|
||||||
assert_eq!(alice1.get_config_bool(Config::MdnsEnabled).await?, false);
|
assert_eq!(alice1.get_config_bool(Config::MdnsEnabled).await?, false);
|
||||||
|
|
||||||
let show_emails = alice0.get_config_bool(Config::ShowEmails).await?;
|
for key in [Config::ShowEmails, Config::MvboxMove] {
|
||||||
alice0
|
let val = alice0.get_config_bool(key).await?;
|
||||||
.set_config_bool(Config::ShowEmails, !show_emails)
|
alice0.set_config_bool(key, !val).await?;
|
||||||
.await?;
|
sync(&alice0, &alice1).await;
|
||||||
sync(&alice0, &alice1).await;
|
assert_eq!(alice1.get_config_bool(key).await?, !val);
|
||||||
assert_eq!(
|
}
|
||||||
alice1.get_config_bool(Config::ShowEmails).await?,
|
|
||||||
!show_emails
|
|
||||||
);
|
|
||||||
|
|
||||||
// `Config::SyncMsgs` mustn't be synced.
|
// `Config::SyncMsgs` mustn't be synced.
|
||||||
alice0.set_config_bool(Config::SyncMsgs, false).await?;
|
alice0.set_config_bool(Config::SyncMsgs, false).await?;
|
||||||
|
|||||||
@@ -1346,7 +1346,7 @@ impl Context {
|
|||||||
Ok(sentbox.as_deref() == Some(folder_name))
|
Ok(sentbox.as_deref() == Some(folder_name))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if given folder name is the name of the "Delta Chat" folder.
|
/// Returns true if given folder name is the name of the "DeltaChat" folder.
|
||||||
pub async fn is_mvbox(&self, folder_name: &str) -> Result<bool> {
|
pub async fn is_mvbox(&self, folder_name: &str) -> Result<bool> {
|
||||||
let mvbox = self.get_config(Config::ConfiguredMvboxFolder).await?;
|
let mvbox = self.get_config(Config::ConfiguredMvboxFolder).await?;
|
||||||
Ok(mvbox.as_deref() == Some(folder_name))
|
Ok(mvbox.as_deref() == Some(folder_name))
|
||||||
|
|||||||
Reference in New Issue
Block a user