From d143d8a883db99689022d03741f3f7c26b68696e Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 26 Feb 2024 17:27:46 +1030 Subject: [PATCH] Fix old threads being set to 2 weeks ago --- .../org/thoughtcrime/securesms/database/Storage.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index adfd5d6d3b..f784313a5c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -1181,14 +1181,13 @@ open class Storage( profileManager.setProfilePicture(context, recipient, null, null) } if (contact.priority == PRIORITY_HIDDEN) { - getThreadId(fromSerialized(contact.id))?.let { conversationThreadId -> - deleteConversation(conversationThreadId) - } + getThreadId(fromSerialized(contact.id))?.let(::deleteConversation) } else { - getOrCreateThreadIdFor(fromSerialized(contact.id)).let { conversationThreadId -> - setPinned(conversationThreadId, contact.priority == PRIORITY_PINNED) - setThreadDate(conversationThreadId, SnodeAPI.nowWithOffset - 14.days.inWholeMilliseconds) - } + ( + getThreadId(address) ?: getOrCreateThreadIdFor(address).also { + setThreadDate(it, SnodeAPI.nowWithOffset - 14.days.inWholeMilliseconds) + } + ).also { setPinned(it, contact.priority == PRIORITY_PINNED) } } getThreadId(recipient)?.let { setExpirationConfiguration(