Skip to content

Commit 5590ef4

Browse files
Merge branch 'added-recently-added-section-to-community-page_contribute-7.6' into added-recently-added-section-to-community-page_contribute-main
2 parents 9ff3ed4 + 37c534b commit 5590ef4

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/app/search-page/configuration-search-page.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { SearchConfigurationService } from '../core/shared/search/search-configu
88
import { RouteService } from '../core/services/route.service';
99
import { SearchService } from '../core/shared/search/search.service';
1010
import { Router } from '@angular/router';
11+
import { APP_CONFIG, AppConfig } from '../../config/app-config.interface';
1112

1213
/**
1314
* This component renders a search page using a configuration as input.
@@ -32,7 +33,9 @@ export class ConfigurationSearchPageComponent extends SearchComponent {
3233
protected windowService: HostWindowService,
3334
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
3435
protected routeService: RouteService,
35-
protected router: Router) {
36-
super(service, sidebarService, windowService, searchConfigService, routeService, router);
36+
protected router: Router,
37+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
38+
) {
39+
super(service, sidebarService, windowService, searchConfigService, routeService, router, appConfig);
3740
}
3841
}

src/app/shared/search/search.component.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import { SearchFilterConfig } from './models/search-filter-config.model';
3333
import { FilterType } from './models/filter-type.model';
3434
import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths';
3535
import { getCollectionPageRoute } from '../../collection-page/collection-page-routing-paths';
36+
import { environment } from '../../../environments/environment.test';
37+
import { APP_CONFIG } from '../../../config/app-config.interface';
3638

3739
let comp: SearchComponent;
3840
let fixture: ComponentFixture<SearchComponent>;
@@ -209,7 +211,8 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
209211
{
210212
provide: SEARCH_CONFIG_SERVICE,
211213
useValue: searchConfigurationServiceStub
212-
}
214+
},
215+
{ provide: APP_CONFIG, useValue: environment },
213216
],
214217
schemas: [NO_ERRORS_SCHEMA]
215218
}).overrideComponent(compType, {

src/app/shared/search/search.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ import { ViewMode } from '../../core/shared/view-mode.model';
3131
import { SelectionConfig } from './search-results/search-results.component';
3232
import { ListableObject } from '../object-collection/shared/listable-object.model';
3333
import { CollectionElementLinkType } from '../object-collection/collection-element-link.type';
34-
import { environment } from 'src/environments/environment';
3534
import { SubmissionObject } from '../../core/submission/models/submission-object.model';
3635
import { SearchFilterConfig } from './models/search-filter-config.model';
3736
import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model';
3837
import { ITEM_MODULE_PATH } from '../../item-page/item-page-routing-paths';
3938
import { COLLECTION_MODULE_PATH } from '../../collection-page/collection-page-routing-paths';
4039
import { COMMUNITY_MODULE_PATH } from '../../community-page/community-page-routing-paths';
40+
import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface';
4141

4242
@Component({
4343
selector: 'ds-search',
@@ -283,7 +283,9 @@ export class SearchComponent implements OnDestroy, OnInit {
283283
protected windowService: HostWindowService,
284284
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
285285
protected routeService: RouteService,
286-
protected router: Router) {
286+
protected router: Router,
287+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
288+
) {
287289
this.isXsOrSm$ = this.windowService.isXsOrSm();
288290
}
289291

@@ -450,8 +452,10 @@ export class SearchComponent implements OnDestroy, OnInit {
450452
let followLinks = [
451453
followLink<Item>('thumbnail', { isOptional: true }),
452454
followLink<SubmissionObject>('item', { isOptional: true }, followLink<Item>('thumbnail', { isOptional: true })) as any,
453-
followLink<Item>('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }),
454455
];
456+
if (this.appConfig.item.showAccessStatuses) {
457+
followLinks.push(followLink<Item>('accessStatus', { isOptional: true }));
458+
}
455459
if (this.configuration === 'supervision') {
456460
followLinks.push(followLink<WorkspaceItem>('supervisionOrders', { isOptional: true }) as any);
457461
}

0 commit comments

Comments
 (0)