mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
refactor(set_protection_for_timestamp_sort): do not log bubbled up errors
Otherwise error may be logged twice.
This commit is contained in:
22
src/chat.rs
22
src/chat.rs
@@ -589,20 +589,16 @@ impl ChatId {
|
|||||||
timestamp_sort: i64,
|
timestamp_sort: i64,
|
||||||
contact_id: Option<ContactId>,
|
contact_id: Option<ContactId>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match self.inner_set_protection(context, protect).await {
|
let protection_status_modified = self
|
||||||
Ok(protection_status_modified) => {
|
.inner_set_protection(context, protect)
|
||||||
if protection_status_modified {
|
.await
|
||||||
self.add_protection_msg(context, protect, contact_id, timestamp_sort)
|
.with_context(|| format!("Cannot set protection for {self}"))?;
|
||||||
.await?;
|
if protection_status_modified {
|
||||||
chatlist_events::emit_chatlist_item_changed(context, self);
|
self.add_protection_msg(context, protect, contact_id, timestamp_sort)
|
||||||
}
|
.await?;
|
||||||
Ok(())
|
chatlist_events::emit_chatlist_item_changed(context, self);
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
error!(context, "Cannot set protection: {e:#}."); // make error user-visible
|
|
||||||
Err(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets protection and sends or adds a message.
|
/// Sets protection and sends or adds a message.
|
||||||
|
|||||||
Reference in New Issue
Block a user