diff --git a/protocol/message_persistence.go b/protocol/message_persistence.go index cab30b008..6e819e20a 100644 --- a/protocol/message_persistence.go +++ b/protocol/message_persistence.go @@ -1456,7 +1456,7 @@ func (db sqlitePersistence) MarkAllRead(chatID string, clock uint64) (int64, int _ = tx.Rollback() }() - seenResult, err := tx.Exec(`UPDATE user_messages SET seen = 1 WHERE local_chat_id = ? AND not(seen) AND clock_value <= ? AND not(mentioned)`, chatID, clock) + seenResult, err := tx.Exec(`UPDATE user_messages SET seen = 1 WHERE local_chat_id = ? AND seen = 0 AND clock_value <= ? AND not(mentioned)`, chatID, clock) if err != nil { return 0, 0, err } @@ -1466,7 +1466,7 @@ func (db sqlitePersistence) MarkAllRead(chatID string, clock uint64) (int64, int return 0, 0, err } - mentionedResult, err := tx.Exec(`UPDATE user_messages SET seen = 1 WHERE local_chat_id = ? AND not(seen) AND clock_value <= ? AND mentioned`, chatID, clock) + mentionedResult, err := tx.Exec(`UPDATE user_messages SET seen = 1 WHERE local_chat_id = ? AND seen = 0 AND clock_value <= ? AND mentioned`, chatID, clock) if err != nil { return 0, 0, err }