From 3d108fedc4accff3f098790269cfe58b5b5f0873 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 17 Oct 2020 21:31:09 +0200 Subject: [PATCH] set message-info-type also for unpromoted protect/unprotect messages so that UI can show a shield-icon or sth. line that --- src/chat.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index cbe167531..caed3fa60 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -240,18 +240,19 @@ impl ChatId { from_id: u32, ) -> Result<(), Error> { 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 { let mut msg = Message::default(); msg.viewtype = Viewtype::Text; msg.text = Some(msg_text); - msg.param.set_cmd(match protect { - ProtectionStatus::Protected => SystemMessage::ChatProtectionEnabled, - ProtectionStatus::Unprotected => SystemMessage::ChatProtectionDisabled, - }); + msg.param.set_cmd(cmd); send_msg(context, self, &mut msg).await?; } else { - add_info_msg(context, self, msg_text).await; + add_info_msg_with_cmd(context, self, msg_text, cmd).await?; } Ok(())