1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-21 21:09:22 +00:00

Done with another TODO

This commit is contained in:
Pierre HUBERT 2020-03-26 17:17:28 +01:00
parent c945c6acda
commit d9248593e9

View File

@ -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!");