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

Also reload activities in the work package split view on update, not just the notification count (#9810)

Benjamin Bädorfa1b8cdd3be87
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index 224b60f4dfc..d3f45b0034d 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
@@ -32,6 +32,9 @@ import {
OnInit,
} from '@angular/core';
import { UIRouterGlobals } from '@uirouter/core';
+import { Observable } from 'rxjs';
+import { map, distinctUntilChanged } from 'rxjs/operators';
+import { take } from 'rxjs/internal/operators/take';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { ActivityEntryInfo } from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info';
@@ -39,10 +42,7 @@ import { WorkPackagesActivityService } from 'core-app/features/work-packages/com
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { Observable } from 'rxjs';
-import { map } from 'rxjs/operators';
import { WpSingleViewService } from 'core-app/features/work-packages/routing/wp-view-base/state/wp-single-view.service';
-import { take } from 'rxjs/internal/operators/take';
@Directive()
export class ActivityPanelBaseController extends UntilDestroyedMixin implements OnInit {
@@ -71,6 +71,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
private additionalScrollMargin = 200;
+ private initialized = false;
+
constructor(
readonly apiV3Service:APIV3Service,
readonly I18n:I18nService,
@@ -78,6 +80,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
readonly uiRouterGlobals:UIRouterGlobals,
readonly wpActivity:WorkPackagesActivityService,
readonly storeService:WpSingleViewService,
+ private wpSingleViewService:WpSingleViewService,
) {
super();
@@ -86,8 +89,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
}
ngOnInit():void {
- let initialized = false;
-
+ this.initialized = false;
this
.apiV3Service
.work_packages
@@ -96,15 +98,17 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
.pipe(this.untilDestroyed())
.subscribe((wp) => {
this.workPackage = wp;
- void this.wpActivity.require(this.workPackage).then((activities:HalResource[]) => {
- this.updateActivities(activities);
- this.cdRef.detectChanges();
-
- if (!initialized) {
- initialized = true;
- this.scrollIfNotificationPresent();
- }
- });
+ this.reloadActivities();
+ });
+
+ this.wpSingleViewService.query
+ .selectNotificationsCount$
+ .pipe(
+ this.untilDestroyed(),
+ distinctUntilChanged(),
+ )
+ .subscribe(() => {
+ this.reloadActivities();
});
}
@@ -118,6 +122,18 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
});
}
+ private reloadActivities() {
+ void this.wpActivity.require(this.workPackage, true).then((activities:HalResource[]) => {
+ this.updateActivities(activities);
+ this.cdRef.detectChanges();
+
+ if (!this.initialized) {
+ this.initialized = true;
+ this.scrollIfNotificationPresent();
+ }
+ });
+ }
+
protected updateActivities(activities:HalResource[]):void {
this.unfilteredActivities = activities;
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
index da085ee0e0b..5ed79df12c0 100644
--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
@@ -47,7 +47,7 @@ import { WpSingleViewService } from 'core-app/features/work-packages/routing/wp-
@Component({
templateUrl: './wp-split-view.html',
changeDetection: ChangeDetectionStrategy.OnPush,
- selector: 'wp-split-view-entry',
+ selector: 'op-wp-split-view',
providers: [
WpSingleViewService,
{ provide: HalResourceNotificationService, useClass: WorkPackageNotificationService },