mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:43:39 +00:00
fix: remove the insert outgoing for local leave after network call, use groupPublicKey if envelope.source is empty in handleEncPair
This commit is contained in:
parent
9df35ede14
commit
7e86343efe
@ -204,7 +204,7 @@ class ClosedGroupUpdateMessageSendJobV2 private constructor(parameters: Paramete
|
||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.ENCRYPTION_KEY_PAIR
|
||||
closedGroupUpdate.addAllWrappers(kind.wrappers.map { it.toProto() })
|
||||
if (kind.targetUser != null) {
|
||||
closedGroupUpdate.publicKey = ByteString.copyFrom(kind.targetUser.toByteArray())
|
||||
closedGroupUpdate.publicKey = ByteString.copyFrom(destination.toByteArray())
|
||||
}
|
||||
}
|
||||
Kind.Leave -> {
|
||||
@ -240,7 +240,7 @@ class ClosedGroupUpdateMessageSendJobV2 private constructor(parameters: Paramete
|
||||
sentTime, serializedContentMessage, false, ttl, false,
|
||||
true, false, false, Optional.absent())
|
||||
} catch (e: Exception) {
|
||||
Log.d("Loki", "Failed to send closed group update message to: $destination due to error: $e.")
|
||||
Log.d("Loki", "Failed to send closed group update message to: $sendDestination due to error: $e.")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,9 +103,6 @@ object ClosedGroupsProtocolV2 {
|
||||
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
||||
val groupID = doubleEncodeGroupID(groupPublicKey)
|
||||
val group = groupDB.getGroup(groupID).orNull()
|
||||
val updatedMembers = group.members.map { it.serialize() }.toSet() - userPublicKey
|
||||
val admins = group.admins.map { it.serialize() }
|
||||
val name = group.title
|
||||
val sentTime = System.currentTimeMillis()
|
||||
if (group == null) {
|
||||
Log.d("Loki", "Can't leave nonexistent closed group.")
|
||||
@ -117,9 +114,6 @@ object ClosedGroupsProtocolV2 {
|
||||
job.setContext(context)
|
||||
job.onRun() // Run the job immediately
|
||||
// Notify the user
|
||||
val infoType = GroupContext.Type.QUIT
|
||||
val threadID = DatabaseFactory.getThreadDatabase(context).getOrCreateThreadIdFor(Recipient.from(context, Address.fromSerialized(groupID), false))
|
||||
insertOutgoingInfoMessage(context, groupID, infoType, name, updatedMembers, admins, threadID, sentTime)
|
||||
// Remove the group private key and unsubscribe from PNs
|
||||
disableLocalGroupAndUnsubscribe(context, apiDB, groupPublicKey, groupDB, groupID, userPublicKey)
|
||||
deferred.resolve(Unit)
|
||||
@ -622,7 +616,11 @@ object ClosedGroupsProtocolV2 {
|
||||
val userKeyPair = apiDB.getUserX25519KeyPair()
|
||||
// Unwrap the message
|
||||
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
||||
val groupID = doubleEncodeGroupID(groupPublicKey)
|
||||
val groupID = if (groupPublicKey.isEmpty() && !closedGroupUpdate.publicKey.isEmpty) {
|
||||
doubleEncodeGroupID(closedGroupUpdate.publicKey.toStringUtf8())
|
||||
} else {
|
||||
doubleEncodeGroupID(groupPublicKey)
|
||||
}
|
||||
val group = groupDB.getGroup(groupID).orNull()
|
||||
if (group == null) {
|
||||
Log.d("Loki", "Ignoring closed group encryption key pair message for nonexistent group.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user