Merge pull request #9579 from opf/fix/38564-Cant-close-the-notification-center-once-I-went-to-full-screen

Load notification center with a hard reload and fix back button functionality
pull/9587/head
Henriette Darge 3 years ago committed by GitHub
commit 21818dab16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      frontend/src/app/core/path-helper/path-helper.service.ts
  2. 2
      frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
  3. 11
      frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
  4. 11
      frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
  5. 2
      frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts
  6. 7
      frontend/src/app/features/work-packages/routing/work-packages-routes.ts
  7. 1
      frontend/src/app/shared/components/calendar/openproject-calendar.module.ts
  8. 10
      spec/features/notifications/navigation_spec.rb

@ -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`;
}

@ -1,7 +1,7 @@
<a
class="op-ian-bell op-app-menu--item-action"
data-qa-selector="op-ian-bell"
uiSref="notifications"
[href]="notificationsPath()"
>
<op-icon icon-classes="icon-bell">
</op-icon>

@ -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();
}
}

@ -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 {

@ -49,7 +49,7 @@ export class BackRoutingService {
constructor(readonly injector:Injector) {
}
public goToOtherState(route:string, params:Record<string, unknown>):Promise<unknown> {
private goToOtherState(route:string, params:Record<string, unknown>):Promise<unknown> {
return this.$state.go(route, params);
}

@ -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',

@ -48,6 +48,7 @@ export const CALENDAR_ROUTES:Ng2StateDeclaration[] = [
data: {
bodyClasses: 'router--work-packages-calendar',
menuItem: menuItemClass,
parent: 'work-packages',
},
},
];

@ -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

Loading…
Cancel
Save