Merge remote-tracking branch 'origin/libsession-integration' into libsession-integration

This commit is contained in:
0x330a 2023-03-24 11:18:32 +11:00
commit 03d3199ed2
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
3 changed files with 9 additions and 2 deletions

View File

@ -104,7 +104,7 @@ object OpenGroupManager {
val storage = MessagingModuleConfiguration.shared.storage
val configFactory = MessagingModuleConfiguration.shared.configFactory
val threadDB = DatabaseComponent.get(context).threadDatabase()
val openGroupID = "$server.$room"
val openGroupID = "${server.removeSuffix("/")}.$room"
val threadID = GroupManager.getOpenGroupThreadID(openGroupID, context)
val recipient = threadDB.getRecipientForThreadId(threadID) ?: return
threadDB.setThreadArchived(threadID)

View File

@ -74,10 +74,12 @@ object ConfigurationMessageUtilities {
if (ConfigBase.isNewConfigEnabled) {
// schedule job if none exist
// don't schedule job if we already have one
Log.d("Loki-DBG", "Forcing config sync")
val ourDestination = Destination.Contact(userPublicKey)
val currentStorageJob = storage.getConfigSyncJob(ourDestination)
if (currentStorageJob != null) {
(currentStorageJob as ConfigurationSyncJob).shouldRunAgain.set(true)
Log.d("Loki-DBG", "Not scheduling another one")
return Promise.ofFail(NullPointerException("A job is already pending or in progress, don't schedule another job"))
}
val newConfigSync = ConfigurationSyncJob(ourDestination)

View File

@ -18,7 +18,12 @@ class GroupAvatarDownloadJob(val server: String, val room: String, val imageId:
return
}
val storage = MessagingModuleConfiguration.shared.storage
val storedImageId = storage.getOpenGroup(room, server)?.imageId
val openGroup = storage.getOpenGroup(room, server)
if (openGroup == null) {
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob openGroup is null"))
return
}
val storedImageId = openGroup.imageId
if (storedImageId == null || storedImageId != imageId) {
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob imageId does not match the OpenGroup"))