mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Removed circ dependency after merge with main
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
|
||||
import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
|
||||
import { debounceTime, filter, find, map, switchMap, take, takeWhile } from 'rxjs/operators';
|
||||
import { hasNoValue, hasValue, hasValueOperator, isNotEmpty } from '../../shared/empty.util';
|
||||
import { SearchResult } from '../../shared/search/models/search-result.model';
|
||||
@@ -9,9 +9,6 @@ import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { BrowseDefinition } from './browse-definition.model';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { FeatureID } from '../data/feature-authorization/feature-id';
|
||||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service';
|
||||
|
||||
export const DEBOUNCE_TIME_OPERATOR = new InjectionToken<<T>(dueTime: number) => (source: Observable<T>) => Observable<T>>('debounceTime', {
|
||||
providedIn: 'root',
|
||||
@@ -225,20 +222,3 @@ export const metadataFieldsToString = () =>
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* Operator to check if the given bitstream is downloadable
|
||||
*/
|
||||
export const getDownloadableBitstream = (authService: AuthorizationDataService) =>
|
||||
(source: Observable<Bitstream>): Observable<Bitstream | null> =>
|
||||
source.pipe(
|
||||
switchMap((bit: Bitstream) => {
|
||||
if (hasValue(bit)) {
|
||||
return authService.isAuthorized(FeatureID.CanDownload, bit.self).pipe(
|
||||
map((canDownload: boolean) => {
|
||||
return canDownload ? bit : null;
|
||||
}));
|
||||
} else {
|
||||
return observableOf(null);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
Reference in New Issue
Block a user