commit 477b13d3eb9767cc53d67f2be87b8427ba7fbf5e
parent a90f4875a73a7ae1a985be183bf51f3bfd4a3d75
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Thu, 4 Jan 2024 23:26:55 +0100
fix(core/export_chat_messages): no database cache
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/action/impl/ExportChatMessages.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/action/impl/ExportChatMessages.kt
@@ -333,7 +333,7 @@ class ExportChatMessages : AbstractAction() {
//first fetch the first message
val conversationId = feedEntry.key!!
val conversationName = feedEntry.feedDisplayName ?: feedEntry.friendDisplayName!!.split("|").lastOrNull() ?: "unknown"
- val conversationParticipants = context.database.getConversationParticipants(feedEntry.key!!)
+ val conversationParticipants = context.database.getConversationParticipants(feedEntry.key!!, useCache = false)
?.mapNotNull {
context.database.getFriendInfo(it)
}?.associateBy { it.userId!! } ?: emptyMap()
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/database/DatabaseAccess.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/database/DatabaseAccess.kt
@@ -295,8 +295,8 @@ class DatabaseAccess(
}
}
- fun getConversationParticipants(conversationId: String): List<String>? {
- if (dmOtherParticipantCache[conversationId] != null) return dmOtherParticipantCache[conversationId]?.let { listOf(myUserId, it) }
+ fun getConversationParticipants(conversationId: String, useCache: Boolean = true): List<String>? {
+ if (dmOtherParticipantCache[conversationId] != null && useCache) return dmOtherParticipantCache[conversationId]?.let { listOf(myUserId, it) }
return useDatabase(DatabaseType.ARROYO)?.performOperation {
safeRawQuery(
"SELECT user_id, conversation_type FROM user_conversation WHERE client_conversation_id = ?",