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

Bug/58787 notification banner is showing up on all pages (#17114)

jjabari-opc672fd95ecd7
diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
index 417a2534b2b..180d9489f87 100644
--- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
+++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, HostListener } from '@angular/core';
import { combineLatest, merge, Observable, timer } from 'rxjs';
import { filter, map, shareReplay, switchMap, throttleTime } from 'rxjs/operators';
import { ActiveWindowService } from 'core-app/core/active-window/active-window.service';
@@ -33,6 +33,15 @@ export class InAppNotificationBellComponent implements OnInit {
populateInputsFromDataset(this);
}
+ // enable other parts of the application to trigger an immediate update
+ // e.g. a stimulus controller
+ // currently used by the new activities tab which does it's own polling
+ // and receives updates from the backend earlier than the polling in the bell component
+ @HostListener('document:ian-update-immediate')
+ triggerImmediateUpdate() {
+ this.storeService.fetchUnread().subscribe();
+ }
+
ngOnInit() {
this.polling$ = merge(
timer(10, this.interval).pipe(filter(() => this.activeWindow.isActive)),
diff --git a/frontend/src/app/features/plugins/plugin-context.ts b/frontend/src/app/features/plugins/plugin-context.ts
index 56550723912..9153da3a897 100644
--- a/frontend/src/app/features/plugins/plugin-context.ts
+++ b/frontend/src/app/features/plugins/plugin-context.ts
@@ -33,7 +33,6 @@ import { AttachmentsResourceService } from 'core-app/core/state/attachments/atta
import { HttpClient } from '@angular/common/http';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';
-import { IanCenterService } from 'core-app/features/in-app-notifications/center/state/ian-center.service';
/**
* Plugin context bridge for plugins outside the CLI compiler context
* in order to access services and parts of the core application
@@ -69,7 +68,6 @@ export class OpenProjectPluginContext {
attachmentsResourceService: this.injector.get(AttachmentsResourceService),
http: this.injector.get(HttpClient),
turboRequests: this.injector.get(TurboRequestsService),
- ianCenter: this.injector.get(IanCenterService),
};
public readonly helpers = {
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index 51da1617736..f6cbe05bef8 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
@@ -4,7 +4,6 @@ import {
} from 'core-app/shared/components/editor/components/ckeditor/ckeditor.types';
import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { IanCenterService } from 'core-app/features/in-app-notifications/center/state/ian-center.service';
interface CustomEventWithIdParam extends Event {
params:{
@@ -56,13 +55,11 @@ export default class IndexController extends Controller {
private turboRequests:TurboRequestsService;
private apiV3Service:ApiV3Service;
- private ianCenterService:IanCenterService;
async connect() {
const context = await window.OpenProject.getPluginContext();
this.turboRequests = context.services.turboRequests;
this.apiV3Service = context.services.apiV3Service;
- this.ianCenterService = context.services.ianCenter;
this.setLocalStorageKey();
this.setLastUpdateTimestamp();
@@ -224,7 +221,7 @@ export default class IndexController extends Controller {
}
private updateNotificationCenter() {
- this.ianCenterService.updateImmediate();
+ document.dispatchEvent(new Event('ian-update-immediate'));
}
private performAutoScrolling(html:string, journalsContainerAtBottom:boolean) {