fix: revert query to filter empty threads for now

This commit is contained in:
jubb 2021-03-05 13:17:08 +11:00
parent 0120eac350
commit 4f74d46b17
2 changed files with 12 additions and 3 deletions

View File

@ -363,9 +363,8 @@ public class ThreadDatabase extends Database {
private Cursor getConversationList(String archived) { private Cursor getConversationList(String archived) {
SQLiteDatabase db = databaseHelper.getReadableDatabase(); SQLiteDatabase db = databaseHelper.getReadableDatabase();
String localNumber = TextSecurePreferences.getLocalNumber(context); String query = createQuery(ARCHIVED + " = ? AND " + MESSAGE_COUNT + " != 0", 0);
String query = createQuery(ARCHIVED + " = ? AND ("+TABLE_NAME+"."+ADDRESS+" != ? OR "+MESSAGE_COUNT+" != 0)", 0); Cursor cursor = db.rawQuery(query, new String[]{archived});
Cursor cursor = db.rawQuery(query, new String[]{archived, localNumber});
setNotifyConverationListListeners(cursor); setNotifyConverationListListeners(cursor);
@ -511,6 +510,14 @@ public class ThreadDatabase extends Database {
MmsSmsDatabase mmsSmsDatabase = DatabaseFactory.getMmsSmsDatabase(context); MmsSmsDatabase mmsSmsDatabase = DatabaseFactory.getMmsSmsDatabase(context);
long count = mmsSmsDatabase.getConversationCount(threadId); long count = mmsSmsDatabase.getConversationCount(threadId);
if (count == 0) {
deleteThread(threadId);
notifyConversationListListeners();
return true;
}
MmsSmsDatabase.Reader reader = null; MmsSmsDatabase.Reader reader = null;
try { try {
@ -524,6 +531,7 @@ public class ThreadDatabase extends Database {
notifyConversationListListeners(); notifyConversationListListeners();
return false; return false;
} else { } else {
deleteThread(threadId);
notifyConversationListListeners(); notifyConversationListListeners();
return true; return true;
} }

View File

@ -141,6 +141,7 @@ object MultiDeviceProtocol {
recipientDatabase.setProfileName(recipient, contact.name) recipientDatabase.setProfileName(recipient, contact.name)
} }
recipientDatabase.setProfileSharing(recipient, true) recipientDatabase.setProfileSharing(recipient, true)
recipientDatabase.setRegistered(recipient, Recipient.RegisteredState.REGISTERED)
// create Thread if needed // create Thread if needed
threadDatabase.getOrCreateThreadIdFor(recipient) threadDatabase.getOrCreateThreadIdFor(recipient)
} }