From 6610eb1ae0b7e72fdd3d66118817914a62ce3cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Tue, 19 Sep 2023 10:16:20 +0200 Subject: [PATCH] User feedback API fixes: - Update mail message, related to #6792. - Don't fail the user feedback creation if the mail server is not configured --- .../api/userfeedback/UserFeedbackAPI.java | 20 +++++++++++-------- .../org/fao/geonet/api/Messages.properties | 2 +- .../fao/geonet/api/Messages_fre.properties | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/services/src/main/java/org/fao/geonet/api/userfeedback/UserFeedbackAPI.java b/services/src/main/java/org/fao/geonet/api/userfeedback/UserFeedbackAPI.java index dcd6e643c4e..5b99432c378 100644 --- a/services/src/main/java/org/fao/geonet/api/userfeedback/UserFeedbackAPI.java +++ b/services/src/main/java/org/fao/geonet/api/userfeedback/UserFeedbackAPI.java @@ -514,14 +514,18 @@ public ResponseEntity newUserFeedback( String title = XslUtil.getIndexField(null, userFeedbackDto.getMetadataUUID(), "resourceTitleObject", ""); if (toAddress.size() > 0) { - MailUtil.sendMail(toAddress, - String.format( - messages.getString("new_user_rating"), - catalogueName, title), - String.format( - messages.getString("new_user_rating_text"), - metadataUtils.getDefaultUrl(userFeedbackDto.getMetadataUUID(), locale.getISO3Language())), - settingManager); + try { + MailUtil.sendMail(toAddress, + String.format( + messages.getString("new_user_rating"), + catalogueName, title), + String.format( + messages.getString("new_user_rating_text"), + metadataUtils.getDefaultUrl(userFeedbackDto.getMetadataUUID(), locale.getISO3Language())), + settingManager); + } catch (IllegalArgumentException ex) { + Log.warning(API.LOG_MODULE_NAME, ex.getMessage(), ex); + } } } } diff --git a/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages.properties b/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages.properties index 092cb028af3..5daaa385ad5 100644 --- a/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages.properties +++ b/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages.properties @@ -78,7 +78,7 @@ register_email_message=Dear User,\n\ Yours sincerely,\n\ The %s team. new_user_rating=%s / New user rating on %s -new_user_rating_text=See record %sapi/records/%s +new_user_rating_text=See record %s user_feedback_title=%s / User feedback on %s / %s user_feedback_text=User %s (%s - %s)\n\ - Email: %s\n\ diff --git a/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages_fre.properties b/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages_fre.properties index 34f809d7d95..6efe5d2b3fa 100644 --- a/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages_fre.properties +++ b/web/src/main/webapp/WEB-INF/classes/org/fao/geonet/api/Messages_fre.properties @@ -66,7 +66,7 @@ register_email_message=Cher utilisateur,\n\ Salutations,\n\ L'\u00E9quipe %s. new_user_rating=%s / Nouvelle \u00E9valuation faite pour %s -new_user_rating_text=Consulter la fiche %sapi/records/%s +new_user_rating_text=Consulter la fiche %s user_feedback_title=%s / Nouveau commentaire sur %s / %s user_feedback_text=Utilisateur %s (%s - %s)\n\ - Email: %s\n\