performance: skip a costly call to chat.why_cant_send_ex()

This commit is contained in:
B. Petersen
2026-04-19 13:55:53 +02:00
parent 1eef44e790
commit b42f558801

View File

@@ -2691,9 +2691,7 @@ async fn prepare_send_msg(
CantSendReason::InBroadcast => { CantSendReason::InBroadcast => {
matches!( matches!(
msg.param.get_cmd(), msg.param.get_cmd(),
SystemMessage::MemberRemovedFromGroup SystemMessage::MemberRemovedFromGroup | SystemMessage::SecurejoinMessage
| SystemMessage::SecurejoinMessage
| SystemMessage::WebxdcStatusUpdate
) )
} }
CantSendReason::MissingKey => msg CantSendReason::MissingKey => msg
@@ -2702,7 +2700,9 @@ async fn prepare_send_msg(
.unwrap_or_default(), .unwrap_or_default(),
_ => false, _ => false,
}; };
if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? { if msg.param.get_cmd() == SystemMessage::WebxdcStatusUpdate {
// Already checked in `send_webxdc_status_update_struct()`.
} else if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? {
bail!("Cannot prepare sending to {chat_id}: {reason}"); bail!("Cannot prepare sending to {chat_id}: {reason}");
} }