diff --git a/src/app/search-page/configuration-search-page.component.ts b/src/app/search-page/configuration-search-page.component.ts index 768149de6a..9196dda025 100644 --- a/src/app/search-page/configuration-search-page.component.ts +++ b/src/app/search-page/configuration-search-page.component.ts @@ -8,6 +8,7 @@ import { SearchConfigurationService } from '../core/shared/search/search-configu import { RouteService } from '../core/services/route.service'; import { SearchService } from '../core/shared/search/search.service'; import { Router } from '@angular/router'; +import { APP_CONFIG, AppConfig } from '../../config/app-config.interface'; /** * This component renders a search page using a configuration as input. @@ -32,7 +33,9 @@ export class ConfigurationSearchPageComponent extends SearchComponent { protected windowService: HostWindowService, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, protected routeService: RouteService, - protected router: Router) { - super(service, sidebarService, windowService, searchConfigService, routeService, router); + protected router: Router, + @Inject(APP_CONFIG) protected appConfig: AppConfig, + ) { + super(service, sidebarService, windowService, searchConfigService, routeService, router, appConfig); } } diff --git a/src/app/shared/search/search.component.spec.ts b/src/app/shared/search/search.component.spec.ts index 9d069636a9..69f4dfd6aa 100644 --- a/src/app/shared/search/search.component.spec.ts +++ b/src/app/shared/search/search.component.spec.ts @@ -33,6 +33,8 @@ import { SearchFilterConfig } from './models/search-filter-config.model'; import { FilterType } from './models/filter-type.model'; import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths'; import { getCollectionPageRoute } from '../../collection-page/collection-page-routing-paths'; +import { environment } from '../../../environments/environment.test'; +import { APP_CONFIG } from '../../../config/app-config.interface'; let comp: SearchComponent; let fixture: ComponentFixture; @@ -209,7 +211,8 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar { provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigurationServiceStub - } + }, + { provide: APP_CONFIG, useValue: environment }, ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(compType, { diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index ef3dfbc456..492c0e3d6b 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -31,13 +31,13 @@ import { ViewMode } from '../../core/shared/view-mode.model'; import { SelectionConfig } from './search-results/search-results.component'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { CollectionElementLinkType } from '../object-collection/collection-element-link.type'; -import { environment } from 'src/environments/environment'; import { SubmissionObject } from '../../core/submission/models/submission-object.model'; import { SearchFilterConfig } from './models/search-filter-config.model'; import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model'; import { ITEM_MODULE_PATH } from '../../item-page/item-page-routing-paths'; import { COLLECTION_MODULE_PATH } from '../../collection-page/collection-page-routing-paths'; import { COMMUNITY_MODULE_PATH } from '../../community-page/community-page-routing-paths'; +import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface'; @Component({ selector: 'ds-search', @@ -283,7 +283,9 @@ export class SearchComponent implements OnDestroy, OnInit { protected windowService: HostWindowService, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, protected routeService: RouteService, - protected router: Router) { + protected router: Router, + @Inject(APP_CONFIG) protected appConfig: AppConfig, + ) { this.isXsOrSm$ = this.windowService.isXsOrSm(); } @@ -450,8 +452,10 @@ export class SearchComponent implements OnDestroy, OnInit { let followLinks = [ followLink('thumbnail', { isOptional: true }), followLink('item', { isOptional: true }, followLink('thumbnail', { isOptional: true })) as any, - followLink('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }), ]; + if (this.appConfig.item.showAccessStatuses) { + followLinks.push(followLink('accessStatus', { isOptional: true })); + } if (this.configuration === 'supervision') { followLinks.push(followLink('supervisionOrders', { isOptional: true }) as any); }