1
0

Make grant message an optional addition; main text is in backend.

This commit is contained in:
Mark H. Wood
2023-05-11 12:50:47 -04:00
parent 9919abebce
commit 93fcbe79aa
3 changed files with 3 additions and 38 deletions

View File

@@ -8,10 +8,7 @@
</div>
<div class="form-group">
<label for="message">{{ 'grant-deny-request-copy.email.message' | translate }}</label>
<textarea class="form-control" id="message" rows="8" [ngClass]="{'is-invalid': !message || message.length === 0}" [(ngModel)]="message" name="message"></textarea>
<div *ngIf="!message || message.length === 0" class="invalid-feedback">
{{ 'grant-deny-request-copy.email.message.empty' | translate }}
</div>
<textarea class="form-control" id="message" rows="8" [(ngModel)]="message" name="message"></textarea>
</div>
<ng-content></ng-content>
<div class="d-flex flex-row-reverse">

View File

@@ -9,12 +9,8 @@ import {
import { RemoteData } from '../../core/data/remote-data';
import { AuthService } from '../../core/auth/auth.service';
import { TranslateService } from '@ngx-translate/core';
import { combineLatest as observableCombineLatest } from 'rxjs';
import { ItemDataService } from '../../core/data/item-data.service';
import { EPerson } from '../../core/eperson/models/eperson.model';
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { Item } from '../../core/shared/item.model';
import { isNotEmpty } from '../../shared/empty.util';
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
import { RequestCopyEmail } from '../email-request-copy/request-copy-email.model';
import { NotificationsService } from '../../shared/notifications/notifications.service';
@@ -54,8 +50,6 @@ export class GrantRequestCopyComponent implements OnInit {
private route: ActivatedRoute,
private authService: AuthService,
private translateService: TranslateService,
private itemDataService: ItemDataService,
private nameService: DSONameService,
private itemRequestService: ItemRequestDataService,
private notificationsService: NotificationsService,
) {
@@ -69,31 +63,7 @@ export class GrantRequestCopyComponent implements OnInit {
redirectOn4xx(this.router, this.authService),
);
const msgParams$ = observableCombineLatest([
this.itemRequestRD$.pipe(getFirstSucceededRemoteDataPayload()),
this.authService.getAuthenticatedUserFromStore(),
]).pipe(
switchMap(([itemRequest, user]: [ItemRequest, EPerson]) => {
return this.itemDataService.findById(itemRequest.itemId).pipe(
getFirstSucceededRemoteDataPayload(),
map((item: Item) => {
const uri = item.firstMetadataValue('dc.identifier.uri');
return Object.assign({
recipientName: itemRequest.requestName,
itemUrl: isNotEmpty(uri) ? uri : item.handle,
itemName: this.nameService.getName(item),
authorName: this.nameService.getName(user),
authorEmail: user.email,
});
}),
);
}),
);
this.subject$ = this.translateService.get('grant-request-copy.email.subject');
this.message$ = msgParams$.pipe(
switchMap((params) => this.translateService.get('grant-request-copy.email.message', params)),
);
}
/**

View File

@@ -1726,7 +1726,7 @@
"grant-deny-request-copy.email.back": "Back",
"grant-deny-request-copy.email.message": "Message",
"grant-deny-request-copy.email.message": "Optional additional message",
"grant-deny-request-copy.email.message.empty": "Please enter a message",
@@ -1752,15 +1752,13 @@
"grant-deny-request-copy.processed": "This request has already been processed. You can use the button below to get back to the home page.",
"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 }}>",
"grant-request-copy.email.subject": "Request copy of document",
"grant-request-copy.error": "An error occurred",
"grant-request-copy.header": "Grant document copy request",
"grant-request-copy.intro": "This message will be sent to the applicant of the request. The requested document(s) will be attached.",
"grant-request-copy.intro": "A message will be sent to the applicant of the request. The requested document(s) will be attached.",
"grant-request-copy.success": "Successfully granted item request",