From c25795fa53aa2e822697ae5d1bc9a37eaae0de3d Mon Sep 17 00:00:00 2001 From: ceokot Date: Tue, 7 Dec 2021 06:39:31 +0200 Subject: [PATCH] fix: Include empty open groups in the conversation list query --- .../thoughtcrime/securesms/database/ThreadDatabase.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java index 5f4224c811..f2adb05546 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -17,6 +17,9 @@ */ package org.thoughtcrime.securesms.database; +import static org.session.libsession.utilities.GroupUtil.OPEN_GROUP_PREFIX; +import static org.thoughtcrime.securesms.database.GroupDatabase.GROUP_ID; + import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -374,7 +377,9 @@ public class ThreadDatabase extends Database { private Cursor getConversationList(String archived) { SQLiteDatabase db = databaseHelper.getReadableDatabase(); - String query = createQuery(ARCHIVED + " = ? AND " + MESSAGE_COUNT + " != 0", 0); + String where = "(" + MESSAGE_COUNT + " != 0 OR " + GroupDatabase.TABLE_NAME + "." + GROUP_ID + " LIKE '" + OPEN_GROUP_PREFIX + "%') " + + "AND " + ARCHIVED + " = ?"; + String query = createQuery(where, 0); Cursor cursor = db.rawQuery(query, new String[]{archived}); setNotifyConverationListListeners(cursor); @@ -615,7 +620,7 @@ public class ThreadDatabase extends Database { " LEFT OUTER JOIN " + RecipientDatabase.TABLE_NAME + " ON " + TABLE_NAME + "." + ADDRESS + " = " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.ADDRESS + " LEFT OUTER JOIN " + GroupDatabase.TABLE_NAME + - " ON " + TABLE_NAME + "." + ADDRESS + " = " + GroupDatabase.TABLE_NAME + "." + GroupDatabase.GROUP_ID + + " ON " + TABLE_NAME + "." + ADDRESS + " = " + GroupDatabase.TABLE_NAME + "." + GROUP_ID + " WHERE " + where + " ORDER BY " + TABLE_NAME + "." + DATE + " DESC";