From 93fcbe79aa2bdd9e41f8d6a22c455e211d227f50 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 11 May 2023 12:50:47 -0400 Subject: [PATCH] Make grant message an optional addition; main text is in backend. --- .../email-request-copy.component.html | 5 +--- .../grant-request-copy.component.ts | 30 ------------------- src/assets/i18n/en.json5 | 6 ++-- 3 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/app/request-copy/email-request-copy/email-request-copy.component.html b/src/app/request-copy/email-request-copy/email-request-copy.component.html index d7633b0334..70146ab52c 100644 --- a/src/app/request-copy/email-request-copy/email-request-copy.component.html +++ b/src/app/request-copy/email-request-copy/email-request-copy.component.html @@ -8,10 +8,7 @@
- -
- {{ 'grant-deny-request-copy.email.message.empty' | translate }} -
+
diff --git a/src/app/request-copy/grant-request-copy/grant-request-copy.component.ts b/src/app/request-copy/grant-request-copy/grant-request-copy.component.ts index 79bae360a0..3f0fd74bc7 100644 --- a/src/app/request-copy/grant-request-copy/grant-request-copy.component.ts +++ b/src/app/request-copy/grant-request-copy/grant-request-copy.component.ts @@ -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)), - ); } /** diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 480bf8834e..b1bb88fce6 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -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",