@openeventkit/event-site 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/schedule.js +8 -4
package/package.json
CHANGED
package/src/utils/schedule.js
CHANGED
|
@@ -5,6 +5,8 @@ import { isString } from "lodash";
|
|
|
5
5
|
import { getEnvVariable, SCHEDULE_EXCLUDING_TAGS } from "./envVariables";
|
|
6
6
|
import {getUserAccessLevelIds, isAuthorizedUser} from './authorizedGroups';
|
|
7
7
|
import {uniq} from "lodash";
|
|
8
|
+
import * as Sentry from "@sentry/react";
|
|
9
|
+
|
|
8
10
|
|
|
9
11
|
const groupByDay = (events) => {
|
|
10
12
|
let groupedEvents = [];
|
|
@@ -61,13 +63,15 @@ export const filterEventsByTags = (events) => {
|
|
|
61
63
|
|
|
62
64
|
export const filterEventsByTicket = (events, user) => {
|
|
63
65
|
const assignedTickets = user?.summit_tickets || [];
|
|
64
|
-
const ticketTypeIds = uniq(assignedTickets
|
|
66
|
+
const ticketTypeIds = uniq(assignedTickets?.map(t => t?.ticket_type?.id));
|
|
65
67
|
|
|
66
68
|
return events.filter(ev => {
|
|
67
|
-
const hasEventRestriction = ev
|
|
68
|
-
|
|
69
|
+
const hasEventRestriction = ev?.allowed_ticket_types?.length > 0;
|
|
70
|
+
if(!ev?.allowed_ticket_types){
|
|
71
|
+
Sentry?.captureMessage(`event ${ev.id} has not set allowed_ticket_types collection`);
|
|
72
|
+
}
|
|
73
|
+
const typeAllowed = ev?.type?.allowed_ticket_types.length === 0 || ev?.type?.allowed_ticket_types.some(att => ticketTypeIds.includes(att));
|
|
69
74
|
const eventAllowed = !hasEventRestriction || ev.allowed_ticket_types.some(att => ticketTypeIds.includes(att));
|
|
70
|
-
|
|
71
75
|
return hasEventRestriction ? eventAllowed : typeAllowed;
|
|
72
76
|
});
|
|
73
77
|
};
|