118944: Embed the accessStatus link on collection, browse, recent item submissions & the item page related items & delete tab when enabled

This commit is contained in:
Alexandre Vryghem
2024-10-11 14:59:34 +02:00
parent 4af88997e8
commit b709ee0300
14 changed files with 67 additions and 55 deletions

View File

@@ -28,7 +28,7 @@ import { AuthorizationDataService } from '../core/data/feature-authorization/aut
import { FeatureID } from '../core/data/feature-authorization/feature-id'; import { FeatureID } from '../core/data/feature-authorization/feature-id';
import { getCollectionPageRoute } from './collection-page-routing-paths'; import { getCollectionPageRoute } from './collection-page-routing-paths';
import { redirectOn4xx } from '../core/shared/authorized.operators'; import { redirectOn4xx } from '../core/shared/authorized.operators';
import { BROWSE_LINKS_TO_FOLLOW } from '../core/browse/browse.service'; import { getBrowseLinksToFollow } from '../core/browse/browse.service';
import { DSONameService } from '../core/breadcrumbs/dso-name.service'; import { DSONameService } from '../core/breadcrumbs/dso-name.service';
import { APP_CONFIG, AppConfig } from '../../../src/config/app-config.interface'; import { APP_CONFIG, AppConfig } from '../../../src/config/app-config.interface';
@@ -115,7 +115,7 @@ export class CollectionPageComponent implements OnInit {
pagination: currentPagination, pagination: currentPagination,
sort: currentSort, sort: currentSort,
dsoTypes: [DSpaceObjectType.ITEM] dsoTypes: [DSpaceObjectType.ITEM]
}), null, true, true, ...BROWSE_LINKS_TO_FOLLOW) }), null, true, true, ...getBrowseLinksToFollow())
.pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>; .pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
}), }),
startWith(undefined) // Make sure switching pages shows loading component startWith(undefined) // Make sure switching pages shows loading component

View File

@@ -4,7 +4,7 @@ import { ItemDataService } from '../data/item-data.service';
import { Item } from '../shared/item.model'; import { Item } from '../shared/item.model';
import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver'; import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver';
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { ITEM_PAGE_LINKS_TO_FOLLOW } from '../../item-page/item.resolver'; import { getItemPageLinksToFollow } from '../../item-page/item.resolver';
/** /**
* The class that resolves the BreadcrumbConfig object for an Item * The class that resolves the BreadcrumbConfig object for an Item
@@ -23,6 +23,6 @@ export class ItemBreadcrumbResolver extends DSOBreadcrumbResolver<Item> {
* Requesting them as embeds will limit the number of requests * Requesting them as embeds will limit the number of requests
*/ */
get followLinks(): FollowLinkConfig<Item>[] { get followLinks(): FollowLinkConfig<Item>[] {
return ITEM_PAGE_LINKS_TO_FOLLOW; return getItemPageLinksToFollow();
} }
} }

View File

