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
Restore side loading of work packages
Oliver Günther465978478f38
diff --git a/frontend/src/app/core/state/in-app-notifications/in-app-notifications.service.ts b/frontend/src/app/core/state/in-app-notifications/in-app-notifications.service.tsindex cad57ef31e9..8ecfcebe1fa 100644--- a/frontend/src/app/core/state/in-app-notifications/in-app-notifications.service.ts+++ b/frontend/src/app/core/state/in-app-notifications/in-app-notifications.service.ts@@ -102,18 +102,6 @@ export class InAppNotificationsService extends UntilDestroyedMixin {.path;}- private sideLoadInvolvedWorkPackages(elements:InAppNotification[]):void {- const wpIds = elements.map((element) => {- const href = element._links.resource?.href;- return href && HalResource.matchFromLink(href, 'work_packages');- });-- void this- .apiV3Service- .work_packages- .requireAll(_.compact(wpIds));- }-/*** Mark the given notification IDs as read through the API.*/diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.tsindex c802b34b27c..c953c3c0780 100644--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts@@ -11,6 +11,7 @@ import {map,switchMap,take,+ tap,} from 'rxjs/operators';import {selectCollection$,@@ -31,6 +32,9 @@ import {import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { Apiv3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';import { ActionsService } from 'core-app/core/state/actions/actions.service';+import { HalResource } from 'core-app/features/hal/resources/hal-resource';+import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';+import { from } from 'rxjs';@Injectable()@EffectHandler@@ -49,16 +53,11 @@ export class IanCenterService extends UntilDestroyedMixin {.query.select(['params', 'activeFacet']);- selectCollection$ = this- .paramsChanges$- .pipe(- switchMap(() => selectCollection$(this.ianService, this.params)),- );-selectNotifications$ = this.paramsChanges$.pipe(switchMap(() => selectCollectionEntities$<InAppNotification>(this.ianService, this.params)),+ tap((notifications) => this.sideLoadInvolvedWorkPackages(notifications)),);aggregatedCenterNotifications$ = this@@ -73,6 +72,7 @@ export class IanCenterService extends UntilDestroyedMixin {readonly injector:Injector,readonly ianService:InAppNotificationsService,readonly actions$:ActionsService,+ readonly apiV3Service:APIV3Service,) {super();}@@ -114,6 +114,29 @@ export class IanCenterService extends UntilDestroyedMixin {.subscribe();}+ private sideLoadInvolvedWorkPackages(elements:InAppNotification[]):void {+ const { cache } = this.apiV3Service.work_packages;+ const wpIds = elements+ .map((element) => {+ const href = element._links.resource?.href;+ return href && HalResource.matchFromLink(href, 'work_packages');+ })+ .filter((id) => id && cache.stale(id)) as string[];++ const promise = this+ .apiV3Service+ .work_packages+ .requireAll(_.compact(wpIds));++ wpIds.forEach((id) => {+ cache.clearAndLoad(+ id,+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion+ from(promise).pipe(map(() => cache.current(id)!)),+ );+ });+ }+private get params():Apiv3ListParameters {const state = this.store.getValue();return { ...state.params, filters: IAN_FACET_FILTERS[state.activeFacet] };