@@ -54,6 +54,9 @@ pub struct ReceivedMsg {
54
54
/// Received message state.
55
55
pub state : MessageState ,
56
56
57
+ /// Whether the message is hidden.
58
+ pub hidden : bool ,
59
+
57
60
/// Message timestamp for sorting.
58
61
pub sort_timestamp : i64 ,
59
62
@@ -192,6 +195,7 @@ pub(crate) async fn receive_imf_inner(
192
195
return Ok ( Some ( ReceivedMsg {
193
196
chat_id : DC_CHAT_ID_TRASH ,
194
197
state : MessageState :: Undefined ,
198
+ hidden : false ,
195
199
sort_timestamp : 0 ,
196
200
msg_ids,
197
201
needs_delete_job : false ,
@@ -385,6 +389,7 @@ pub(crate) async fn receive_imf_inner(
385
389
received_msg = Some ( ReceivedMsg {
386
390
chat_id : DC_CHAT_ID_TRASH ,
387
391
state : MessageState :: InSeen ,
392
+ hidden : false ,
388
393
sort_timestamp : mime_parser. timestamp_sent ,
389
394
msg_ids : vec ! [ msg_id] ,
390
395
needs_delete_job : res == securejoin:: HandshakeMessage :: Done ,
@@ -621,7 +626,7 @@ pub(crate) async fn receive_imf_inner(
621
626
622
627
if let Some ( replace_chat_id) = replace_chat_id {
623
628
context. emit_msgs_changed_without_msg_id ( replace_chat_id) ;
624
- } else if !chat_id. is_trash ( ) {
629
+ } else if !chat_id. is_trash ( ) && !received_msg . hidden {
625
630
let fresh = received_msg. state == MessageState :: InFresh ;
626
631
for msg_id in & received_msg. msg_ids {
627
632
chat_id. emit_msg_event ( context, * msg_id, mime_parser. incoming && fresh) ;
@@ -1037,8 +1042,6 @@ async fn add_parts(
1037
1042
// No check for `hidden` because only reactions are such and they should be `InFresh`.
1038
1043
{
1039
1044
MessageState :: InSeen
1040
- } else if is_reaction {
1041
- MessageState :: InNoticed
1042
1045
} else {
1043
1046
MessageState :: InFresh
1044
1047
} ;
@@ -1699,7 +1702,7 @@ RETURNING id
1699
1702
"Message has {icnt} parts and is assigned to chat #{chat_id}."
1700
1703
) ;
1701
1704
1702
- if !chat_id. is_trash ( ) {
1705
+ if !chat_id. is_trash ( ) && !hidden {
1703
1706
let mut chat = Chat :: load_from_db ( context, chat_id) . await ?;
1704
1707
1705
1708
// In contrast to most other update-timestamps,
@@ -1737,6 +1740,7 @@ RETURNING id
1737
1740
Ok ( ReceivedMsg {
1738
1741
chat_id,
1739
1742
state,
1743
+ hidden,
1740
1744
sort_timestamp,
1741
1745
msg_ids : created_db_entries,
1742
1746
needs_delete_job,
0 commit comments