fix: Emit MsgsChanged, not IncomingMsg, for messages only having special parts (#8157)

An example of such messages is location-only messages.

Co-authored-by: Hocuri <hocuri@gmx.de>
This commit is contained in:
iequidoo
2026-04-24 20:26:27 -03:00
committed by iequidoo
parent 4a16c0c3dd
commit 4d537544ef
3 changed files with 49 additions and 4 deletions

View File

@@ -1019,8 +1019,15 @@ UPDATE msgs SET state=? WHERE
let is_bot = context.get_config_bool(Config::Bot).await?;
let is_pre_message = matches!(mime_parser.pre_message, PreMessageMode::Pre { .. });
let skip_bot_notify = is_bot && is_pre_message;
let important =
mime_parser.incoming && fresh && !is_old_contact_request && !skip_bot_notify;
let is_empty = !is_pre_message
&& mime_parser.parts.first().is_none_or(|p| {
p.typ == Viewtype::Text && p.msg.is_empty() && p.param.get(Param::Quote).is_none()
});
let important = mime_parser.incoming
&& !is_empty
&& fresh
&& !is_old_contact_request
&& !skip_bot_notify;
for msg_id in &received_msg.msg_ids {
chat_id.emit_msg_event(context, *msg_id, important);