From d9248593e9cd1a91327da220459b2884130d4317 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 26 Mar 2020 17:17:28 +0100 Subject: [PATCH] Done with another TODO --- src/controllers/GroupsController.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/controllers/GroupsController.ts b/src/controllers/GroupsController.ts index e0e4425..36446f9 100644 --- a/src/controllers/GroupsController.ts +++ b/src/controllers/GroupsController.ts @@ -414,9 +414,7 @@ export class GroupsController { h.error(404, "Membership not found!"); // If the user is an admin, he must not be the last admin of the group - // TODO : use new method - if(userID == h.getUserId() && currUserMembership.level == GroupMembershipLevels.ADMINISTRATOR - && await GroupsHelper.CountMembersAtLevel(groupID, GroupMembershipLevels.ADMINISTRATOR) == 1) + if(userID == h.getUserId() && await GroupsHelper.IsLastAdmin(groupID, userID)) h.error(401, "You are the last administrator of this group!");