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

Fix highlightedAttributes null error on query errors

Oliver Güntherb823763ba76b
diff --git a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.spec.ts b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.spec.ts
index 71d19b572a3..749337eb70b 100644
--- a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.spec.ts
+++ b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.spec.ts
@@ -93,7 +93,8 @@ describe('UrlParamsHelper', () => {
timelineVisible: true,
timelineZoomLevel: 'days',
showHierarchies: true,
- highlightingMode: 'disabled',
+ highlightingMode: 'inline',
+ highlightedAttributes: [{ href: 'a' }, { href: 'b' }],
columns: [{ id: 'type' }, { id: 'status' }, { id: 'soße' }],
groupBy: {
id: 'status',
@@ -112,7 +113,7 @@ describe('UrlParamsHelper', () => {
it('should encode query to params JSON', () => {
const encodedJSON = UrlParamsHelper.encodeQueryJsonParams(query, additional);
- const expectedJSON = '{"c":["type","status","soße"],"hi":true,"g":"status","s":true,"tv":true,"tzl":"days","hl":"disabled","t":"type:desc","f":[{"n":"soße","o":"=","v":["knoblauch"]},{"n":"created_at","o":"<t-","v":["5"]}],"pa":10,"pp":100}'
+ const expectedJSON = '{"c":["type","status","soße"],"hi":true,"g":"status","s":true,"tv":true,"tzl":"days","hl":"inline","hla":["a","b"],"t":"type:desc","f":[{"n":"soße","o":"=","v":["knoblauch"]},{"n":"created_at","o":"<t-","v":["5"]}],"pa":10,"pp":100}'
expect(encodedJSON).toEqual(expectedJSON);
});
diff --git a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
index fe38e1eeffb..5d23464f5ed 100644
--- a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
+++ b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
@@ -159,7 +159,7 @@ export class UrlParamsHelperService {
private encodeHighlightedAttributes(query:QueryResource):Partial<QueryProps> {
if (query.highlightingMode === 'inline') {
if (Array.isArray(query.highlightedAttributes) && query.highlightedAttributes.length > 0) {
- return { hla: query.highlightedAttributes.map((el) => el.id as string) };
+ return { hla: query.highlightedAttributes.map((el) => this.idFromHref(el.href as string)) };
}
}