Skip to content

Commit 27a1244

Browse files
committed
2squash: Optimize another SQL statement
1 parent b35dc50 commit 27a1244

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/chat.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3352,11 +3352,13 @@ pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()>
33523352
.filter(|&(_, state)| state == MessageState::InFresh)
33533353
.map(|(id, _)| id);
33543354

3355+
// NB: Enumerate `hidden` values to employ `msgs_index7`.
33553356
let nr_msgs_noticed = conn.execute(
33563357
"UPDATE msgs
33573358
SET state=?
33583359
WHERE state=?
3359-
AND chat_id=?",
3360+
AND (hidden=0 OR hidden=1)
3361+
AND chat_id=?",
33603362
(MessageState::InNoticed, MessageState::InFresh, chat_id),
33613363
)?;
33623364
Ok((nr_msgs_noticed, id_to_markseen))

0 commit comments

Comments
 (0)