110889: Don't retrieve the accessStatus when item.showAccessStatuses is false

This commit is contained in:
Alexandre Vryghem
2024-02-18 17:42:53 +01:00
parent 877c2d4eaa
commit 37c534b809
3 changed files with 16 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import { SearchConfigurationService } from '../core/shared/search/search-configu
import { RouteService } from '../core/services/route.service'; import { RouteService } from '../core/services/route.service';
import { SearchService } from '../core/shared/search/search.service'; import { SearchService } from '../core/shared/search/search.service';
import { Router } from '@angular/router'; 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. * This component renders a search page using a configuration as input.
@@ -32,7 +33,9 @@ export class ConfigurationSearchPageComponent extends SearchComponent {
protected windowService: HostWindowService, protected windowService: HostWindowService,
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
protected routeService: RouteService, protected routeService: RouteService,
protected router: Router) { protected router: Router,
super(service, sidebarService, windowService, searchConfigService, routeService, router); @Inject(APP_CONFIG) protected appConfig: AppConfig,
) {
super(service, sidebarService, windowService, searchConfigService, routeService, router, appConfig);
} }
} }

View File

@@ -33,6 +33,8 @@ import { SearchFilterConfig } from './models/search-filter-config.model';
import { FilterType } from './models/filter-type.model'; import { FilterType } from './models/filter-type.model';
import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths'; import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths';
import { getCollectionPageRoute } from '../../collection-page/collection-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 comp: SearchComponent;
let fixture: ComponentFixture<SearchComponent>; let fixture: ComponentFixture<SearchComponent>;
@@ -209,7 +211,8 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
{ {
provide: SEARCH_CONFIG_SERVICE, provide: SEARCH_CONFIG_SERVICE,
useValue: searchConfigurationServiceStub useValue: searchConfigurationServiceStub
} },
{ provide: APP_CONFIG, useValue: environment },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(compType, { }).overrideComponent(compType, {

View File

@@ -31,13 +31,13 @@ import { ViewMode } from '../../core/shared/view-mode.model';
import { SelectionConfig } from './search-results/search-results.component'; import { SelectionConfig } from './search-results/search-results.component';
import { ListableObject } from '../object-collection/shared/listable-object.model'; import { ListableObject } from '../object-collection/shared/listable-object.model';
import { CollectionElementLinkType } from '../object-collection/collection-element-link.type'; 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 { SubmissionObject } from '../../core/submission/models/submission-object.model';
import { SearchFilterConfig } from './models/search-filter-config.model'; import { SearchFilterConfig } from './models/search-filter-config.model';
import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model'; import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model';
import { ITEM_MODULE_PATH } from '../../item-page/item-page-routing-paths'; import { ITEM_MODULE_PATH } from '../../item-page/item-page-routing-paths';
import { COLLECTION_MODULE_PATH } from '../../collection-page/collection-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 { COMMUNITY_MODULE_PATH } from '../../community-page/community-page-routing-paths';
import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface';
@Component({ @Component({
selector: 'ds-search', selector: 'ds-search',
@@ -283,7 +283,9 @@ export class SearchComponent implements OnDestroy, OnInit {
protected windowService: HostWindowService, protected windowService: HostWindowService,
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
protected routeService: RouteService, protected routeService: RouteService,
protected router: Router) { protected router: Router,
@Inject(APP_CONFIG) protected appConfig: AppConfig,
) {
this.isXsOrSm$ = this.windowService.isXsOrSm(); this.isXsOrSm$ = this.windowService.isXsOrSm();
} }
@@ -450,8 +452,10 @@ export class SearchComponent implements OnDestroy, OnInit {
let followLinks = [ let followLinks = [
followLink<Item>('thumbnail', { isOptional: true }), followLink<Item>('thumbnail', { isOptional: true }),
followLink<SubmissionObject>('item', { isOptional: true }, followLink<Item>('thumbnail', { isOptional: true })) as any, followLink<SubmissionObject>('item', { isOptional: true }, followLink<Item>('thumbnail', { isOptional: true })) as any,
followLink<Item>('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }),
]; ];
if (this.appConfig.item.showAccessStatuses) {
followLinks.push(followLink<Item>('accessStatus', { isOptional: true }));
}
if (this.configuration === 'supervision') { if (this.configuration === 'supervision') {
followLinks.push(followLink<WorkspaceItem>('supervisionOrders', { isOptional: true }) as any); followLinks.push(followLink<WorkspaceItem>('supervisionOrders', { isOptional: true }) as any);
} }