Skip to content

Commit

Permalink
Merge pull request #5141 from webkom/fix-performance-issue-on-events-…
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
eikhr authored Nov 4, 2024
2 parents 2bcc6b7 + f47f9bf commit 9d527e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
};

Expand Down
2 changes: 2 additions & 0 deletions app/store/models/Pool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface CompletePool {
capacity: number;
activationDate: Dateish;
permissionGroups: PublicGroup[];
allPermissionGroupIds: EntityId[];
registrationCount: number;
registrations: EntityId[];
}
Expand All @@ -29,6 +30,7 @@ export type AuthPool = Pick<
| 'capacity'
| 'activationDate'
| 'permissionGroups'
| 'allPermissionGroupIds'
| 'registrationCount'
| 'registrations'
>;
Expand Down
6 changes: 1 addition & 5 deletions app/store/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ interface User {
penalties: EntityId[];
icalToken: string;
abakusGroups: EntityId[];
allAbakusGroupIds: EntityId[];
isAbakusMember: boolean;
isAbakomMember: boolean;
pastMemberships: PastMembership[];
Expand Down Expand Up @@ -137,10 +136,7 @@ export type PublicUser = Pick<
| 'achievements'
>;

export type PublicUserWithAbakusGroups = Pick<
User,
'abakusGroups' | 'allAbakusGroupIds'
> &
export type PublicUserWithAbakusGroups = Pick<User, 'abakusGroups'> &
PublicUser;

export type PublicUserWithGroups = Pick<
Expand Down

0 comments on commit 9d527e1

Please sign in to comment.