Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Update the `datesInterval` when the calendar changed and query_props already existed before (see #40441)

Henriette Darge9895bcd0947a
diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.ts
index 758c7425f4d..8405cd1915d 100644
--- a/frontend/src/app/features/calendar/op-calendar.service.ts
+++ b/frontend/src/app/features/calendar/op-calendar.service.ts
@@ -199,7 +199,19 @@ export class OpCalendarService extends UntilDestroyedMixin {
// This is the case on initially loading the calendar with query_props present in the url params.
// There might also be a query_id but the settings persisted in it are overwritten by the props.
if (this.urlParams.query_props) {
- queryProps = decodeURIComponent(this.urlParams.query_props || '');
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const oldQueryProps:{ [key:string]:unknown } = JSON.parse(this.urlParams.query_props);
+
+ // Update the date period of the calendar in the filter
+ const newQueryProps = {
+ ...oldQueryProps,
+ f: [
+ ...(oldQueryProps.f as QueryPropsFilter[]).filter((filter:QueryPropsFilter) => filter.n !== 'datesInterval'),
+ OpCalendarService.dateFilter(startDate, endDate),
+ ],
+ };
+
+ queryProps = JSON.stringify(newQueryProps);
} else {
queryProps = OpCalendarService.defaultQueryProps(startDate, endDate);
}