Skip to content

Commit 8227a04

Browse files
committed
Converted to HashSet, added DISTINCT to profile pic and key
1 parent a5c8a2b commit 8227a04

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class ConfigToDatabaseSync @Inject constructor(
154154

155155
// Initiate cleanup in recipient_settings rows that no longer have any messages
156156
val addressesToKeep = mmsSmsDatabase.getAllReferencedAddresses()
157-
.mapTo(mutableSetOf()) { Address.fromSerialized(it) }
157+
.mapTo(mutableSetOf()) { fromSerialized(it) }
158158

159159
val removed = recipientSettingsDatabase.cleanupRecipientSettings(addressesToKeep)
160160
Log.d(TAG, "Recipient settings pruned: $removed orphan rows")

app/src/main/java/org/thoughtcrime/securesms/database/RecipientSettingsDatabase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ class RecipientSettingsDatabase @Inject constructor(
151151
* them from the cleanup.
152152
*/
153153
fun getAllReferencedAvatarFiles(): Set<RemoteFile.Encrypted> {
154-
val recipientAvatars = LinkedHashSet<RemoteFile.Encrypted>()
154+
val recipientAvatars = HashSet<RemoteFile.Encrypted>()
155155
readableDatabase.rawQuery(
156156
"""
157-
SELECT $COL_PROFILE_PIC_URL, $COL_PROFILE_PIC_KEY
157+
SELECT DISTINCT $COL_PROFILE_PIC_URL, $COL_PROFILE_PIC_KEY
158158
FROM $TABLE_NAME
159159
WHERE $COL_PROFILE_PIC_URL IS NOT NULL AND $COL_PROFILE_PIC_URL != ''
160160
AND $COL_PROFILE_PIC_KEY IS NOT NULL AND $COL_PROFILE_PIC_KEY != ''

0 commit comments

Comments
 (0)