Prevent deleting a group locally if the user is still a member

Fixes #924
This commit is contained in:
AsamK 2022-04-06 22:28:07 +02:00
parent 8dc82a30af
commit 02a018462b

View 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);
}