forked from ORCID/ORCID-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New link and subject should contain the orcid id (ORCID#7175)
- Loading branch information
1 parent
7aa3e60
commit 174bb2a
Showing
3 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ public class ApiRateLimitFilter extends OncePerRequestFilter { | |
+ "You can increase your daily quota by registering for and using Public API client credentials " | ||
+ "(https://info.orcid.org/documentation/integration-guide/registering-a-public-api-client/)"; | ||
|
||
private static final String SUBJECT = "[ORCID-API] WARNING! You have exceeded the daily Public API Usage Limit - "; | ||
private static final String SUBJECT = "[ORCID-API] WARNING! You have exceeded the daily Public API Usage Limit - ({ORCID-ID})"; | ||
|
||
@Value("${org.orcid.papi.rate.limit.fromEmail:[email protected]}") | ||
private String FROM_ADDRESS; | ||
|
@@ -230,7 +230,7 @@ private Map<String, Object> createTemplateParams(String clientId, String clientN | |
templateParams.put("locale", LocaleUtils.toLocale("en")); | ||
templateParams.put("baseUri", orcidUrlManager.getBaseUrl()); | ||
templateParams.put("baseUriHttp", orcidUrlManager.getBaseUriHttp()); | ||
templateParams.put("subject", SUBJECT + orcidId); | ||
templateParams.put("subject", SUBJECT.replace("{ORCID-ID}", orcidId)); | ||
return templateParams; | ||
} | ||
|
||
|
@@ -256,8 +256,9 @@ private void sendEmail(String clientId, LocalDate requestDate) { | |
setPapiRateExceededItemInPanoply(item); | ||
} | ||
|
||
String subject = templateParams.containsKey("subject") ? ((String) templateParams.get("subject")) : SUBJECT; | ||
// Send the email | ||
boolean mailSent = mailGunManager.sendEmailWithCC(FROM_ADDRESS, email, CC_ADDRESS, SUBJECT, body, html); | ||
boolean mailSent = mailGunManager.sendEmailWithCC(FROM_ADDRESS, email, CC_ADDRESS, subject, body, html); | ||
if (!mailSent) { | ||
LOG.error("Failed to send email for papi limits, orcid=" + memberId + " email: " + email); | ||
} | ||
|