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

chore[Op#54733]: extract feature flag check to function

Kabiru Mwenjadc24573acb03
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 524626c88e8..7080c6dfa45 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
@@ -284,6 +284,8 @@ export class IanCenterService extends UntilDestroyedMixin {
*/
@EffectCallback(notificationCountChanged)
private handleChangedNotificationCount() {
+ if (!this.primerizedActivitiesEnabled) return;
+
// update the UI state for increased AND decreased notifications, not only increased count
// decreasing the notification count could happen when the user itself
// marks notifications as read in the split view or on another tab
@@ -295,15 +297,13 @@ export class IanCenterService extends UntilDestroyedMixin {
true,
);
- if (this.configurationService.activeFeatureFlags.includes('primerizedWorkPackageActivities')) {
- // new concept for notification center:
- if (hasNewNotifications) {
- this.informAboutUnreadNotification();
- }
- // directly update the UI state in both cases (count increased or decreased)
- this.store.update({ activeCollection: collection });
- this.actions$.dispatch(centerUpdatedInPlace({ origin: this.id }));
+ // new concept for notification center:
+ if (hasNewNotifications) {
+ this.informAboutUnreadNotification();
}
+ // directly update the UI state in both cases (count increased or decreased)
+ this.store.update({ activeCollection: collection });
+ this.actions$.dispatch(centerUpdatedInPlace({ origin: this.id }));
});
this.reload.next(false);
}
@@ -313,13 +313,11 @@ export class IanCenterService extends UntilDestroyedMixin {
*/
@EffectCallback(notificationCountIncreased)
private checkForNewNotifications() {
- this.onReload.pipe(take(1)).subscribe((collection) => {
- // There is a new concept for primerized work package activities bound to notificationCountChanged
- // See @EffectCallback(notificationCountChanged)
- if (this.configurationService.activeFeatureFlags.includes('primerizedWorkPackageActivities')) {
- return;
- }
+ // There is a new concept for primerized work package activities bound to notificationCountChanged
+ // See @EffectCallback(notificationCountChanged)
+ if (this.primerizedActivitiesEnabled) return;
+ this.onReload.pipe(take(1)).subscribe((collection) => {
const { activeCollection } = this.query.getValue();
const hasNewNotifications = !collection.ids.reduce(
(allInOldCollection, id) => allInOldCollection && activeCollection.ids.includes(id),
@@ -361,6 +359,10 @@ export class IanCenterService extends UntilDestroyedMixin {
}
}
+ private get primerizedActivitiesEnabled():boolean {
+ return this.configurationService.activeFeatureFlags.includes('primerizedWorkPackageActivities');
+ }
+
private showNewNotificationToast():void {
this.hideNewNotifcationToast();
this.activeReloadToast = this.toastService.add({