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 showing date alert in other filters

Oliver Günthercfc1457224dc
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.ts
index 0b60c0ef89c..93c643c1358 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
@@ -83,11 +83,10 @@ export class IanCenterService extends UntilDestroyedMixin {
activeCollection$ = this.query.select('activeCollection');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- activeReason$:Observable<string|undefined> = this.uiRouterGlobals.params$!.pipe(
+ activeReason$:Observable<string|null> = this.uiRouterGlobals.params$!.pipe(
this.untilDestroyed(),
distinctUntilChanged(),
- filter((params) => params.filter === 'reason'),
- map((params) => params.name as string),
+ map((params) => params.filter === 'reason' ? (params.name as string) : null),
shareReplay(1),
);
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
index 3ebd60853ca..ad33bdf079e 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
@@ -87,15 +87,15 @@
<div
class="op-ian-item--bottom-line"
>
- <ng-container *ngIf="(showDateAlert$ | async) as showDateAlert">
+ <ng-container *ngIf="{ showDateAlert: (showDateAlert$ | async) } as context">
<op-in-app-notification-date-alert
- *ngIf="showDateAlert"
+ *ngIf="context.showDateAlert"
[workPackage]="workPackage"
[notification]="notification"
[aggregatedNotifications]="aggregatedNotifications"
></op-in-app-notification-date-alert>
<op-in-app-notification-actors-line
- *ngIf="!showDateAlert"
+ *ngIf="!context.showDateAlert"
[notification]="notification"
[aggregatedNotifications]="aggregatedNotifications"
></op-in-app-notification-actors-line>
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
index bcd8876f981..945e976ac0f 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
@@ -7,13 +7,18 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
-import { Observable } from 'rxjs';
+import {
+ Observable,
+ of,
+} from 'rxjs';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import {
+ defaultIfEmpty,
map,
+ shareReplay,
startWith,
tap,
} from 'rxjs/operators';
@@ -41,16 +46,18 @@ export class InAppNotificationEntryComponent implements OnInit {
workPackage$:Observable<WorkPackageResource>|null = null;
- dateAlertFiltered$:Observable<boolean> = this
+ showDateAlert$:Observable<boolean> = this
.storeService
.activeReason$
.pipe(
map((reason) => reason === 'date_alert'),
- startWith(false),
+ map((dateAlertFiltered) => {
+ const dateAlerts = this.aggregatedNotifications.filter((notification) => notification.reason === 'dateAlert');
+ return dateAlertFiltered || dateAlerts.length === this.aggregatedNotifications.length;
+ }),
+ shareReplay(1),
);
- showDateAlert$:Observable<boolean>;
-
loading$ = this.storeService.query.selectLoading();
stateChanged$ = this.storeService.stateChanged$;
@@ -79,7 +86,6 @@ export class InAppNotificationEntryComponent implements OnInit {
ngOnInit():void {
this.buildTranslatedReason();
- this.buildDateAlert();
this.buildProject();
this.loadWorkPackage();
}
@@ -153,15 +159,4 @@ export class InAppNotificationEntryComponent implements OnInit {
};
}
}
-
- private buildDateAlert() {
- this.showDateAlert$ = this
- .dateAlertFiltered$
- .pipe(
- map((dateAlertFiltered) => {
- const dateAlerts = this.aggregatedNotifications.filter((notification) => notification.reason === 'dateAlert');
- return dateAlertFiltered || dateAlerts.length === this.aggregatedNotifications.length;
- }),
- );
- }
}