mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
refactor: create_status_update_record: Get rid of notify var
It's used in the only place. Also this way `get_webxdc_self_addr()` which makes a db query is only called when necessary.
This commit is contained in:
@@ -326,12 +326,6 @@ impl Context {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
|
||||||
let notify = if let Some(notify_list) = status_update_item.notify {
|
|
||||||
let self_addr = instance.get_webxdc_self_addr(self).await?;
|
|
||||||
notify_list.contains(&self_addr)
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
};
|
|
||||||
let mut notify_msg_id = instance.id;
|
let mut notify_msg_id = instance.id;
|
||||||
let mut notify_text = "".to_string();
|
let mut notify_text = "".to_string();
|
||||||
let mut param_changed = false;
|
let mut param_changed = false;
|
||||||
@@ -412,12 +406,17 @@ impl Context {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if notify && !notify_text.is_empty() && from_id != ContactId::SELF {
|
if !notify_text.is_empty() && from_id != ContactId::SELF {
|
||||||
self.emit_event(EventType::IncomingWebxdcNotify {
|
if let Some(notify_list) = status_update_item.notify {
|
||||||
contact_id: from_id,
|
let self_addr = instance.get_webxdc_self_addr(self).await?;
|
||||||
msg_id: notify_msg_id,
|
if notify_list.contains(&self_addr) {
|
||||||
text: notify_text,
|
self.emit_event(EventType::IncomingWebxdcNotify {
|
||||||
});
|
contact_id: from_id,
|
||||||
|
msg_id: notify_msg_id,
|
||||||
|
text: notify_text,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some(status_update_serial))
|
Ok(Some(status_update_serial))
|
||||||
|
|||||||
Reference in New Issue
Block a user