diff --git a/src/chat.rs b/src/chat.rs index 1c2d6ad554..9fed7cbc5d 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -3324,21 +3324,19 @@ pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()> AND chat_id=?", (MessageState::InNoticed, MessageState::InFresh, chat_id), )?; + // This is mainly for reactions. We don't select `InNoticed` messages because they are + // normally a result of `mark_old_messages_as_noticed()` which happens on all devices + // anyway. let mut stmt = conn.prepare( "SELECT id FROM msgs - WHERE state>=? AND state, _>>()?; Ok((nr_msgs_noticed, hidden_msgs)) }; diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 06ed60cdff..9044f8f82b 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -1070,6 +1070,19 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid); .await?; } + inc_and_check(&mut migration_version, 124)?; + if dbversion < migration_version { + // As now incoming reactions are added as hidden `InFresh` messages, just in case make + // existing hidden `InFresh` ones `InNoticed`. Currently we don't create such messages other + // than reactions, and even they are only becoming such now, but we can't inspect all + // previous core versions. + sql.execute_migration( + "UPDATE msgs SET state=13 WHERE state=10 AND hidden=1", + migration_version, + ) + .await?; + } + let new_version = sql .get_raw_config_int(VERSION_CFG) .await?