Skip to content

Commit 25ca137

Browse files
authored
Merge pull request DSpace#2244 from mwoodiupui/reqitem-response
Make request-copy grant message an optional addition; main text is in backend.
2 parents 327031c + 2d716c7 commit 25ca137

4 files changed

Lines changed: 3 additions & 53 deletions

File tree

src/app/request-copy/email-request-copy/email-request-copy.component.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
</div>
99
<div class="form-group">
1010
<label for="message">{{ 'grant-deny-request-copy.email.message' | translate }}</label>
11-
<textarea class="form-control" id="message" rows="8" [ngClass]="{'is-invalid': !message || message.length === 0}" [(ngModel)]="message" name="message"></textarea>
12-
<div *ngIf="!message || message.length === 0" class="invalid-feedback">
13-
{{ 'grant-deny-request-copy.email.message.empty' | translate }}
14-
</div>
11+
<textarea class="form-control" id="message" rows="8" [(ngModel)]="message" name="message"></textarea>
1512
</div>
1613
<ng-content></ng-content>
1714
<div class="d-flex flex-row-reverse">

src/app/request-copy/grant-request-copy/grant-request-copy.component.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,6 @@ describe('GrantRequestCopyComponent', () => {
123123
spyOn(translateService, 'get').and.returnValue(observableOf('translated-message'));
124124
});
125125

126-
it('message$ should be parameterized correctly', (done) => {
127-
component.message$.subscribe(() => {
128-
expect(translateService.get).toHaveBeenCalledWith(jasmine.anything(), Object.assign({
129-
recipientName: itemRequest.requestName,
130-
itemUrl: itemUrl,
131-
itemName: itemName,
132-
authorName: user.name,
133-
authorEmail: user.email,
134-
}));
135-
done();
136-
});
137-
});
138-
139126
describe('grant', () => {
140127
let email: RequestCopyEmail;
141128

src/app/request-copy/grant-request-copy/grant-request-copy.component.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ import {
99
import { RemoteData } from '../../core/data/remote-data';
1010
import { AuthService } from '../../core/auth/auth.service';
1111
import { TranslateService } from '@ngx-translate/core';
12-
import { combineLatest as observableCombineLatest } from 'rxjs';
13-
import { ItemDataService } from '../../core/data/item-data.service';
14-
import { EPerson } from '../../core/eperson/models/eperson.model';
15-
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
16-
import { Item } from '../../core/shared/item.model';
17-
import { isNotEmpty } from '../../shared/empty.util';
1812
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
1913
import { RequestCopyEmail } from '../email-request-copy/request-copy-email.model';
2014
import { NotificationsService } from '../../shared/notifications/notifications.service';
@@ -54,8 +48,6 @@ export class GrantRequestCopyComponent implements OnInit {
5448
private route: ActivatedRoute,
5549
private authService: AuthService,
5650
private translateService: TranslateService,
57-
private itemDataService: ItemDataService,
58-
private nameService: DSONameService,
5951
private itemRequestService: ItemRequestDataService,
6052
private notificationsService: NotificationsService,
6153
) {
@@ -69,31 +61,7 @@ export class GrantRequestCopyComponent implements OnInit {
6961
redirectOn4xx(this.router, this.authService),
7062
);
7163

72-
const msgParams$ = observableCombineLatest([
73-
this.itemRequestRD$.pipe(getFirstSucceededRemoteDataPayload()),
74-
this.authService.getAuthenticatedUserFromStore(),
75-
]).pipe(
76-
switchMap(([itemRequest, user]: [ItemRequest, EPerson]) => {
77-
return this.itemDataService.findById(itemRequest.itemId).pipe(
78-
getFirstSucceededRemoteDataPayload(),
79-
map((item: Item) => {
80-
const uri = item.firstMetadataValue('dc.identifier.uri');
81-
return Object.assign({
82-
recipientName: itemRequest.requestName,
83-
itemUrl: isNotEmpty(uri) ? uri : item.handle,
84-
itemName: this.nameService.getName(item),
85-
authorName: this.nameService.getName(user),
86-
authorEmail: user.email,
87-
});
88-
}),
89-
);
90-
}),
91-
);
92-
9364
this.subject$ = this.translateService.get('grant-request-copy.email.subject');
94-
this.message$ = msgParams$.pipe(
95-
switchMap((params) => this.translateService.get('grant-request-copy.email.message', params)),
96-
);
9765
}
9866

9967
/**

src/assets/i18n/en.json5

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@
17281728

17291729
"grant-deny-request-copy.email.back": "Back",
17301730

1731-
"grant-deny-request-copy.email.message": "Message",
1731+
"grant-deny-request-copy.email.message": "Optional additional message",
17321732

17331733
"grant-deny-request-copy.email.message.empty": "Please enter a message",
17341734

@@ -1754,15 +1754,13 @@
17541754

17551755
"grant-deny-request-copy.processed": "This request has already been processed. You can use the button below to get back to the home page.",
17561756

1757-
"grant-request-copy.email.message": "Dear {{ recipientName }},\nIn response to your request I have the pleasure to send you in attachment a copy of the file(s) concerning the document: \"{{ itemUrl }}\" ({{ itemName }}), of which I am an author.\n\nBest regards,\n{{ authorName }} <{{ authorEmail }}>",
1758-
17591757
"grant-request-copy.email.subject": "Request copy of document",
17601758

17611759
"grant-request-copy.error": "An error occurred",
17621760

17631761
"grant-request-copy.header": "Grant document copy request",
17641762

1765-
"grant-request-copy.intro": "This message will be sent to the applicant of the request. The requested document(s) will be attached.",
1763+
"grant-request-copy.intro": "A message will be sent to the applicant of the request. The requested document(s) will be attached.",
17661764

17671765
"grant-request-copy.success": "Successfully granted item request",
17681766

0 commit comments

Comments
 (0)