@@ -1,10 +1,8 @@
import { cold, getTestScheduler, hot } from 'jasmine-marbles'; import { cold, getTestScheduler, hot } from 'jasmine-marbles';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { TestScheduler } from 'rxjs/testing'; import { TestScheduler } from 'rxjs/testing';
import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-build.service.mock';
import { getMockRequestService } from '../../shared/mocks/request.service.mock'; import { getMockRequestService } from '../../shared/mocks/request.service.mock';
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub'; import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { RequestService } from '../data/request.service'; import { RequestService } from '../data/request.service';
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model'; import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
import { BrowseService } from './browse.service'; import { BrowseService } from './browse.service';
@@ -20,7 +18,6 @@ describe('BrowseService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: BrowseService; let service: BrowseService;
let requestService: RequestService; let requestService: RequestService;
let rdbService: RemoteDataBuildService;
const browsesEndpointURL = 'https://rest.api/browses'; const browsesEndpointURL = 'https://rest.api/browses';
const halService: any = new HALEndpointServiceStub(browsesEndpointURL); const halService: any = new HALEndpointServiceStub(browsesEndpointURL);
@@ -118,7 +115,6 @@ describe('BrowseService', () => {
halService, halService,
browseDefinitionDataService, browseDefinitionDataService,
hrefOnlyDataService, hrefOnlyDataService,
rdbService
); );
} }
@@ -130,11 +126,9 @@ describe('BrowseService', () => {
beforeEach(() => { beforeEach(() => {
requestService = getMockRequestService(getRequestEntry$(true)); requestService = getMockRequestService(getRequestEntry$(true));
rdbService = getMockRemoteDataBuildService();
service = initTestService(); service = initTestService();
spyOn(halService, 'getEndpoint').and spyOn(halService, 'getEndpoint').and
.returnValue(hot('--a-', { a: browsesEndpointURL })); .returnValue(hot('--a-', { a: browsesEndpointURL }));
spyOn(rdbService, 'buildList').and.callThrough();
}); });
it('should call BrowseDefinitionDataService to create the RemoteData Observable', () => { it('should call BrowseDefinitionDataService to create the RemoteData Observable', () => {
@@ -151,9 +145,7 @@ describe('BrowseService', () => {
beforeEach(() => { beforeEach(() => {
requestService = getMockRequestService(getRequestEntry$(true)); requestService = getMockRequestService(getRequestEntry$(true));
rdbService = getMockRemoteDataBuildService();
service = initTestService(); service = initTestService();
spyOn(rdbService, 'buildList').and.callThrough();
}); });
describe('when getBrowseEntriesFor is called with a valid browse definition id', () => { describe('when getBrowseEntriesFor is called with a valid browse definition id', () => {
@@ -204,7 +196,6 @@ describe('BrowseService', () => {
describe('if getBrowseDefinitions fires', () => { describe('if getBrowseDefinitions fires', () => {
beforeEach(() => { beforeEach(() => {
requestService = getMockRequestService(getRequestEntry$(true)); requestService = getMockRequestService(getRequestEntry$(true));
rdbService = getMockRemoteDataBuildService();
service = initTestService(); service = initTestService();
spyOn(service, 'getBrowseDefinitions').and spyOn(service, 'getBrowseDefinitions').and
.returnValue(hot('--a-', { .returnValue(hot('--a-', {
@@ -259,7 +250,6 @@ describe('BrowseService', () => {
describe('if getBrowseDefinitions doesn\'t fire', () => { describe('if getBrowseDefinitions doesn\'t fire', () => {
it('should return undefined', () => { it('should return undefined', () => {
requestService = getMockRequestService(getRequestEntry$(true)); requestService = getMockRequestService(getRequestEntry$(true));
rdbService = getMockRemoteDataBuildService();
service = initTestService(); service = initTestService();
spyOn(service, 'getBrowseDefinitions').and spyOn(service, 'getBrowseDefinitions').and
.returnValue(hot('----')); .returnValue(hot('----'));
@@ -277,9 +267,7 @@ describe('BrowseService', () => {
describe('getFirstItemFor', () => { describe('getFirstItemFor', () => {
beforeEach(() => { beforeEach(() => {
requestService = getMockRequestService(); requestService = getMockRequestService();
rdbService = getMockRemoteDataBuildService();
service = initTestService(); service = initTestService();
spyOn(rdbService, 'buildList').and.callThrough();
}); });
describe('when getFirstItemFor is called with a valid browse definition id', () => { describe('when getFirstItemFor is called with a valid browse definition id', () => {

View File

@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { distinctUntilChanged, map, startWith } from 'rxjs/operators'; import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
import { hasValue, hasValueOperator, isEmpty, isNotEmpty } from '../../shared/empty.util'; import { hasValue, hasValueOperator, isEmpty, isNotEmpty } from '../../shared/empty.util';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { PaginatedList } from '../data/paginated-list.model'; import { PaginatedList } from '../data/paginated-list.model';
import { RemoteData } from '../data/remote-data'; import { RemoteData } from '../data/remote-data';
import { RequestService } from '../data/request.service'; import { RequestService } from '../data/request.service';
@@ -24,11 +23,18 @@ import { HrefOnlyDataService } from '../data/href-only-data.service';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { BrowseDefinitionDataService } from './browse-definition-data.service'; import { BrowseDefinitionDataService } from './browse-definition-data.service';
import { SortDirection } from '../cache/models/sort-options.model'; import { SortDirection } from '../cache/models/sort-options.model';
import { environment } from '../../../environments/environment';
export const BROWSE_LINKS_TO_FOLLOW: FollowLinkConfig<BrowseEntry | Item>[] = [ export function getBrowseLinksToFollow(): FollowLinkConfig<BrowseEntry | Item>[] {
followLink('thumbnail') const followLinks = [
]; followLink('thumbnail'),
];
if (environment.item.showAccessStatuses) {
followLinks.push(followLink('accessStatus'));
}
return followLinks;
}
/** /**
* The service handling all browse requests * The service handling all browse requests
@@ -55,7 +61,6 @@ export class BrowseService {
protected halService: HALEndpointService, protected halService: HALEndpointService,
private browseDefinitionDataService: BrowseDefinitionDataService, private browseDefinitionDataService: BrowseDefinitionDataService,
private hrefOnlyDataService: HrefOnlyDataService, private hrefOnlyDataService: HrefOnlyDataService,
private rdb: RemoteDataBuildService,
) { ) {
} }
@@ -105,7 +110,7 @@ export class BrowseService {
}) })
); );
if (options.fetchThumbnail ) { if (options.fetchThumbnail ) {
return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$, {}, null, null, ...BROWSE_LINKS_TO_FOLLOW); return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$, {}, null, null, ...getBrowseLinksToFollow());
} }
return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$); return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$);
} }
@@ -153,7 +158,7 @@ export class BrowseService {
}), }),
); );
if (options.fetchThumbnail) { if (options.fetchThumbnail) {
return this.hrefOnlyDataService.findListByHref<Item>(href$, {}, null, null, ...BROWSE_LINKS_TO_FOLLOW); return this.hrefOnlyDataService.findListByHref<Item>(href$, {}, null, null, ...getBrowseLinksToFollow());
} }
return this.hrefOnlyDataService.findListByHref<Item>(href$); return this.hrefOnlyDataService.findListByHref<Item>(href$);
} }

View File

@@ -23,6 +23,7 @@ import { FindListOptions } from './find-list-options.model';
import { testSearchDataImplementation } from './base/search-data.spec'; import { testSearchDataImplementation } from './base/search-data.spec';
import { MetadataValue } from '../shared/metadata.models'; import { MetadataValue } from '../shared/metadata.models';
import { MetadataRepresentationType } from '../shared/metadata-representation/metadata-representation.model'; import { MetadataRepresentationType } from '../shared/metadata-representation/metadata-representation.model';
import { environment } from '../../../environments/environment.test';
describe('RelationshipDataService', () => { describe('RelationshipDataService', () => {
let service: RelationshipDataService; let service: RelationshipDataService;
@@ -137,6 +138,7 @@ describe('RelationshipDataService', () => {
itemService, itemService,
null, null,
jasmine.createSpy('paginatedRelationsToItems').and.returnValue((v) => v), jasmine.createSpy('paginatedRelationsToItems').and.returnValue((v) => v),
environment,
); );
} }
@@ -152,7 +154,7 @@ describe('RelationshipDataService', () => {
}); });
describe('composition', () => { describe('composition', () => {
const initService = () => new RelationshipDataService(null, null, null, null, null, null, null); const initService = () => new RelationshipDataService(null, null, null, null, null, null, null, environment);
testSearchDataImplementation(initService); testSearchDataImplementation(initService);
}); });

View File

@@ -51,6 +51,7 @@ import { MetadataRepresentation } from '../shared/metadata-representation/metada
import { MetadatumRepresentation } from '../shared/metadata-representation/metadatum/metadatum-representation.model'; import { MetadatumRepresentation } from '../shared/metadata-representation/metadatum/metadatum-representation.model';
import { ItemMetadataRepresentation } from '../shared/metadata-representation/item/item-metadata-representation.model'; import { ItemMetadataRepresentation } from '../shared/metadata-representation/item/item-metadata-representation.model';
import { DSpaceObject } from '../shared/dspace-object.model'; import { DSpaceObject } from '../shared/dspace-object.model';
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists; const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
@@ -92,6 +93,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
protected itemService: ItemDataService, protected itemService: ItemDataService,
protected appStore: Store<AppState>, protected appStore: Store<AppState>,
@Inject(PAGINATED_RELATIONS_TO_ITEMS_OPERATOR) private paginatedRelationsToItems: (thisId: string) => (source: Observable<RemoteData<PaginatedList<Relationship>>>) => Observable<RemoteData<PaginatedList<Item>>>, @Inject(PAGINATED_RELATIONS_TO_ITEMS_OPERATOR) private paginatedRelationsToItems: (thisId: string) => (source: Observable<RemoteData<PaginatedList<Relationship>>>) => Observable<RemoteData<PaginatedList<Item>>>,
@Inject(APP_CONFIG) private appConfig: AppConfig,
) { ) {
super('relationships', requestService, rdbService, objectCache, halService, 15 * 60 * 1000); super('relationships', requestService, rdbService, objectCache, halService, 15 * 60 * 1000);
@@ -264,7 +266,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
* @param options * @param options
*/ */
getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> { getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> {
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(options.fetchThumbnail); let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(options.fetchThumbnail, this.appConfig.item.showAccessStatuses);
linksToFollow.push(followLink('relationshipType')); linksToFollow.push(followLink('relationshipType'));
return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid)); return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid));

View File

@@ -64,6 +64,9 @@ export class RecentItemListComponent implements OnInit {
if (this.appConfig.browseBy.showThumbnails) { if (this.appConfig.browseBy.showThumbnails) {
linksToFollow.push(followLink('thumbnail')); linksToFollow.push(followLink('thumbnail'));
} }
if (this.appConfig.item.showAccessStatuses) {
linksToFollow.push(followLink('accessStatus'));
}
this.itemRD$ = this.searchService.search( this.itemRD$ = this.searchService.search(
new PaginatedSearchOptions({ new PaginatedSearchOptions({

View File

@@ -13,7 +13,7 @@ import { environment } from '../../../../environments/environment';
import { getItemPageRoute } from '../../item-page-routing-paths'; import { getItemPageRoute } from '../../item-page-routing-paths';
import { getAllSucceededRemoteData } from '../../../core/shared/operators'; import { getAllSucceededRemoteData } from '../../../core/shared/operators';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
import { ITEM_PAGE_LINKS_TO_FOLLOW } from '../../item.resolver'; import { getItemPageLinksToFollow } from '../../item.resolver';
import { FieldUpdate } from '../../../core/data/object-updates/field-update.model'; import { FieldUpdate } from '../../../core/data/object-updates/field-update.model';
import { FieldUpdates } from '../../../core/data/object-updates/field-updates.model'; import { FieldUpdates } from '../../../core/data/object-updates/field-updates.model';
@@ -72,7 +72,7 @@ export class AbstractItemUpdateComponent extends AbstractTrackableComponent impl
this.item = rd.payload; this.item = rd.payload;
}), }),
switchMap((rd: RemoteData<Item>) => { switchMap((rd: RemoteData<Item>) => {
return this.itemService.findByHref(rd.payload._links.self.href, true, true, ...ITEM_PAGE_LINKS_TO_FOLLOW); return this.itemService.findByHref(rd.payload._links.self.href, true, true, ...getItemPageLinksToFollow());
}), }),
getAllSucceededRemoteData() getAllSucceededRemoteData()
).subscribe((rd: RemoteData<Item>) => { ).subscribe((rd: RemoteData<Item>) => {

View File

@@ -236,8 +236,8 @@ export class ItemDeleteComponent
this.linkService.resolveLinks( this.linkService.resolveLinks(
relationship, relationship,
followLink('relationshipType'), followLink('relationshipType'),
followLink('leftItem'), followLink('leftItem', undefined, followLink<Item>('accessStatus')),
followLink('rightItem'), followLink('rightItem', undefined, followLink<Item>('accessStatus')),
); );
return relationship.relationshipType.pipe( return relationship.relationshipType.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),

View File

@@ -32,6 +32,7 @@ import { ConfigurationProperty } from '../../../../core/shared/configuration-pro
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { RouterMock } from '../../../../shared/mocks/router.mock'; import { RouterMock } from '../../../../shared/mocks/router.mock';
import { APP_CONFIG } from '../../../../../config/app-config.interface'; import { APP_CONFIG } from '../../../../../config/app-config.interface';
import { environment } from '../../../../../environments/environment.test';
let comp: EditRelationshipListComponent; let comp: EditRelationshipListComponent;
let fixture: ComponentFixture<EditRelationshipListComponent>; let fixture: ComponentFixture<EditRelationshipListComponent>;
@@ -202,11 +203,11 @@ describe('EditRelationshipListComponent', () => {
})) }))
}); });
const environmentUseThumbs = { const environmentUseThumbs = Object.assign({}, environment, {
browseBy: { browseBy: {
showThumbnails: true showThumbnails: true
} }
}; });
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [SharedModule, TranslateModule.forRoot()], imports: [SharedModule, TranslateModule.forRoot()],

View File

@@ -493,7 +493,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
); );
// this adds thumbnail images when required by configuration // this adds thumbnail images when required by configuration
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(this.fetchThumbnail); let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(this.fetchThumbnail, this.appConfig.item.showAccessStatuses);
this.subs.push( this.subs.push(
observableCombineLatest([ observableCombineLatest([

View File

@@ -8,20 +8,27 @@ import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config
import { getFirstCompletedRemoteData } from '../core/shared/operators'; import { getFirstCompletedRemoteData } from '../core/shared/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ResolvedAction } from '../core/resolving/resolver.actions'; import { ResolvedAction } from '../core/resolving/resolver.actions';
import { environment } from '../../environments/environment';
/** /**
* The self links defined in this list are expected to be requested somewhere in the near future * The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests * Requesting them as embeds will limit the number of requests
*/ */
export const ITEM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Item>[] = [ export function getItemPageLinksToFollow(): FollowLinkConfig<Item>[] {
followLink('owningCollection', {}, const followLinks: FollowLinkConfig<Item>[] = [
followLink('parentCommunity', {}, followLink('owningCollection', {},
followLink('parentCommunity')) followLink('parentCommunity', {},
), followLink('parentCommunity'))
followLink('relationships'), ),
followLink('version', {}, followLink('versionhistory')), followLink('relationships'),
followLink('thumbnail') followLink('version', {}, followLink('versionhistory')),
]; followLink('thumbnail'),
];
if (environment.item.showAccessStatuses) {
followLinks.push(followLink('accessStatus'));
}
return followLinks;
}
/** /**
* This class represents a resolver that requests a specific item before the route is activated * This class represents a resolver that requests a specific item before the route is activated
@@ -46,7 +53,7 @@ export class ItemResolver implements Resolve<RemoteData<Item>> {
const itemRD$ = this.itemService.findById(route.params.id, const itemRD$ = this.itemService.findById(route.params.id,
true, true,
false, false,
...ITEM_PAGE_LINKS_TO_FOLLOW ...getItemPageLinksToFollow(),
).pipe( ).pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
); );

View File

@@ -328,7 +328,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
const relationship$ = this.relationshipService.findById(this.value.virtualValue, const relationship$ = this.relationshipService.findById(this.value.virtualValue,
true, true,
true, true,
... itemLinksToFollow(this.fetchThumbnail)).pipe( ... itemLinksToFollow(this.fetchThumbnail, this.appConfig.item.showAccessStatuses)).pipe(
getAllSucceededRemoteData(), getAllSucceededRemoteData(),
getRemoteDataPayload()); getRemoteDataPayload());
this.relationshipValue$ = observableCombineLatest([this.item$.pipe(take(1)), relationship$]).pipe( this.relationshipValue$ = observableCombineLatest([this.item$.pipe(take(1)), relationship$]).pipe(

View File

@@ -1,5 +1,6 @@
import { followLink, FollowLinkConfig } from './follow-link-config.model'; import { followLink, FollowLinkConfig } from './follow-link-config.model';
import { Relationship } from '../../core/shared/item-relationships/relationship.model'; import { Relationship } from '../../core/shared/item-relationships/relationship.model';
import { Item } from '../../core/shared/item.model';
/** /**
* Get the query for looking up items by relation type * Get the query for looking up items by relation type
@@ -21,19 +22,22 @@ export function getFilterByRelation(relationType: string, itemUUID: string): str
} }
/** /**
* Creates links to follow for the leftItem and rightItem. Links will include * Creates links to follow for the leftItem and rightItem. Optionally additional links for `thumbnail` & `accessStatus`
* @param showThumbnail thumbnail image configuration * can be embedded as well.
* @returns followLink array *
* @param showThumbnail Whether the `thumbnail` needs to be embedded on the {@link Item}
* @param showAccessStatus Whether the `accessStatus` needs to be embedded on the {@link Item}
*/ */
export function itemLinksToFollow(showThumbnail: boolean): FollowLinkConfig<Relationship>[] { export function itemLinksToFollow(showThumbnail: boolean, showAccessStatus: boolean): FollowLinkConfig<Relationship>[] {
let linksToFollow: FollowLinkConfig<Relationship>[]; const conditionalLinksToFollow: FollowLinkConfig<Item>[] = [];
if (showThumbnail) { if (showThumbnail) {
linksToFollow = [ conditionalLinksToFollow.push(followLink<Item>('thumbnail'));
followLink('leftItem',{}, followLink('thumbnail')),
followLink('rightItem',{}, followLink('thumbnail'))
];
} else {
linksToFollow = [followLink('leftItem'), followLink('rightItem')];
} }
return linksToFollow; if (showAccessStatus) {
conditionalLinksToFollow.push(followLink<Item>('accessStatus'));
}
return [
followLink('leftItem', undefined, ...conditionalLinksToFollow),
followLink('rightItem', undefined, ...conditionalLinksToFollow),
];
} }