diff --git a/app/routes/events/components/EventDetail/getWaitingListPosition.ts b/app/routes/events/components/EventDetail/getWaitingListPosition.ts index 950ffad04f..ffa6565a53 100644 --- a/app/routes/events/components/EventDetail/getWaitingListPosition.ts +++ b/app/routes/events/components/EventDetail/getWaitingListPosition.ts @@ -8,10 +8,8 @@ const isPermittedInPool = ( user: PublicUserWithAbakusGroups, pool: PoolWithRegistrations, ) => { - return pool.permissionGroups.some((permissionGroup) => - user.allAbakusGroupIds?.some( - (userGroup) => userGroup === permissionGroup.id, - ), + return pool.allPermissionGroupIds.some((permissionGroupId) => + user.abakusGroups?.includes(permissionGroupId), ); }; diff --git a/app/store/models/Pool.d.ts b/app/store/models/Pool.d.ts index 2ded55fc65..22848ab552 100644 --- a/app/store/models/Pool.d.ts +++ b/app/store/models/Pool.d.ts @@ -8,6 +8,7 @@ interface CompletePool { capacity: number; activationDate: Dateish; permissionGroups: PublicGroup[]; + allPermissionGroupIds: EntityId[]; registrationCount: number; registrations: EntityId[]; } @@ -29,6 +30,7 @@ export type AuthPool = Pick< | 'capacity' | 'activationDate' | 'permissionGroups' + | 'allPermissionGroupIds' | 'registrationCount' | 'registrations' >; diff --git a/app/store/models/User.ts b/app/store/models/User.ts index 4ef5016d23..e209dd8b41 100644 --- a/app/store/models/User.ts +++ b/app/store/models/User.ts @@ -64,7 +64,6 @@ interface User { penalties: EntityId[]; icalToken: string; abakusGroups: EntityId[]; - allAbakusGroupIds: EntityId[]; isAbakusMember: boolean; isAbakomMember: boolean; pastMemberships: PastMembership[]; @@ -137,10 +136,7 @@ export type PublicUser = Pick< | 'achievements' >; -export type PublicUserWithAbakusGroups = Pick< - User, - 'abakusGroups' | 'allAbakusGroupIds' -> & +export type PublicUserWithAbakusGroups = Pick & PublicUser; export type PublicUserWithGroups = Pick<