mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
refactor: Use Option::or_else() to dedup emitting IncomingWebxdcNotify
This commit is contained in:
@@ -417,14 +417,9 @@ impl Context {
|
|||||||
if from_id != ContactId::SELF {
|
if from_id != ContactId::SELF {
|
||||||
if let Some(notify_list) = status_update_item.notify {
|
if let Some(notify_list) = status_update_item.notify {
|
||||||
let self_addr = instance.get_webxdc_self_addr(self).await?;
|
let self_addr = instance.get_webxdc_self_addr(self).await?;
|
||||||
if let Some(notify_text) = notify_list.get(&self_addr) {
|
if let Some(notify_text) =
|
||||||
self.emit_event(EventType::IncomingWebxdcNotify {
|
notify_list.get(&self_addr).or_else(|| notify_list.get("*"))
|
||||||
contact_id: from_id,
|
{
|
||||||
msg_id: notify_msg_id,
|
|
||||||
text: notify_text.clone(),
|
|
||||||
href: status_update_item.href,
|
|
||||||
});
|
|
||||||
} else if let Some(notify_text) = notify_list.get("*") {
|
|
||||||
self.emit_event(EventType::IncomingWebxdcNotify {
|
self.emit_event(EventType::IncomingWebxdcNotify {
|
||||||
contact_id: from_id,
|
contact_id: from_id,
|
||||||
msg_id: notify_msg_id,
|
msg_id: notify_msg_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user