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

Remove page parameter explicitly, instead of whitelisting

Oliver Günthera98dff9b5c1c
diff --git a/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
index 8a5dd818476..90bb0073c75 100644
--- a/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
@@ -319,13 +319,14 @@ export default class FiltersFormController extends Controller {
const params = new URLSearchParams(window.location.search);
const newFilters = this.buildFiltersParam(this.parseFilters());
-
if (newFilters === params.get('filters')) {
// Some fields may be triggered via the input event and the change event too.
// This early return will prevent firing request when the filter params are not changed.
return;
}
+ // Remove the page parameter when changing filters, so that pagination resets
+ params.delete('page');
params.set('filters', newFilters);
const ajaxIndicator = document.querySelector('#ajax-indicator') as HTMLElement;
ajaxIndicator.style.display = '';
diff --git a/spec/support/components/common/filters.rb b/spec/support/components/common/filters.rb
index b155c603b9b..dd48c47b44b 100644
--- a/spec/support/components/common/filters.rb
+++ b/spec/support/components/common/filters.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH