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

Remove old notification reload toasts

Benjamin Bädorfa5f394b0979a
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 ef0b4e5c6e3..4c84a5c5e17 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
@@ -21,7 +21,7 @@ import {
setLoading,
} from '@datorama/akita';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { ToastService } from 'core-app/shared/components/toaster/toast.service';
+import { IToast, ToastService } from 'core-app/shared/components/toaster/toast.service';
import {
centerUpdatedInPlace,
markNotificationsAsRead,
@@ -61,6 +61,8 @@ export class IanCenterService extends UntilDestroyedMixin {
readonly query = new IanCenterQuery(this.store, this.resourceService);
+ private activeReloadToast:IToast|null = null;
+
private reload = new Subject();
private onReload = this.reload.pipe(
@@ -186,7 +188,12 @@ export class IanCenterService extends UntilDestroyedMixin {
return;
}
- this.toastService.add({
+ if (this.activeReloadToast) {
+ this.toastService.remove(this.activeReloadToast);
+ this.activeReloadToast = null;
+ }
+
+ this.activeReloadToast = this.toastService.add({
type: 'info',
message: this.I18n.t('js.notifications.center.new_notifications.message'),
link: {
@@ -194,6 +201,7 @@ export class IanCenterService extends UntilDestroyedMixin {
target: () => {
this.store.update({ activeCollection: collection });
this.actions$.dispatch(centerUpdatedInPlace({ origin: this.id }));
+ this.activeReloadToast = null;
},
},
});