diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupPermissionsTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupPermissionsTest.kt index c7db0ac71..d1a6eeb4f 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupPermissionsTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupPermissionsTest.kt @@ -98,19 +98,19 @@ class GroupPermissionsTest { assert(superAdminList.contains(boClient.inboxId)) // Verify that alix can NOT update group name - assert(boGroup.name == "New Group") + assert(boGroup.name == "") val exception = assertThrows(uniffi.xmtpv3.GenericException.GroupException::class.java) { runBlocking { alixGroup.updateGroupName("Alix group name") } } - assertEquals(exception.message, "Group error: generic: failed to wait for intent") + assertEquals(exception.message, "Group error: generic: Group intent could not be committed") runBlocking { alixGroup.sync() boGroup.sync() } - assert(boGroup.name == "New Group") - assert(alixGroup.name == "New Group") + assert(boGroup.name == "") + assert(alixGroup.name == "") runBlocking { boGroup.addAdmin(alixClient.inboxId) @@ -165,7 +165,7 @@ class GroupPermissionsTest { alixGroup.updateGroupName("Alix group name 2") } } - assertEquals(exception.message, "Group error: generic: failed to wait for intent") + assertEquals(exception.message, "Group error: generic: Group intent could not be committed") } @Test @@ -257,4 +257,35 @@ class GroupPermissionsTest { assert(superAdmins.size == 2) assert(regularMembers.isEmpty()) } + + @Test + fun testCanCommitAfterInvalidPermissionsCommit() { + val boGroup = runBlocking { boClient.conversations.newGroup(listOf(alix.walletAddress, caro.walletAddress), GroupPermissions.ALL_MEMBERS) } + runBlocking { alixClient.conversations.syncGroups() } + val alixGroup = runBlocking { alixClient.conversations.listGroups().first() } + + // Verify that alix can NOT add an admin + assert(boGroup.name == "") + val exception = assertThrows(XMTPException::class.java) { + runBlocking { + alixGroup.addAdmin(alixClient.inboxId) + } + } + assertEquals(exception.message, "Permission denied: Unable to add admin") + runBlocking { + alixGroup.sync() + boGroup.sync() + } + + // Verify that alix can update group name + runBlocking { + boGroup.sync() + alixGroup.sync() + alixGroup.updateGroupName("Alix group name") + alixGroup.sync() + boGroup.sync() + } + assert(boGroup.name == "Alix group name") + assert(alixGroup.name == "Alix group name") + } } diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index ad7cec4c9..7a1785ab8 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -210,7 +210,7 @@ class GroupTest { fun testNameAGroup() { val boGroup = runBlocking { boClient.conversations.newGroup(listOf(alix.walletAddress)) } runBlocking { - assertEquals("New Group", boGroup.name) + assertEquals("", boGroup.name) boGroup.updateGroupName("This Is A Great Group") boGroup.sync() alixClient.conversations.syncGroups() diff --git a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so index 3dcc9eaa8..727f6b32c 100755 Binary files a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so index dee7732ed..4f9f76374 100755 Binary files a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so index faa1ab333..0c6eebc8a 100755 Binary files a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so index 2f8aab8c3..3f39ae8b3 100755 Binary files a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so differ