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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Correctly cache and render shared users
Klaus Zandersaee7e609dbd5
diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/share-cell-builder.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/share-cell-builder.tsindex f99804bb1a7..86e5464f1ca 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/share-cell-builder.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/share-cell-builder.ts@@ -15,9 +15,13 @@ export class ShareCellbuilder {td.classList.add(tdClassName, column.id);td.dataset.columnId = column.id;-console.log(this.isolatedQuerySpace.workPackageSharesCache.get(workPackage.id!).getValueOr([]));+ const relevantShares = this.isolatedQuerySpace.workPackageSharesCache.get(workPackage.id!).getValueOr([]);- td.innerHTML = `Share ${this.isolatedQuerySpace.workPackageSharesCache.get(workPackage.id!).getValueOr([]).map((share) => share.user.name).join(', ')}`;+ if (relevantShares.length === 0) {+ td.innerHTML = '-';+ } else {+ td.innerHTML = relevantShares.map((share) => share.principal.name).join(', ');+ }return td;}diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.tsindex f8d5e4fc448..f8de77c0d38 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts@@ -44,6 +44,8 @@ import { WorkPackageViewHierarchiesService } from './wp-view-hierarchy.service';import { WorkPackageViewColumnsService } from './wp-view-columns.service';import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';import { ShareResource } from 'core-app/features/hal/resources/share-resource';+import { map } from 'rxjs/operators';+import { firstValueFrom } from 'rxjs';@Injectable()export class WorkPackageViewAdditionalElementsService {@@ -69,8 +71,8 @@ export class WorkPackageViewAdditionalElementsService {this.requireHierarchyElements(rows),this.requireWorkPackageShares(workPackageIds),this.requireSumsSchema(results),- ]).then((results:string[][]) => {- this.loadAdditional(_.flatten(results));+ ]).then((wpResults:string[][]) => {+ this.loadAdditional(_.flatten(wpResults));});}@@ -155,21 +157,29 @@ export class WorkPackageViewAdditionalElementsService {.add('entityType', '=', ['WorkPackage']).add('entityId', '=', wpIds);- this+ const workPackageShareRequest = this.apiV3Service.shares.filtered(filters, { pageSize: '-1' }).get()- .subscribe(({ elements }) => {- const shares = elements as ShareResource[];+ .pipe(+ map(({ elements }) => {+ const shares = elements as ShareResource[];- const sharedWpIds = _.uniq(shares.map((share) => share.entity.id as string));+ const sharedWpIds = _.uniq(shares.map((share) => share.entity.id as string));- sharedWpIds.forEach((wpId) => {- this.querySpace.workPackageSharesCache.get(wpId).putValue(shares.filter((share) => share.entity.id === wpId));- });- });+ sharedWpIds.forEach((wpId) => {+ this+ .querySpace+ .workPackageSharesCache+ .get(wpId)+ .putValue(shares.filter((share) => share.entity.id === wpId));+ });- return Promise.resolve([]);+ return [];+ }),+ );++ return firstValueFrom(workPackageShareRequest);}}