mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 17:07:21 +00:00
fix a issue that the unread count can be negative
This commit is contained in:
parent
9dcc5dd848
commit
4f89c33676
@ -297,7 +297,7 @@ public class ThreadDatabase extends Database {
|
|||||||
public void decrementUnread(long threadId, int amount) {
|
public void decrementUnread(long threadId, int amount) {
|
||||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||||
db.execSQL("UPDATE " + TABLE_NAME + " SET " + READ + " = 0, " +
|
db.execSQL("UPDATE " + TABLE_NAME + " SET " + READ + " = 0, " +
|
||||||
UNREAD_COUNT + " = " + UNREAD_COUNT + " - ? WHERE " + ID + " = ?",
|
UNREAD_COUNT + " = " + UNREAD_COUNT + " - ? WHERE " + ID + " = ? AND " + UNREAD_COUNT + " > 0",
|
||||||
new String[] {String.valueOf(amount),
|
new String[] {String.valueOf(amount),
|
||||||
String.valueOf(threadId)});
|
String.valueOf(threadId)});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user