mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Request-a-copy: Changes to support access expiry as delta/date storage
This commit is contained in:
@@ -211,11 +211,10 @@ export class ItemRequestDataService extends IdentifiableDataService<ItemRequest>
|
||||
* if the 'send secure link' feature is configured.
|
||||
* Expects integer values, conversion to number is done in this processing
|
||||
*/
|
||||
getConfiguredAccessPeriods(): Observable<number[]> {
|
||||
getConfiguredAccessPeriods(): Observable<string[]> {
|
||||
return this.configService.findByPropertyName('request.item.grant.link.period').pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((propertyRD: RemoteData<ConfigurationProperty>) => propertyRD.hasSucceeded ? propertyRD.payload.values : []),
|
||||
map((values) => values.map(value => parseInt(value, 10))),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -86,10 +86,10 @@ export class ItemRequest implements CacheableObject {
|
||||
@autoserialize
|
||||
accessToken: string;
|
||||
/**
|
||||
* Access period of the request
|
||||
* Access expiry date of the request
|
||||
*/
|
||||
@autoserialize
|
||||
accessPeriod: number;
|
||||
accessExpiry: string;
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this ItemRequest
|
||||
|
@@ -45,7 +45,7 @@ describe('EmailRequestCopyComponent', () => {
|
||||
spyOn(component.send, 'emit').and.stub();
|
||||
component.subject = 'test-subject';
|
||||
component.message = 'test-message';
|
||||
component.validAccessPeriods = [0];
|
||||
component.validAccessPeriods = ['FOREVER'];
|
||||
component.submit();
|
||||
expect(component.send.emit).toHaveBeenCalledWith(new RequestCopyEmail('test-subject', 'test-message'));
|
||||
});
|
||||
|
@@ -34,7 +34,7 @@ export class EmailRequestCopyComponent implements OnInit {
|
||||
* Event emitter for sending the email
|
||||
*/
|
||||
@Output() send: EventEmitter<RequestCopyEmail> = new EventEmitter<RequestCopyEmail>();
|
||||
@Output() selectedAccessPeriod: EventEmitter<number> = new EventEmitter();
|
||||
@Output() selectedAccessPeriod: EventEmitter<string> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* The subject of the email
|
||||
@@ -49,12 +49,13 @@ export class EmailRequestCopyComponent implements OnInit {
|
||||
/**
|
||||
* A list of valid access periods to render in a drop-down menu
|
||||
*/
|
||||
@Input() validAccessPeriods: number[] = [];
|
||||
@Input() validAccessPeriods: string [] = [];
|
||||
|
||||
/**
|
||||
* The selected access period
|
||||
* The selected access period, e.g. +7DAYS, +12MONTHS, FOREVER. These will be
|
||||
* calculated as a timestamp to store as the access expiry date for the requested item
|
||||
*/
|
||||
accessPeriod = 0;
|
||||
accessPeriod = 'FOREVER';
|
||||
|
||||
protected readonly hasValue = hasValue;
|
||||
|
||||
@@ -86,7 +87,7 @@ export class EmailRequestCopyComponent implements OnInit {
|
||||
* Update the access period when a dropdown menu button is clicked for a value
|
||||
* @param accessPeriod
|
||||
*/
|
||||
selectAccessPeriod(accessPeriod: number) {
|
||||
selectAccessPeriod(accessPeriod: string) {
|
||||
this.accessPeriod = accessPeriod;
|
||||
this.selectedAccessPeriod.emit(accessPeriod);
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ export class GrantRequestCopyComponent implements OnInit {
|
||||
/**
|
||||
* A list of integers determining valid access periods in seconds
|
||||
*/
|
||||
validAccessPeriods$: Observable<number[]>;
|
||||
validAccessPeriods$: Observable<string[]>;
|
||||
|
||||
/**
|
||||
* The currently selected access period
|
||||
|
@@ -2088,15 +2088,15 @@
|
||||
|
||||
"grant-request-copy.access-period.header": "Access period",
|
||||
|
||||
"grant-request-copy.access-period.120": "2 minutes",
|
||||
"grant-request-copy.access-period.+1DAY": "1 day",
|
||||
|
||||
"grant-request-copy.access-period.240": "4 minutes",
|
||||
"grant-request-copy.access-period.+1WEEK": "1 week",
|
||||
|
||||
"grant-request-copy.access-period.86400": "1 day",
|
||||
"grant-request-copy.access-period.+1MONTH": "1 month",
|
||||
|
||||
"grant-request-copy.access-period.604800": "7 days",
|
||||
"grant-request-copy.access-period.+3MONTHS": "3 months",
|
||||
|
||||
"grant-request-copy.access-period.0": "Forever",
|
||||
"grant-request-copy.access-period.FOREVER": "Forever",
|
||||
|
||||
"health.breadcrumbs": "Health",
|
||||
|
||||
|
Reference in New Issue
Block a user