fix: handle group of size 1 being destroyed locally for admin

This commit is contained in:
jubb 2021-02-22 10:40:18 +11:00
parent c740963fe2
commit 766266d54d

View File

@ -509,7 +509,8 @@ object ClosedGroupsProtocolV2 {
val updatedMemberList = members - senderPublicKey val updatedMemberList = members - senderPublicKey
val userLeft = userPublicKey == senderPublicKey val userLeft = userPublicKey == senderPublicKey
if (didAdminLeave || userLeft) { // if the admin left, we left, or we are the only remaining member: remove the group
if (didAdminLeave || userLeft || updatedMemberList.size == 1) {
disableLocalGroupAndUnsubscribe(context, apiDB, groupPublicKey, groupDB, groupID, userPublicKey) disableLocalGroupAndUnsubscribe(context, apiDB, groupPublicKey, groupDB, groupID, userPublicKey)
} else { } else {
val isCurrentUserAdmin = admins.contains(userPublicKey) val isCurrentUserAdmin = admins.contains(userPublicKey)