feat: Sync contact creation/rename across devices (#5163)

Use `chat::SyncAction::Rename` for that. Anyway 1:1-s can't be renamed and a separate sync action
would only complicate the code.
This commit is contained in:
iequidoo
2024-01-09 15:41:02 -03:00
committed by iequidoo
parent bb47299ee4
commit 924d5b9377
2 changed files with 52 additions and 0 deletions

View File

@@ -4398,6 +4398,10 @@ impl Context {
pub(crate) async fn sync_alter_chat(&self, id: &SyncId, action: &SyncAction) -> Result<()> {
let chat_id = match id {
SyncId::ContactAddr(addr) => {
if let SyncAction::Rename(to) = action {
Contact::create_ex(self, Nosync, to, addr).await?;
return Ok(());
}
let contact_id = Contact::lookup_id_by_addr_ex(self, addr, Origin::Unknown, None)
.await?
.with_context(|| format!("No contact for addr '{addr}'"))?;