diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts index 6fd992e0db..a9f3ffc0fe 100644 --- a/frontend/src/app/core/path-helper/path-helper.service.ts +++ b/frontend/src/app/core/path-helper/path-helper.service.ts @@ -108,6 +108,10 @@ export class PathHelperService { return `${this.staticBase}/news/${newsId}`; } + public notificationsPath():string { + return `${this.staticBase}/notifications`; + } + public loginPath() { return `${this.staticBase}/login`; } diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html index 528950d02a..83a445e898 100644 --- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html +++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html @@ -1,7 +1,7 @@ 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 69c27c92ca..434bce9255 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 @@ -5,6 +5,7 @@ import { OpModalService } from 'core-app/shared/components/modal/modal.service'; import { merge, timer } from 'rxjs'; import { filter, switchMap } from 'rxjs/operators'; import { ActiveWindowService } from 'core-app/core/active-window/active-window.service'; +import { PathHelperService } from 'core-app/core/path-helper/path-helper.service'; export const opInAppNotificationBellSelector = 'op-in-app-notification-bell'; const POLLING_INTERVAL = 10000; @@ -27,9 +28,15 @@ export class InAppNotificationBellComponent { this.inAppQuery.unreadCount$, ); - constructor(readonly inAppQuery:InAppNotificationsQuery, + constructor( + readonly inAppQuery:InAppNotificationsQuery, readonly inAppService:InAppNotificationsService, readonly activeWindow:ActiveWindowService, - readonly modalService:OpModalService) { + readonly modalService:OpModalService, + readonly pathHelper:PathHelperService, + ) {} + + notificationsPath():string { + return this.pathHelper.notificationsPath(); } } diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts index ed5ab42f2b..e71874709e 100644 --- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts +++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts @@ -76,12 +76,9 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im }, ]; - /** Global referrer set when coming from a hard reload */ + /** Global referrer set when coming to the notification center */ private documentReferer:string; - /** Local referrer set when coming from an angular route */ - private backRoute:BackRouteOptions; - constructor( readonly I18n:I18nService, readonly cdRef:ChangeDetectorRef, @@ -96,7 +93,6 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im } ngOnInit():void { - this.backRoute = this.backRoutingService.backRoute; this.documentReferer = document.referrer; } @@ -119,11 +115,6 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im changeChangesFromTitle(val:string):void {} private backButtonFn():void { - if (this.backRoute) { - void this.backRoutingService.goToOtherState(this.backRoute.name, this.backRoute.params); - return; - } - if (this.documentReferer.length > 0) { window.location.href = this.documentReferer; } else { diff --git a/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts b/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts index a94051e48b..097c989a2f 100644 --- a/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts +++ b/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts @@ -49,7 +49,7 @@ export class BackRoutingService { constructor(readonly injector:Injector) { } - public goToOtherState(route:string, params:Record):Promise { + private goToOtherState(route:string, params:Record):Promise { return this.$state.go(route, params); } diff --git a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts index 022e7f636b..b3fd246529 100644 --- a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts +++ b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts @@ -64,7 +64,6 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ component: WorkPackageNewFullViewComponent, reloadOnSearch: false, data: { - parent: 'work-packages', baseRoute: 'work-packages', allowMovingInEditMode: true, bodyClasses: 'router--work-packages-full-create', @@ -77,7 +76,6 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ component: WorkPackageCopyFullViewComponent, reloadOnSearch: false, data: { - parent: 'work-packages', baseRoute: 'work-packages', allowMovingInEditMode: true, bodyClasses: 'router--work-packages-full-create', @@ -97,7 +95,6 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ }, component: WorkPackagesFullViewComponent, data: { - parent: 'work-packages', baseRoute: 'work-packages', bodyClasses: 'router--work-packages-full-view', newRoute: 'work-packages.new', @@ -109,7 +106,7 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ url: '/:tabIdentifier', component: WpTabWrapperComponent, data: { - parent: 'work-packages', + parent: 'work-packages.show', menuItem: menuItemClass, }, }, @@ -118,7 +115,6 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ component: WorkPackageViewPageComponent, url: '', data: { - parent: 'work-packages', // This has to be empty to avoid inheriting the parent bodyClasses bodyClasses: '', }, @@ -131,7 +127,6 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [ 'content-left': { component: WorkPackageListViewComponent }, }, data: { - parent: 'work-packages', bodyClasses: 'router--work-packages-partitioned-split-view', menuItem: menuItemClass, partition: '-left-only', diff --git a/frontend/src/app/shared/components/calendar/openproject-calendar.module.ts b/frontend/src/app/shared/components/calendar/openproject-calendar.module.ts index 44cd619aec..b1e5d097ab 100644 --- a/frontend/src/app/shared/components/calendar/openproject-calendar.module.ts +++ b/frontend/src/app/shared/components/calendar/openproject-calendar.module.ts @@ -48,6 +48,7 @@ export const CALENDAR_ROUTES:Ng2StateDeclaration[] = [ data: { bodyClasses: 'router--work-packages-calendar', menuItem: menuItemClass, + parent: 'work-packages', }, }, ]; diff --git a/spec/features/notifications/navigation_spec.rb b/spec/features/notifications/navigation_spec.rb index 08bc5616e8..3cab2df8f2 100644 --- a/spec/features/notifications/navigation_spec.rb +++ b/spec/features/notifications/navigation_spec.rb @@ -43,9 +43,8 @@ describe "Notification center navigation", type: :feature, js: true do navigation_helper.open_center_and_navigate_within expect(page).to have_current_path home_path - # Todo Implement (#38564) - # navigation_helper.open_center_and_navigate_out - # expect(current_path).to eq home_path + navigation_helper.open_center_and_navigate_out + expect(page).to have_current_path home_path end it 'when coming from an angular page' do @@ -57,9 +56,8 @@ describe "Notification center navigation", type: :feature, js: true do navigation_helper.open_center_and_navigate_within expect(page).to have_current_path project_work_package_path(project, work_package, state: 'activity') - # Todo: Implement (#38564) - # navigation_helper.open_center_and_navigate_out - # visit project_work_package_path(project, work_package, state: 'activity') + navigation_helper.open_center_and_navigate_out + expect(page).to have_current_path project_work_package_path(project, work_package, state: 'activity') end end