mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
fix: open group avatar loop for open groups we have left
This commit is contained in:
parent
f91fc2503b
commit
1781d7e85f
@ -245,10 +245,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
val recipient = Recipient.from(this, address, false)
|
val recipient = Recipient.from(this, address, false)
|
||||||
threadId = storage.getOrCreateThreadIdFor(recipient.address)
|
threadId = storage.getOrCreateThreadIdFor(recipient.address)
|
||||||
// assume created thread
|
|
||||||
if (recipient.isContactRecipient && !recipient.isLocalNumber) {
|
|
||||||
storage.setRecipientApproved(recipient, true) // assume approved when we CREATE the thread, not send first message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} ?: finish()
|
} ?: finish()
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import android.net.Uri
|
|||||||
import network.loki.messenger.libsession_util.ConfigBase
|
import network.loki.messenger.libsession_util.ConfigBase
|
||||||
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN
|
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN
|
||||||
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_PINNED
|
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_PINNED
|
||||||
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_VISIBLE
|
|
||||||
import network.loki.messenger.libsession_util.Contacts
|
import network.loki.messenger.libsession_util.Contacts
|
||||||
import network.loki.messenger.libsession_util.ConversationVolatileConfig
|
import network.loki.messenger.libsession_util.ConversationVolatileConfig
|
||||||
import network.loki.messenger.libsession_util.UserGroupsConfig
|
import network.loki.messenger.libsession_util.UserGroupsConfig
|
||||||
@ -99,16 +98,6 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
val localUserAddress = getUserPublicKey() ?: return
|
val localUserAddress = getUserPublicKey() ?: return
|
||||||
if (!getRecipientApproved(address) && localUserAddress != address.serialize()) return // don't store unapproved / message requests
|
if (!getRecipientApproved(address) && localUserAddress != address.serialize()) return // don't store unapproved / message requests
|
||||||
|
|
||||||
if (localUserAddress == address.serialize()) {
|
|
||||||
val userConfig = configFactory.user ?: return
|
|
||||||
if (userConfig.getNtsPriority() == PRIORITY_HIDDEN) {
|
|
||||||
// if it's hidden set it visible, otherwise it's pinned so don't change
|
|
||||||
userConfig.setNtsPriority(PRIORITY_VISIBLE)
|
|
||||||
DatabaseComponent.get(context).threadDatabase().setHasSent(threadId, true)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val volatile = configFactory.convoVolatile ?: return
|
val volatile = configFactory.convoVolatile ?: return
|
||||||
if (address.isGroup) {
|
if (address.isGroup) {
|
||||||
val groups = configFactory.userGroups ?: return
|
val groups = configFactory.userGroups ?: return
|
||||||
@ -139,6 +128,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
} else {
|
} else {
|
||||||
val userProfile = configFactory.user ?: return
|
val userProfile = configFactory.user ?: return
|
||||||
userProfile.setNtsPriority(ConfigBase.PRIORITY_VISIBLE)
|
userProfile.setNtsPriority(ConfigBase.PRIORITY_VISIBLE)
|
||||||
|
DatabaseComponent.get(context).threadDatabase().setHasSent(threadId, true)
|
||||||
}
|
}
|
||||||
val newVolatileParams = volatile.getOrConstructOneToOne(address.serialize())
|
val newVolatileParams = volatile.getOrConstructOneToOne(address.serialize())
|
||||||
volatile.set(newVolatileParams)
|
volatile.set(newVolatileParams)
|
||||||
|
@ -41,7 +41,12 @@ object OpenGroupManager {
|
|||||||
if (isPolling) { return }
|
if (isPolling) { return }
|
||||||
isPolling = true
|
isPolling = true
|
||||||
val storage = MessagingModuleConfiguration.shared.storage
|
val storage = MessagingModuleConfiguration.shared.storage
|
||||||
val servers = storage.getAllOpenGroups().values.map { it.server }.toSet()
|
val (serverGroups, toDelete) = storage.getAllOpenGroups().values.partition { storage.getThreadId(it) != null }
|
||||||
|
toDelete.forEach { openGroup ->
|
||||||
|
delete(openGroup.server, openGroup.room, MessagingModuleConfiguration.shared.context)
|
||||||
|
}
|
||||||
|
|
||||||
|
val servers = serverGroups.map { it.server }.toSet()
|
||||||
servers.forEach { server ->
|
servers.forEach { server ->
|
||||||
pollers[server]?.stop() // Shouldn't be necessary
|
pollers[server]?.stop() // Shouldn't be necessary
|
||||||
val poller = OpenGroupPoller(server, executorService)
|
val poller = OpenGroupPoller(server, executorService)
|
||||||
|
@ -20,7 +20,7 @@ class GroupAvatarDownloadJob(val server: String, val room: String, val imageId:
|
|||||||
}
|
}
|
||||||
val storage = MessagingModuleConfiguration.shared.storage
|
val storage = MessagingModuleConfiguration.shared.storage
|
||||||
val openGroup = storage.getOpenGroup(room, server)
|
val openGroup = storage.getOpenGroup(room, server)
|
||||||
if (openGroup == null) {
|
if (openGroup == null || storage.getThreadId(openGroup) == null) {
|
||||||
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob openGroup is null"))
|
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob openGroup is null"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user