diff --git a/client/actions/eventsPlanning/ui.ts b/client/actions/eventsPlanning/ui.ts index e1f27a1c9..35bef4ed5 100644 --- a/client/actions/eventsPlanning/ui.ts +++ b/client/actions/eventsPlanning/ui.ts @@ -90,7 +90,7 @@ const refetchPlanning = (planningId) => ( (dispatch, getState) => { const storedPlannings = selectors.planning.storedPlannings(getState()); const plan = get(storedPlannings, planningId); - const relatedEventIds = getRelatedEventIdsForPlanning(plan, 'primary'); + const relatedEventIds = getRelatedEventIdsForPlanning(plan); const eventId = relatedEventIds.length > 0 ? relatedEventIds[0] : undefined; const events = selectors.eventsPlanning.getRelatedPlanningsList(getState()) || {}; diff --git a/client/actions/planning/ui.ts b/client/actions/planning/ui.ts index 00f18de1f..6a9b2f634 100644 --- a/client/actions/planning/ui.ts +++ b/client/actions/planning/ui.ts @@ -209,7 +209,7 @@ const duplicate = (plan) => ( .then((newPlan) => { notify.success(gettext('Planning duplicated')); const openInModal = selectors.forms.currentItemIdModal(getState()); - const relatedEventIds = getRelatedEventIdsForPlanning(plan, 'primary'); + const relatedEventIds = getRelatedEventIdsForPlanning(plan); if (relatedEventIds.length > 0) { dispatch(main.unlockAndCancel(plan)).then(() => { diff --git a/client/api/editor/item.ts b/client/api/editor/item.ts index da9cb5b9a..0cf586591 100644 --- a/client/api/editor/item.ts +++ b/client/api/editor/item.ts @@ -27,7 +27,7 @@ export function getItemInstance(type: EDITOR_TYPE): IEditorAPI['item'] { return Object.keys(plans) .filter((planId) => ( plans[planId] != null && - getRelatedEventIdsForPlanning(plans[planId], 'primary').includes(eventId)) + getRelatedEventIdsForPlanning(plans[planId]).includes(eventId)) ) .map((planId) => cloneDeep(plans[planId])); } diff --git a/client/api/editor/item_planning.ts b/client/api/editor/item_planning.ts index 76956f431..f04426226 100644 --- a/client/api/editor/item_planning.ts +++ b/client/api/editor/item_planning.ts @@ -47,7 +47,7 @@ export function getPlanningInstance(type: EDITOR_TYPE): IEditorAPI['item']['plan const profile = planningApi.contentProfiles.get('planning'); const groups = getEditorFormGroupsFromProfile(profile); - if (getRelatedEventLinksForPlanning(item, 'primary').length === 0) { + if (getRelatedEventLinksForPlanning(item).length === 0) { delete groups['associated_event']; } const bookmarks = getBookmarksFromFormGroups(groups); diff --git a/client/components/Planning/PlanningDateTime.tsx b/client/components/Planning/PlanningDateTime.tsx index 007eeb304..284982287 100644 --- a/client/components/Planning/PlanningDateTime.tsx +++ b/client/components/Planning/PlanningDateTime.tsx @@ -34,7 +34,7 @@ export const PlanningDateTime = ({ }: IProps) => { const coverages = get(item, 'coverages', []); const coverageTypes = planningUtils.mapCoverageByDate(coverages); - const hasAssociatedEvent = getRelatedEventIdsForPlanning(item, 'primary').length > 0; + const hasAssociatedEvent = getRelatedEventIdsForPlanning(item).length > 0; const isSameDay = (scheduled) => scheduled && (date == null || moment(scheduled).format('YYYY-MM-DD') === date); const coverageToDisplay = coverageTypes.filter((coverage) => { const scheduled = get(coverage, 'planning.scheduled'); diff --git a/client/utils/planning.ts b/client/utils/planning.ts index ef576d24e..5bf2d21eb 100644 --- a/client/utils/planning.ts +++ b/client/utils/planning.ts @@ -384,7 +384,7 @@ export function mapCoverageByDate(coverages: Array = []): // ad hoc plan created directly from planning list and not from an event function isPlanAdHoc(plan: IPlanningItem): boolean { - return getRelatedEventLinksForPlanning(plan, 'primary').length === 0; + return getRelatedEventLinksForPlanning(plan).length === 0; } function isPlanMultiDay(plan: IPlanningItem): boolean { diff --git a/server/planning/search/queries/planning.py b/server/planning/search/queries/planning.py index 245ecc1e2..5ff09525e 100644 --- a/server/planning/search/queries/planning.py +++ b/server/planning/search/queries/planning.py @@ -153,7 +153,7 @@ def search_by_events(params: Dict[str, Any], query: elastic.ElasticQuery): elastic.bool_and( [ elastic.terms(field="related_events._id", values=event_ids), - elastic.term(field="related_events.link_type", value="primary"), + # elastic.term(field="related_events.link_type", value="primary"), ], "related_events", )