]> nmode's Git Repositories - signal-cli/commitdiff
Prevent deleting a group locally if the user is still a member
authorAsamK <asamk@gmx.de>
Wed, 6 Apr 2022 20:28:07 +0000 (22:28 +0200)
committerAsamK <asamk@gmx.de>
Wed, 6 Apr 2022 20:28:07 +0000 (22:28 +0200)
Fixes #924

lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java

index aa4752a2644e0e4b4f7100e8ff334e6f3edd4b94..45ec09f96fa5ef407f5604d8429f8ce64ee4d38b 100644 (file)
@@ -348,6 +348,11 @@ class ManagerImpl implements Manager {
 
     @Override
     public void deleteGroup(GroupId groupId) throws IOException {
+        final var group = context.getGroupHelper().getGroup(groupId);
+        if (group.isMember(account.getSelfRecipientId())) {
+            throw new IOException(
+                    "The local group information cannot be removed, as the user is still a member of the group");
+        }
         context.getGroupHelper().deleteGroup(groupId);
     }