mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
feat: Sync Config::Selfstatus across devices (#4893)
Use sync messages for that as it is done for e.g. Config::Displayname. Maybe we need to remove self-status synchronisation via usual messages then, but let's think of it a bit.
This commit is contained in:
@@ -375,7 +375,11 @@ impl Config {
|
||||
}
|
||||
matches!(
|
||||
self,
|
||||
Self::Displayname | Self::MdnsEnabled | Self::ShowEmails | Self::Selfavatar,
|
||||
Self::Displayname
|
||||
| Self::MdnsEnabled
|
||||
| Self::ShowEmails
|
||||
| Self::Selfavatar
|
||||
| Self::Selfstatus,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -969,14 +973,19 @@ mod tests {
|
||||
assert!(alice1.get_config_bool(Config::MdnsEnabled).await?);
|
||||
|
||||
// Usual sync scenario.
|
||||
alice0
|
||||
.set_config(Config::Displayname, Some("Alice Sync"))
|
||||
.await?;
|
||||
sync(&alice0, &alice1).await;
|
||||
assert_eq!(
|
||||
alice1.get_config(Config::Displayname).await?,
|
||||
Some("Alice Sync".to_string())
|
||||
);
|
||||
async fn test_config_str(
|
||||
alice0: &TestContext,
|
||||
alice1: &TestContext,
|
||||
key: Config,
|
||||
val: &str,
|
||||
) -> Result<()> {
|
||||
alice0.set_config(key, Some(val)).await?;
|
||||
sync(alice0, alice1).await;
|
||||
assert_eq!(alice1.get_config(key).await?, Some(val.to_string()));
|
||||
Ok(())
|
||||
}
|
||||
test_config_str(&alice0, &alice1, Config::Displayname, "Alice Sync").await?;
|
||||
test_config_str(&alice0, &alice1, Config::Selfstatus, "My status").await?;
|
||||
|
||||
assert!(alice0.get_config(Config::Selfavatar).await?.is_none());
|
||||
let file = alice0.dir.path().join("avatar.png");
|
||||
|
||||
Reference in New Issue
Block a user