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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
solving the mark-as-read buttons visibility issues and time lag of disappearing notification bubbles
Jonas Jabari42ec78236951
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.tsindex 27fc5ae873d..09ec66f06b7 100644--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts@@ -25,5 +25,10 @@ export class WorkPackageMarkNotificationButtonComponent {markAllBelongingNotificationsAsRead():void {this.storeService.markAllAsRead();+ // emit custom event in order to inform the activity tab stimulus controller+ // will trigger an update of the activities list+ document.dispatchEvent(+ new CustomEvent('work-package-notifications-updated'),+ );}}diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.tsindex dc09674332e..a6fa9558335 100644--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts@@ -30,6 +30,7 @@ import { WorkPackageResource } from 'core-app/features/hal/resources/work-packagimport { StateService } from '@uirouter/core';import {Component,+ HostListener,Injector,OnInit,} from '@angular/core';@@ -86,6 +87,14 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase impsuper(injector, $state.params.workPackageId);}+ // 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+ @HostListener('document:ian-update-immediate')+ triggerImmediateUpdate() {+ this.storeService.reload();+ }+ngOnInit():void {this.observeWorkPackage();}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.tsindex d1fb67ad878..9bb6d9ad11c 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@@ -26,7 +26,7 @@// See COPYRIGHT and LICENSE files for more details.//++-import { ChangeDetectionStrategy, Component, Injector, Input, OnInit, Type } from '@angular/core';+import { ChangeDetectionStrategy, Component, HostListener, Injector, Input, OnInit, Type } from '@angular/core';import { StateService } from '@uirouter/core';import {WorkPackageViewFocusService,@@ -93,6 +93,14 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase impsuper(injector, $state.params.workPackageId);}+ // 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+ @HostListener('document:ian-update-immediate')+ triggerImmediateUpdate() {+ this.storeService.reload();+ }+ngOnInit():void {this.observeWorkPackage();diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.tsindex 80caa796c8e..593b302cdb3 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts@@ -104,7 +104,7 @@ export class WpSingleViewService {});}- private reload() {+ reload() {this.currentUser$.isLoggedIn$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.tsindex 18bff6ddad2..cf2cc74fa9b 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@@ -106,12 +106,14 @@ export default class IndexController extends Controller {this.rescueEditorContentBound = () => { void this.rescueEditorContent(); };document.addEventListener('work-package-updated', this.handleWorkPackageUpdateBound);+ document.addEventListener('work-package-notifications-updated', this.handleWorkPackageUpdateBound);document.addEventListener('visibilitychange', this.handleVisibilityChangeBound);document.addEventListener('beforeunload', this.rescueEditorContentBound);}private removeEventListeners() {document.removeEventListener('work-package-updated', this.handleWorkPackageUpdateBound);+ document.removeEventListener('work-package-notifications-updated', this.handleWorkPackageUpdateBound);document.removeEventListener('visibilitychange', this.handleVisibilityChangeBound);document.removeEventListener('beforeunload', this.rescueEditorContentBound);}@@ -161,6 +163,8 @@ export default class IndexController extends Controller {}handleWorkPackageUpdate(_event?:Event):void {+ // wait statically as the events triggering this, fire when an async request was started, not ended+ // I don't see a way to detect the end of the async requests reliably, thus the static waitsetTimeout(() => this.updateActivitiesList(), 2000);}