set message-info-type also for unpromoted protect/unprotect messages so that UI can show a shield-icon or sth. line that

This commit is contained in:
B. Petersen
2020-10-17 21:31:09 +02:00
parent 546e8dedce
commit 3d108fedc4

View File

@@ -240,18 +240,19 @@ impl ChatId {
from_id: u32, from_id: u32,
) -> Result<(), Error> { ) -> Result<(), Error> {
let msg_text = context.stock_protection_msg(protect, from_id).await; let msg_text = context.stock_protection_msg(protect, from_id).await;
let cmd = match protect {
ProtectionStatus::Protected => SystemMessage::ChatProtectionEnabled,
ProtectionStatus::Unprotected => SystemMessage::ChatProtectionDisabled,
};
if promote { if promote {
let mut msg = Message::default(); let mut msg = Message::default();
msg.viewtype = Viewtype::Text; msg.viewtype = Viewtype::Text;
msg.text = Some(msg_text); msg.text = Some(msg_text);
msg.param.set_cmd(match protect { msg.param.set_cmd(cmd);
ProtectionStatus::Protected => SystemMessage::ChatProtectionEnabled,
ProtectionStatus::Unprotected => SystemMessage::ChatProtectionDisabled,
});
send_msg(context, self, &mut msg).await?; send_msg(context, self, &mut msg).await?;
} else { } else {
add_info_msg(context, self, msg_text).await; add_info_msg_with_cmd(context, self, msg_text, cmd).await?;
} }
Ok(()) Ok(())