From 2a94205a3e6b8d5f5a42724f13f28e8407814170 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Thu, 5 Sep 2024 15:44:48 +0200 Subject: [PATCH] 117274: Fixed issue where getAuthorizedCollectionByCommunity passes its reRequestOnStale value to the searchBy's useCachedVersionIfAvailable parameter --- src/app/core/data/collection-data.service.ts | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index 405b35c1f94..e69ca357505 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -113,15 +113,20 @@ export class CollectionDataService extends ComColDataService { /** * Get all collections the user is authorized to submit to, by community * + * TODO This method should be replaced with `getAuthorizedCollection` and the `options` parameter `scopeID` should be + * supported instead in `BaseDataService#buildHrefFromFindOptions` + * * @param communityId The community id * @param query limit the returned collection to those with metadata values matching the query terms. * @param options The [[FindListOptions]] object - * @param reRequestOnStale Whether or not the request should automatically be re- - * requested after the response becomes stale - * @return Observable>> - * collection list + * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's no valid-cached + * version. Defaults to true + * @param reRequestOnStale Whether or not the request should automatically be re-requested after the response become + * s stale + * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically + * resolved */ - getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}, reRequestOnStale = true,): Observable>> { + getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]): Observable>> { const searchHref = 'findSubmitAuthorizedByCommunity'; options = Object.assign({}, options, { searchParams: [ @@ -130,9 +135,11 @@ export class CollectionDataService extends ComColDataService { ] }); - return this.searchBy(searchHref, options, reRequestOnStale).pipe( - filter((collections: RemoteData>) => !collections.isResponsePending)); + return this.searchBy(searchHref, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow).pipe( + filter((collections: RemoteData>) => !collections.isResponsePending), + ); } + /** * Get all collections the user is authorized to submit to, by community and has the metadata *