fix: contact::set_blocked(): Don't fail on sync errors, just log them

Multi-device synchronisation is not critical and should not fail the local operation, in other
places sync errors are already ignored.
This commit is contained in:
iequidoo
2024-01-09 14:30:29 -03:00
committed by iequidoo
parent 20065d3daa
commit bb47299ee4
2 changed files with 11 additions and 9 deletions

View File

@@ -2104,7 +2104,7 @@ impl Chat {
}
}
async fn sync(context: &Context, id: SyncId, action: SyncAction) -> Result<()> {
pub(crate) async fn sync(context: &Context, id: SyncId, action: SyncAction) -> Result<()> {
context
.add_sync_item(SyncData::AlterChat { id, action })
.await?;

View File

@@ -26,13 +26,14 @@ use crate::constants::{Blocked, Chattype, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY}
use crate::context::Context;
use crate::events::EventType;
use crate::key::{load_self_public_key, DcKey};
use crate::log::LogExt;
use crate::login_param::LoginParam;
use crate::message::MessageState;
use crate::mimeparser::AvatarAction;
use crate::param::{Param, Params};
use crate::peerstate::Peerstate;
use crate::sql::{self, params_iter};
use crate::sync::{self, Sync::*, SyncData};
use crate::sync::{self, Sync::*};
use crate::tools::{
duration_to_str, get_abs_path, improve_single_line_input, strip_rtlo_characters, time,
EmailAddress,
@@ -1497,13 +1498,14 @@ WHERE type=? AND id IN (
true => chat::SyncAction::Block,
false => chat::SyncAction::Unblock,
};
context
.add_sync_item(SyncData::AlterChat {
id: chat::SyncId::ContactAddr(contact.addr.clone()),
action,
})
.await?;
context.send_sync_msg().await?;
chat::sync(
context,
chat::SyncId::ContactAddr(contact.addr.clone()),
action,
)
.await
.log_err(context)
.ok();
}
}