From d291c4294548222939f2be70f5d84f2d06e895c6 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Mon, 22 Jul 2024 08:19:10 -0600 Subject: [PATCH 1/6] Issn loader improvements reset fail count (#7054) * Deactivated records should get 409 on GET requests * Reset fail count when it is updated --- .../scheduler/loader/source/issn/IssnLoadSource.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/source/issn/IssnLoadSource.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/source/issn/IssnLoadSource.java index f59ea373cef..f4aa1f2c09f 100644 --- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/source/issn/IssnLoadSource.java +++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/loader/source/issn/IssnLoadSource.java @@ -174,8 +174,12 @@ private void recordFailure(GroupIdRecordEntity issnEntity, String notes) { private void updateIssnEntity(GroupIdRecordEntity issnEntity, IssnData issnData) { String currentGroupName = issnEntity.getGroupName(); - String updatedGroupName = issnData.getMainTitle(); - + String updatedGroupName = issnData.getMainTitle(); + + // Clear the fail count and reason + issnEntity.setIssnLoaderFailCount(0); + issnEntity.setFailReason(null); + if(!StringUtils.equals(currentGroupName, updatedGroupName)) { issnEntity.setGroupName(updatedGroupName); issnEntity.setClientSourceId(orcidSource.getId()); From 38feb58cd5bc5d4ebb979302fadfe173df106301 Mon Sep 17 00:00:00 2001 From: github actions Date: Mon, 22 Jul 2024 14:35:00 +0000 Subject: [PATCH 2/6] v2.62.3 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a107fe55c98..8072ba26969 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.62.3 - 2024-07-22 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.2...v2.62.3) + ## v2.62.2 - 2024-07-18 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.1...v2.62.2) From a62e9b2ce355e95ed4123fc4ec5ea93b7445149d Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:07:59 +0300 Subject: [PATCH 3/6] do not send email change notifications (#7056) * do not send email change notifications * adjust tests * adjust another test * remove more instances of notification being sent * remove all instances of the sendEmailAddressChangedNotification function --------- Co-authored-by: Angel Montenegro --- .../frontend/email/RecordEmailSender.java | 29 ------------------- .../controllers/ManageProfileController.java | 10 +------ .../frontend/email/RecordEmailSenderTest.java | 1 - .../ManageProfileControllerTest.java | 9 +----- 4 files changed, 2 insertions(+), 47 deletions(-) diff --git a/orcid-web/src/main/java/org/orcid/frontend/email/RecordEmailSender.java b/orcid-web/src/main/java/org/orcid/frontend/email/RecordEmailSender.java index fc2527e0f95..b6dac5e64d0 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/email/RecordEmailSender.java +++ b/orcid-web/src/main/java/org/orcid/frontend/email/RecordEmailSender.java @@ -228,35 +228,6 @@ public void sendReactivationEmail(String submittedEmail, String userOrcid) { mailgunManager.sendEmail(EmailConstants.DO_NOT_REPLY_NOTIFY_ORCID_ORG, submittedEmail, verifyEmailUtils.getSubject("email.subject.reactivation", locale), body, htmlBody); } - public void sendEmailAddressChangedNotification(String currentUserOrcid, String newEmail, String oldEmail) { - ProfileEntity profile = profileEntityCacheManager.retrieve(currentUserOrcid); - Locale userLocale = getUserLocaleFromProfileEntity(profile); - - // build up old template - Map templateParams = new HashMap(); - - String subject = verifyEmailUtils.getSubject("email.subject.email_removed", userLocale); - String emailFriendlyName = recordNameManager.deriveEmailFriendlyName(currentUserOrcid); - templateParams.put("emailName", emailFriendlyName); - String verificationUrl = verifyEmailUtils.createVerificationUrl(newEmail, orcidUrlManager.getBaseUrl()); - templateParams.put("verificationUrl", verificationUrl); - templateParams.put("oldEmail", oldEmail); - templateParams.put("newEmail", newEmail); - templateParams.put("orcid", currentUserOrcid); - templateParams.put("baseUri", orcidUrlManager.getBaseUrl()); - templateParams.put("baseUriHttp", orcidUrlManager.getBaseUriHttp()); - templateParams.put("subject", subject); - - verifyEmailUtils.addMessageParams(templateParams, userLocale); - - // Generate body from template - String body = templateManager.processTemplate("email_removed.ftl", templateParams); - // Generate html from template - String html = templateManager.processTemplate("email_removed_html.ftl", templateParams); - - mailgunManager.sendEmail(EmailConstants.DO_NOT_REPLY_NOTIFY_ORCID_ORG, oldEmail, subject, body, html); - } - public void sendClaimReminderEmail(String userOrcid, int daysUntilActivation, String email) { ProfileEntity record = profileEntityCacheManager.retrieve(userOrcid); String primaryEmail = emailManager.findPrimaryEmail(userOrcid).getEmail(); diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java index 1579ef03bb1..09b7c3618da 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java @@ -541,7 +541,6 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht List newEmails = new ArrayList(); String orcid = getCurrentUserOrcid(); List errors = new ArrayList(); - for (org.orcid.pojo.ajaxForm.Email newJsonEmail : newEmailSet.getEmails()) { boolean isNewEmail = true; for (org.orcid.jaxb.model.v3.release.record.Email oldJsonEmail: oldEmailSet.getEmails()) { @@ -646,7 +645,6 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht Map keys = emailManager.addEmail(currentUserOrcid, email.toV3Email()); if(!keys.isEmpty()) { request.getSession().setAttribute(EmailConstants.CHECK_EMAIL_VALIDATED, false); - recordEmailSender.sendEmailAddressChangedNotification(currentUserOrcid, keys.get("new"), keys.get("old")); } recordEmailSender.sendVerificationEmail(currentUserOrcid, OrcidStringUtils.filterEmailAddress(email.getValue()), email.isPrimary()); } else { @@ -736,13 +734,12 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht public @ResponseBody org.orcid.pojo.ajaxForm.Email setPrimary(HttpServletRequest request, @RequestBody org.orcid.pojo.ajaxForm.Email email) { String orcid = getCurrentUserOrcid(); String owner = emailManager.findOrcidIdByEmail(email.getValue()); - if(orcid.equals(owner)) { + if(orcid.equals(owner)) { // Sets the given email as primary Map keys = emailManager.setPrimary(orcid, email.getValue().trim(), request); if(keys.containsKey("new")) { String newPrimary = keys.get("new"); String oldPrimary = keys.get("old"); - recordEmailSender.sendEmailAddressChangedNotification(orcid, newPrimary, oldPrimary); if(keys.containsKey("sendVerification")) { recordEmailSender.sendVerificationEmail(orcid, newPrimary, true); request.getSession().setAttribute(EmailConstants.CHECK_EMAIL_VALIDATED, false); @@ -788,11 +785,6 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht String original = editEmail.getOriginal(); String edited = editEmail.getEdited(); Map keys = emailManager.editEmail(orcid, original, edited, request); - if(keys.containsKey("new")) { - String newPrimary = keys.get("new"); - String oldPrimary = keys.get("old"); - recordEmailSender.sendEmailAddressChangedNotification(orcid, newPrimary, oldPrimary); - } String verifyAddress = keys.get("verifyAddress"); boolean isPrimaryEmail = keys.containsKey("new") ? true : false; recordEmailSender.sendVerificationEmail(orcid, verifyAddress, isPrimaryEmail); diff --git a/orcid-web/src/test/java/org/orcid/frontend/email/RecordEmailSenderTest.java b/orcid-web/src/test/java/org/orcid/frontend/email/RecordEmailSenderTest.java index 8809913601f..d84ead50cc4 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/email/RecordEmailSenderTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/email/RecordEmailSenderTest.java @@ -204,7 +204,6 @@ public void testChangeEmailAddress() throws Exception { for (org.orcid.jaxb.model.common_v2.Locale locale : org.orcid.jaxb.model.common_v2.Locale.values()) { profile.setLocale(locale.name()); - recordEmailSender.sendEmailAddressChangedNotification(orcid, "new@email.com", "original@email.com"); } } diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java index 947034cc458..677f1278681 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/ManageProfileControllerTest.java @@ -985,8 +985,7 @@ public void testAddEmail_noPrimaryEmailChange() { when(mockEmailManager.emailExists(eq("new@email.com"))).thenReturn(false); controller.addEmails(mockRequest, newEmail); - - verify(mockRecordEmailSender, Mockito.never()).sendEmailAddressChangedNotification(any(), any(), any()); + verify(mockRecordEmailSender, Mockito.times(1)).sendVerificationEmail(eq(USER_ORCID), eq("new@email.com"), eq(false)); } @@ -1009,7 +1008,6 @@ public void testAddEmail_primaryEmailChange() { controller.addEmails(mockRequest, newEmail); - verify(mockRecordEmailSender, Mockito.times(1)).sendEmailAddressChangedNotification(eq(USER_ORCID), eq("new@email.com"), eq("old@email.com")); verify(mockRecordEmailSender, Mockito.times(1)).sendVerificationEmail(eq(USER_ORCID), eq("new@email.com"), eq(false)); } @@ -1030,7 +1028,6 @@ public void testSetPrimary_nothingChange() { controller.setPrimary(mockRequest, email); - verify(mockRecordEmailSender, Mockito.never()).sendEmailAddressChangedNotification(any(), any(), any()); verify(mockRecordEmailSender, Mockito.never()).sendVerificationEmail(any(), any(), any()); } @@ -1051,7 +1048,6 @@ public void testSetPrimary_primaryEmailChange() { controller.setPrimary(mockRequest, email); - verify(mockRecordEmailSender, Mockito.times(1)).sendEmailAddressChangedNotification(eq(USER_ORCID), eq("email@orcid.org"), eq("old@orcid.org")); verify(mockRecordEmailSender, Mockito.never()).sendVerificationEmail(any(), any(), any()); } @@ -1075,7 +1071,6 @@ public void testSetPrimary_primaryEmailChangeAndPrimaryIsNotVerified() { controller.setPrimary(mockRequest, email); - verify(mockRecordEmailSender, Mockito.times(1)).sendEmailAddressChangedNotification(eq(USER_ORCID), eq("email@orcid.org"), eq("old@orcid.org")); verify(mockRecordEmailSender, Mockito.times(1)).sendVerificationEmail(eq(USER_ORCID), eq("email@orcid.org"), eq(true)); } @@ -1099,7 +1094,6 @@ public void testEditEmail_noPrimaryChange() { controller.editEmail(mockRequest, email); - verify(mockRecordEmailSender, Mockito.never()).sendEmailAddressChangedNotification(any(), any(), any()); verify(mockRecordEmailSender, Mockito.times(1)).sendVerificationEmail(eq(USER_ORCID), eq("email@orcid.org"), eq(false)); } @@ -1120,7 +1114,6 @@ public void testEditEmail_primaryEmailChange() { when(mockEmailManager.editEmail(eq(USER_ORCID), eq("old@orcid.org"), eq("email@orcid.org"), any())).thenReturn(Map.of("verifyAddress", "email@orcid.org", "new", "email@orcid.org", "old", "old@orcid.org")); controller.editEmail(mockRequest, email); - verify(mockRecordEmailSender, Mockito.times(1)).sendEmailAddressChangedNotification(eq(USER_ORCID), eq("email@orcid.org"), eq("old@orcid.org")); verify(mockRecordEmailSender, Mockito.times(1)).sendVerificationEmail(eq(USER_ORCID), eq("email@orcid.org"), eq(true)); } From 94fa8bcaa58981d29f496d87548564e4fda6824b Mon Sep 17 00:00:00 2001 From: github actions Date: Wed, 24 Jul 2024 17:22:23 +0000 Subject: [PATCH 4/6] v2.62.4 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8072ba26969..3295d512178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.62.4 - 2024-07-24 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.3...v2.62.4) + ## v2.62.3 - 2024-07-22 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.2...v2.62.3) From e53fe24ea392483de646adec9ab2bcc52df43c85 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:46:26 +0300 Subject: [PATCH 5/6] add timestamp to date pojo (#7057) * add timestamp to date pojo * remove duplicated and unused code --- .../java/org/orcid/pojo/ajaxForm/Date.java | 5 +++++ .../java/org/orcid/pojo/ajaxForm/Email.java | 18 ++---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java index abe25f83d29..a9c4f1d4964 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Date.java @@ -22,6 +22,7 @@ public class Date implements ErrorsInterface, Required, Serializable, Comparable private String month; private String day; private String year; + private Long timestamp; private boolean required = true; private String getRequiredMessage; @@ -171,6 +172,10 @@ public void setYear(String year) { this.year = year; } + public Long getTimestamp() { return timestamp; } + + public void setTimestamp(Long timestamp) { this.timestamp = timestamp; } + @Override public int hashCode() { final int prime = 31; diff --git a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java index a54750d6053..7b65d9f3190 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java +++ b/orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Email.java @@ -1,5 +1,6 @@ package org.orcid.pojo.ajaxForm; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; @@ -43,22 +44,6 @@ public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) { email.setVerified(e.isVerified()); email.setVisibility(e.getVisibility()); - if (e.getCreatedDate() != null) { - Date createdDate = new Date(); - createdDate.setYear(String.valueOf(e.getCreatedDate().getValue().getYear())); - createdDate.setMonth(String.valueOf(e.getCreatedDate().getValue().getMonth())); - createdDate.setDay(String.valueOf(e.getCreatedDate().getValue().getDay())); - email.setCreatedDate(createdDate); - } - - if (e.getLastModifiedDate() != null) { - Date lastModifiedDate = new Date(); - lastModifiedDate.setYear(String.valueOf(e.getLastModifiedDate().getValue().getYear())); - lastModifiedDate.setMonth(String.valueOf(e.getLastModifiedDate().getValue().getMonth())); - lastModifiedDate.setDay(String.valueOf(e.getLastModifiedDate().getValue().getDay())); - email.setLastModified(lastModifiedDate); - } - if (e.getSource().getSourceName() != null) { email.setSourceName(e.getSource().getSourceName().getContent()); } @@ -80,6 +65,7 @@ public static Email valueOf(org.orcid.jaxb.model.v3.release.record.Email e) { createdDate.setYear(String.valueOf(e.getCreatedDate().getValue().getYear())); createdDate.setMonth(String.valueOf(e.getCreatedDate().getValue().getMonth())); createdDate.setDay(String.valueOf(e.getCreatedDate().getValue().getDay())); + createdDate.setTimestamp(e.getCreatedDate().getValue().toGregorianCalendar().getTimeInMillis()); email.setCreatedDate(createdDate); } From e4ca907878b0d679056f5b76fad82d68dac6c50d Mon Sep 17 00:00:00 2001 From: github actions Date: Wed, 24 Jul 2024 20:00:42 +0000 Subject: [PATCH 6/6] v2.62.5 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3295d512178..1dbc91d7d0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.62.5 - 2024-07-24 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.4...v2.62.5) + ## v2.62.4 - 2024-07-24 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.62.3...v2.62.4)