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

[32118] Correctly pass highlighted attributes to query backend

Oliver Günther4b77c8e6a67d
diff --git a/frontend/src/app/components/wp-query/url-params-helper.spec.ts b/frontend/src/app/components/wp-query/url-params-helper.spec.ts
index a1443a8837f..047fd44c748 100644
--- a/frontend/src/app/components/wp-query/url-params-helper.spec.ts
+++ b/frontend/src/app/components/wp-query/url-params-helper.spec.ts
@@ -193,6 +193,7 @@ describe('UrlParamsHelper', function() {
timelineZoomLevel: 0,
timelineLabels: { left: 'foo', right: 'bar', farRight: 'asdf' },
highlightingMode: 'inline',
+ highlightedAttributes: [{href: 'a'}, {href: 'b'}],
sums: true,
columns: [{ id: 'type' }, { id: 'status' }, { id: 'soße' }],
groupBy: {
@@ -238,6 +239,7 @@ describe('UrlParamsHelper', function() {
timelineVisible: false,
showHierarchies: false,
highlightingMode: 'inline',
+ 'highlightedAttributes[]': ['a', 'b'],
offset: 10,
pageSize: 100
};
diff --git a/frontend/src/app/components/wp-query/url-params-helper.ts b/frontend/src/app/components/wp-query/url-params-helper.ts
index 2a5647bdc9a..a913f55db20 100644
--- a/frontend/src/app/components/wp-query/url-params-helper.ts
+++ b/frontend/src/app/components/wp-query/url-params-helper.ts
@@ -263,7 +263,7 @@ export class UrlParamsHelperService {
}
if (query.highlightedAttributes && query.highlightingMode === 'inline') {
- queryData.highlightedAttributes = query.highlightedAttributes.map(el => el.href);
+ queryData['highlightedAttributes[]'] = query.highlightedAttributes.map(el => el.href);
}
if (query.displayRepresentation) {
diff --git a/spec/features/work_packages/highlighting_spec.rb b/spec/features/work_packages/highlighting_spec.rb
index e717330a7de..e10040c3414 100644
--- a/spec/features/work_packages/highlighting_spec.rb
+++ b/spec/features/work_packages/highlighting_spec.rb
@@ -34,10 +34,13 @@ describe 'Work Package highlighting fields',
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:highlighting) { ::Components::WorkPackages::Highlighting.new }
let(:sort_by) { ::Components::WorkPackages::SortBy.new }
+ let(:query_title) { ::Components::WorkPackages::QueryTitle.new }
let!(:query) do
query = FactoryBot.build(:query, user: user, project: project)
query.column_names = %w[id subject status priority due_date]
+ query.highlighted_attributes = %i[status priority due_date]
+ query.highlighting_mode = :inline
query.save!
query
@@ -201,4 +204,24 @@ describe 'Work Package highlighting fields',
sort_by.sort_via_header 'Subject', descending: true
wp_table.expect_work_package_order wp_1, wp_2
end
+
+ it 'does not set query_props when switching in view (Regression #32118)' do
+ prio_wp1 = wp_table.edit_field(wp_1, :priority)
+ prio_wp1.update priority_no_color.name
+ prio_wp1.expect_state_text priority_no_color.name
+
+ wp_table.expect_and_dismiss_notification message: 'Successful update.'
+ wp_1.reload
+ expect(wp_1.priority).to eq priority_no_color
+
+ # We need to wait a bit for the query_props to load
+ # I don't have a better idea than waiting explicitly here
+ sleep 5
+
+ query_title.expect_not_changed
+
+ url = URI.parse(page.current_url).query
+ expect(url).to include("query_id=#{query.id}")
+ expect(url).not_to match(/query_props=.+/)
+ end
end