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

Clarify that we're actually getting an ID, not href from the query filter

Oliver Güntherfc4afc875cc4
diff --git a/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
index 0c341eb694d..67154063207 100644
--- a/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
@@ -62,13 +62,13 @@ export abstract class BoardActionService {
/**
* Returns the current filter value ID if any
* @param query
- * @returns /api/v3/status/:id if a status filter exists
+ * @returns The id of the resource
*/
- getActionValueHrefForColumn(query:QueryResource):string|undefined {
+ getActionValueId(query:QueryResource):string|undefined {
const filter = _.find(query.filters, filter => filter.id === this.filterName);
if (filter) {
const value = filter.values[0] as string|HalResource;
- return (value instanceof HalResource) ? value.href! : value;
+ return (value instanceof HalResource) ? value.id! : value;
}
return;
@@ -77,17 +77,16 @@ export abstract class BoardActionService {
/**
* Returns the current filter value if any
* @param query
- * @returns /api/v3/status/:id if a status filter exists
+ * @returns The loaded action reosurce
*/
getLoadedActionValue(query:QueryResource):Promise<HalResource|undefined> {
- const href = this.getActionValueHrefForColumn(query);
+ const id = this.getActionValueId(query);
- if (!href) {
+ if (!id) {
return Promise.resolve(undefined);
}
- return this
- .require(href);
+ return this.require(id);
}
/**
@@ -121,7 +120,7 @@ export abstract class BoardActionService {
* Get available values from the active queries
*
* @param board The board we're looking at
- * @param active The active set of values (hrefs or plain values)
+ * @param active The active set of values (resources or plain values)
* @param matching values matching the given name
*/
loadAvailable(board:Board, active:Set<string>, matching:string):Observable<HalResource[]> {
@@ -218,10 +217,10 @@ export abstract class BoardActionService {
/**
* Require the given resource to be loaded.
*
- * @param href
+ * @param id
* @protected
*/
- protected abstract require(href:string):Promise<HalResource>;
+ protected abstract require(id:string):Promise<HalResource>;
/**
* Load values optionally matching the given name
diff --git a/frontend/src/app/modules/boards/board/board-actions/cached-board-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/cached-board-action.service.ts
index 7b104896fea..48013dde6dc 100644
--- a/frontend/src/app/modules/boards/board/board-actions/cached-board-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/cached-board-action.service.ts
@@ -29,7 +29,7 @@ export abstract class CachedBoardActionService extends BoardActionService {
);
}
- protected require(idOrHref:string):Promise<HalResource> {
+ protected require(id:string):Promise<HalResource> {
this
.cache
.putFromPromiseIfPristine(() => this.loadUncached());
@@ -39,7 +39,7 @@ export abstract class CachedBoardActionService extends BoardActionService {
.values$()
.toPromise()
.then(results => {
- return results.find(resource => resource.id === idOrHref || resource.href === idOrHref)!;
+ return results.find(resource => resource.id === id)!;
});
}
diff --git a/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
index da6623fb48d..a661a344f56 100644
--- a/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
@@ -39,7 +39,7 @@ export class BoardSubprojectActionService extends CachedBoardActionService {
}
assignToWorkPackage(changeset:WorkPackageChangeset, query:QueryResource) {
- const href = this.getActionValueHrefForColumn(query);
+ const href = this.getActionValueId(query);
changeset.setValue('project', { href: href });
}
diff --git a/frontend/src/app/modules/boards/board/board-list/board-list.component.ts b/frontend/src/app/modules/boards/board/board-list/board-list.component.ts
index e3e04cd954d..0ba8d1733e2 100644
--- a/frontend/src/app/modules/boards/board/board-list/board-list.component.ts
+++ b/frontend/src/app/modules/boards/board/board-list/board-list.component.ts
@@ -334,7 +334,7 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnIni
}
let actionService = this.actionService!;
- const id = actionService.getActionValueHrefForColumn(query);
+ const id = actionService.getActionValueId(query);
// Test if we loaded the resource already
if (this.actionResource && id === this.actionResource.href) {