Skip to content

Commit 7671595

Browse files
committed
Request-a-copy: Review feedback addressed
* ALTCHA updated to 0.9.0 and tested * Alt text for fas-lock-open images * Typedoc added * Comments/TODOs removed * Better expiry date display on notification panel
1 parent d8fb9f1 commit 7671595

7 files changed

Lines changed: 51 additions & 10 deletions

File tree

package-lock.json

Lines changed: 30 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"@ngrx/store": "^18.1.1",
115115
"@ngx-translate/core": "^16.0.3",
116116
"@nicky-lenaers/ngx-scroll-to": "^14.0.0",
117-
"altcha": "^0.2.2",
117+
"altcha": "^0.9.0",
118118
"angulartics2": "^12.2.0",
119119
"axios": "^1.7.9",
120120
"bootstrap": "^5.3",

src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export class BitstreamDownloadPageComponent implements OnInit {
129129
// For now, the access token does not care if we are logged in or not.
130130
if (hasValue(accessToken)) {
131131
this.hardRedirectService.redirect(bitstream._links.content.href + '?accessToken=' + accessToken);
132-
// this.router.navigateByUrl(getForbiddenRoute(), {skipLocationChange: true});
133132
} else if (isLoggedIn) {
134133
this.router.navigateByUrl(getForbiddenRoute(), { skipLocationChange: true });
135134
} else if (!isLoggedIn) {

src/app/core/data/item-request-data.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import { RequestService } from './request.service';
4949
})
5050
export class ItemRequestDataService extends IdentifiableDataService<ItemRequest> implements SearchData<ItemRequest> {
5151

52-
// TODO: This is only public for access by the test class - smell?
5352
private searchData: SearchDataImpl<ItemRequest>;
5453

5554
constructor(

src/app/core/data/proof-of-work-captcha-data.service.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { map } from 'rxjs/operators';
44

55
import { HALEndpointService } from '../shared/hal-endpoint.service';
66

7+
/**
8+
* Service for retrieving captcha challenge data, so proof-of-work calculations can be performed
9+
* and returned with protected form data.
10+
*/
711
@Injectable({ providedIn: 'root' })
812
export class ProofOfWorkCaptchaDataService {
913

@@ -13,12 +17,20 @@ export class ProofOfWorkCaptchaDataService {
1317
private halService: HALEndpointService) {
1418
}
1519

20+
/**
21+
* Get the endpoint for retrieving a new captcha challenge, to be passed
22+
* to the Altcha captcha component as an input property
23+
*/
1624
public getChallengeHref(): Observable<string> {
1725
return this.getEndpoint().pipe(
1826
map((endpoint) => endpoint + '/challenge'),
1927
);
2028
}
2129

30+
/**
31+
* Get the base CAPTCHA endpoint URL
32+
* @protected
33+
*/
2234
protected getEndpoint(): Observable<string> {
2335
return this.halService.getEndpoint(this.linkPath);
2436
}

src/app/item-page/simple/item-page.component.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
<ng-container *ngVar="(itemRequest$ | async) as itemRequest">
77
@if (hasValue(itemRequest)) {
88
<div class="alert alert-warning wb-100 mb-2">
9-
<p><span role="img" class="request-a-copy-access-icon"><i class="fa-solid fa-lock-open"></i></span>{{'bitstream-request-a-copy.access-by-token.warning' | translate}}</p>
10-
@if (hasValue(itemRequest.accessPeriod) && itemRequest.accessPeriod > 0 && hasValue(itemRequest.decisionDate)) {
11-
<p>{{ 'bitstream-request-a-copy.access-by-token.expiry-label' | translate }} {{ getAccessPeriodEndDate(itemRequest.accessPeriod, itemRequest.decisionDate) }}</p>
9+
<p><span role="img" class="request-a-copy-access-icon" [attr.aria-label]="'bitstream-request-a-copy.access-by-token.alt-text' | translate"><i class="fa-solid fa-lock-open"></i></span>{{'bitstream-request-a-copy.access-by-token.warning' | translate}}</p>
10+
<!-- Only show the expiry date if it's not null, and doesn't start with the "FOREVER" year -->
11+
@if (hasValue(itemRequest.accessExpiry) && !itemRequest.accessExpiry.startsWith('+294276')) {
12+
<p>{{ 'bitstream-request-a-copy.access-by-token.expiry-label' | translate }} {{ itemRequest.accessExpiry }}</p>
1213
}
1314
</div>
1415
}

src/assets/i18n/en.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,8 @@
10021002

10031003
"bitstream-request-a-copy.access-by-token.expiry-label": "Access provided by this link will expire on",
10041004

1005+
"bitstream-request-a-copy.access-by-token.alt-text": "Access to this item is provided by a secure token",
1006+
10051007
"browse.back.all-results": "All browse results",
10061008

10071009
"browse.comcol.by.author": "By Author",
@@ -1898,6 +1900,8 @@
18981900

18991901
"file-download-link.restricted": "Restricted bitstream",
19001902

1903+
"file-download-link.secure-access": "Restricted bitstream available via secure access token",
1904+
19011905
"file-section.error.header": "Error obtaining files for this item",
19021906

19031907
"footer.copyright": "copyright © 2002-{{ year }}",

0 commit comments

Comments
 (0)