Skip to content

Commit 5fc8378

Browse files
authored
Merge pull request #4231 from atmire/4099-duplicate-view-events_contibute-main
Fix for double view events when using dynamic themes
2 parents 7269f6c + bde54ca commit 5fc8378

27 files changed

+108
-105
lines changed

src/app/app-routes.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ import { reloadGuard } from './core/reload/reload.guard';
3333
import { forgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard';
3434
import { ServerCheckGuard } from './core/server-check/server-check.guard';
3535
import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component';
36+
import { homePageResolver } from './home-page/home-page.resolver';
3637
import { ITEM_MODULE_PATH } from './item-page/item-page-routing-paths';
3738
import { provideSuggestionNotificationsState } from './notifications/provide-suggestion-notifications-state';
3839
import { ThemedPageErrorComponent } from './page-error/themed-page-error.component';
3940
import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component';
4041
import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component';
4142
import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths';
43+
import { viewTrackerResolver } from './statistics/angulartics/dspace/view-tracker.resolver';
4244
import { provideSubmissionState } from './submission/provide-submission-state';
4345
import { SUGGESTION_MODULE_PATH } from './suggestions-page/suggestions-page-routing-paths';
4446

@@ -61,9 +63,17 @@ export const APP_ROUTES: Route[] = [
6163
path: 'home',
6264
loadChildren: () => import('./home-page/home-page-routes')
6365
.then((m) => m.ROUTES),
64-
data: { showBreadcrumbs: false, enableRSS: true },
66+
data: {
67+
showBreadcrumbs: false,
68+
enableRSS: true,
69+
dsoPath: 'site',
70+
},
6571
providers: [provideSuggestionNotificationsState()],
6672
canActivate: [endUserAgreementCurrentUserGuard],
73+
resolve: {
74+
site: homePageResolver,
75+
tracking: viewTrackerResolver,
76+
},
6777
},
6878
{
6979
path: 'community-list',

src/app/collection-page/collection-page-routes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.reso
99
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
1010
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';
1111
import { MenuRoute } from '../shared/menu/menu-route.model';
12+
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
1213
import { collectionPageResolver } from './collection-page.resolver';
1314
import { collectionPageAdministratorGuard } from './collection-page-administrator.guard';
1415
import {
@@ -115,6 +116,9 @@ export const ROUTES: Route[] = [
115116
},
116117
},
117118
],
119+
resolve: {
120+
tracking: viewTrackerResolver,
121+
},
118122
},
119123
],
120124
},

src/app/collection-page/collection-page.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<div @fadeInOut>
66
@if (collectionRD?.payload; as collection) {
77
<div>
8-
<ds-view-tracker [object]="collection"></ds-view-tracker>
98
<div class="d-flex flex-row border-bottom mb-4 pb-4">
109
<header class="comcol-header me-auto">
1110
<!-- Collection Name -->

src/app/collection-page/collection-page.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import { ThemedLoadingComponent } from '../shared/loading/themed-loading.compone
4747
import { ObjectCollectionComponent } from '../shared/object-collection/object-collection.component';
4848
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
4949
import { VarDirective } from '../shared/utils/var.directive';
50-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
5150
import { getCollectionPageRoute } from './collection-page-routing-paths';
5251

5352
@Component({
@@ -64,7 +63,6 @@ import { getCollectionPageRoute } from './collection-page-routing-paths';
6463
ErrorComponent,
6564
ThemedLoadingComponent,
6665
TranslateModule,
67-
ViewTrackerComponent,
6866
VarDirective,
6967
AsyncPipe,
7068
ComcolPageHeaderComponent,

src/app/community-page/community-page-routes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.reso
88
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
99
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';
1010
import { MenuRoute } from '../shared/menu/menu-route.model';
11+
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
1112
import { communityPageResolver } from './community-page.resolver';
1213
import { communityPageAdministratorGuard } from './community-page-administrator.guard';
1314
import {
@@ -70,6 +71,9 @@ export const ROUTES: Route[] = [
7071
data: {
7172
menuRoute: MenuRoute.COMMUNITY_PAGE,
7273
},
74+
resolve: {
75+
tracking: viewTrackerResolver,
76+
},
7377
children: [
7478
{
7579
path: '',

src/app/community-page/community-page.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<div class="community-page" @fadeInOut>
44
@if (communityRD?.payload; as communityPayload) {
55
<div>
6-
<ds-view-tracker [object]="communityPayload"></ds-view-tracker>
76
<div class="d-flex flex-row border-bottom mb-4 pb-4">
87
<header class="comcol-header me-auto">
98
<!-- Community name -->

src/app/community-page/community-page.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { hasValue } from '../shared/empty.util';
3838
import { ErrorComponent } from '../shared/error/error.component';
3939
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
4040
import { VarDirective } from '../shared/utils/var.directive';
41-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
4241
import { getCommunityPageRoute } from './community-page-routing-paths';
4342
import { ThemedCollectionPageSubCollectionListComponent } from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
4443
import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com-col-section/sub-community-list/themed-community-page-sub-community-list.component';
@@ -62,7 +61,6 @@ import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com
6261
ComcolPageLogoComponent,
6362
ComcolPageHeaderComponent,
6463
AsyncPipe,
65-
ViewTrackerComponent,
6664
VarDirective,
6765
RouterOutlet,
6866
RouterModule,

src/app/home-page/home-page-routes.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Route } from '@angular/router';
22

33
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
44
import { MenuItemType } from '../shared/menu/menu-item-type.model';
5-
import { homePageResolver } from './home-page.resolver';
65
import { ThemedHomePageComponent } from './themed-home-page.component';
76

87
export const ROUTES: Route[] = [
@@ -26,8 +25,5 @@ export const ROUTES: Route[] = [
2625
}],
2726
},
2827
},
29-
resolve: {
30-
site: homePageResolver,
31-
},
3228
},
3329
];

src/app/home-page/home-page.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
<ds-suggestions-popup></ds-suggestions-popup>
1919

2020
<ng-template #homeContent>
21-
@if ((site$ | async); as site) {
22-
<ds-view-tracker [object]="site"></ds-view-tracker>
23-
}
2421
<ds-search-form [inPlaceSearch]="false"
2522
[searchPlaceholder]="'home.search-form.placeholder' | translate">
2623
</ds-search-form>

src/app/home-page/home-page.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { SuggestionsPopupComponent } from '../notifications/suggestions/popup/su
2222
import { ThemedConfigurationSearchPageComponent } from '../search-page/themed-configuration-search-page.component';
2323
import { ThemedSearchFormComponent } from '../shared/search-form/themed-search-form.component';
2424
import { PageWithSidebarComponent } from '../shared/sidebar/page-with-sidebar.component';
25-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
2625
import { HomeCoarComponent } from './home-coar/home-coar.component';
2726
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
2827
import { RecentItemListComponent } from './recent-item-list/recent-item-list.component';
@@ -33,7 +32,7 @@ import { ThemedTopLevelCommunityListComponent } from './top-level-community-list
3332
styleUrls: ['./home-page.component.scss'],
3433
templateUrl: './home-page.component.html',
3534
standalone: true,
36-
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ViewTrackerComponent, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
35+
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
3736
})
3837
export class HomePageComponent implements OnInit {
3938

0 commit comments

Comments
 (0)