fix: empty set in appropriate places for current closed groups

This commit is contained in:
0x330a 2023-06-20 13:13:05 +10:00
parent a689e38f33
commit 5a7b67f3f5
3 changed files with 11 additions and 6 deletions

View File

@ -33,12 +33,13 @@ class MessageReceiveJob(val data: ByteArray, val serverHash: String? = null, val
fun executeAsync(dispatcherName: String): Promise<Unit, Exception> {
val deferred = deferred<Unit, Exception>()
try {
val isRetry: Boolean = failureCount != 0
val storage = MessagingModuleConfiguration.shared.storage
val serverPublicKey = openGroupID?.let {
MessagingModuleConfiguration.shared.storage.getOpenGroupPublicKey(it.split(".").dropLast(1).joinToString("."))
storage.getOpenGroupPublicKey(it.split(".").dropLast(1).joinToString("."))
}
val (message, proto) = MessageReceiver.parse(this.data, this.openGroupMessageServerID, openGroupPublicKey = serverPublicKey)
val threadId = Message.getThreadId(message, this.openGroupID, MessagingModuleConfiguration.shared.storage, false)
val currentClosedGroups = storage.getAllActiveClosedGroupPublicKeys()
val (message, proto) = MessageReceiver.parse(this.data, this.openGroupMessageServerID, openGroupPublicKey = serverPublicKey, currentClosedGroups = currentClosedGroups)
val threadId = Message.getThreadId(message, this.openGroupID, storage, false)
message.serverHash = serverHash
MessageReceiver.handle(message, proto, threadId ?: -1, this.openGroupID)
this.handleSuccess(dispatcherName)

View File

@ -262,7 +262,8 @@ class OpenGroupPoller(private val server: String, private val executorService: S
null,
fromOutbox,
if (fromOutbox) it.recipient else it.sender,
serverPublicKey
serverPublicKey,
emptySet() // this shouldn't be necessary as we are polling open groups here
)
if (fromOutbox) {
val mapping = mappingCache[it.recipient] ?: storage.getOrCreateBlindedIdMapping(

View File

@ -146,7 +146,10 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
var latestMessageTimestamp: Long? = null
messages.forEach { (envelope, hash) ->
try {
val (message, _) = MessageReceiver.parse(data = envelope.toByteArray(), openGroupServerID = null)
val (message, _) = MessageReceiver.parse(data = envelope.toByteArray(),
// assume no groups in personal poller messages
openGroupServerID = null, currentClosedGroups = emptySet()
)
// sanity checks
if (message !is SharedConfigurationMessage) {
Log.w("Loki", "shared config message handled in configs wasn't SharedConfigurationMessage but was ${message.javaClass.simpleName}")