Do not include self in recents list for gift badging.

This commit is contained in:
Alex Hart
2022-05-16 09:47:41 -03:00
committed by Cody Henthorne
parent b3086e595f
commit 25788ef751
6 changed files with 12 additions and 5 deletions

View File

@@ -594,10 +594,10 @@ public class ThreadDatabase extends Database {
}
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean hideV1Groups) {
return getRecentConversationList(limit, includeInactiveGroups, false, false, hideV1Groups, false);
return getRecentConversationList(limit, includeInactiveGroups, false, false, hideV1Groups, false, false);
}
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean individualsOnly, boolean groupsOnly, boolean hideV1Groups, boolean hideSms) {
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean individualsOnly, boolean groupsOnly, boolean hideV1Groups, boolean hideSms, boolean hideSelf) {
SQLiteDatabase db = databaseHelper.getSignalReadableDatabase();
String query = !includeInactiveGroups ? MEANINGFUL_MESSAGES + " != 0 AND (" + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " IS NULL OR " + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " = 1)"
: MEANINGFUL_MESSAGES + " != 0";
@@ -620,6 +620,10 @@ public class ThreadDatabase extends Database {
query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.FORCE_SMS_SELECTION + " = 0";
}
if (hideSelf) {
query += " AND " + RECIPIENT_ID + " != " + Recipient.self().getId().toLong();
}
query += " AND " + ARCHIVED + " = 0";
if (SignalStore.releaseChannelValues().getReleaseChannelRecipientId() != null) {