From 983c86eb4d52e9694cc10c3d15abddf64ff46731 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 1 May 2023 19:36:03 +0300 Subject: [PATCH] UI: Do not report visited dashboard for public user --- .../home/pages/dashboard/dashboard-routing.module.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts index 17686602a3..a7ea52f56f 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts @@ -22,18 +22,22 @@ import { Authority } from '@shared/models/authority.enum'; import { DashboardsTableConfigResolver } from './dashboards-table-config.resolver'; import { DashboardPageComponent } from '@home/components/dashboard-page/dashboard-page.component'; import { BreadCrumbConfig, BreadCrumbLabelFunction } from '@shared/components/breadcrumb'; -import { mergeMap, Observable } from 'rxjs'; +import { mergeMap, Observable, of } from 'rxjs'; import { Dashboard } from '@app/shared/models/dashboard.models'; import { DashboardService } from '@core/http/dashboard.service'; import { DashboardUtilsService } from '@core/services/dashboard-utils.service'; import { map } from 'rxjs/operators'; import { UserSettingsService } from '@core/http/user-settings.service'; import { UserDashboardAction } from '@shared/models/user-settings.models'; +import { Store } from '@ngrx/store'; +import { AppState } from '@core/core.state'; +import { getCurrentAuthUser } from '@core/auth/auth.selectors'; @Injectable() export class DashboardResolver implements Resolve { - constructor(private dashboardService: DashboardService, + constructor(private store: Store, + private dashboardService: DashboardService, private userSettingService: UserSettingsService, private dashboardUtils: DashboardUtilsService) { } @@ -42,7 +46,8 @@ export class DashboardResolver implements Resolve { const dashboardId = route.params.dashboardId; return this.dashboardService.getDashboard(dashboardId).pipe( mergeMap((dashboard) => - this.userSettingService.reportUserDashboardAction(dashboardId, UserDashboardAction.VISIT, {ignoreLoading: true}).pipe( + (getCurrentAuthUser(this.store).isPublic ? of(null) : + this.userSettingService.reportUserDashboardAction(dashboardId, UserDashboardAction.VISIT, {ignoreLoading: true})).pipe( map(() => dashboard) )), map((dashboard) => this.dashboardUtils.validateAndUpdateDashboard(dashboard))