From 9a8e044478ee671cb8ef8237173888316b93f5b3 Mon Sep 17 00:00:00 2001 From: llopat <llopat@man.poznan.pl> Date: Wed, 4 Sep 2024 15:18:24 +0200 Subject: [PATCH] Tyring to fix an issue with email content preparation --- .../net/geant/nmaas/notifications/NotificationController.java | 2 +- .../net/geant/nmaas/notifications/NotificationManager.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/geant/nmaas/notifications/NotificationController.java b/src/main/java/net/geant/nmaas/notifications/NotificationController.java index 479709ca7..762740d7c 100644 --- a/src/main/java/net/geant/nmaas/notifications/NotificationController.java +++ b/src/main/java/net/geant/nmaas/notifications/NotificationController.java @@ -31,7 +31,7 @@ public class NotificationController { // TODO verify if captcha token must be verified MailType mailType = mailAttributes.getMailType(); - if(mailType.equals(MailType.CONTACT_FORM) || mailType.equals(MailType.ISSUE_REPORT) || mailType.equals(MailType.NEW_DOMAIN_REQUEST)) { + if (mailType.equals(MailType.CONTACT_FORM) || mailType.equals(MailType.ISSUE_REPORT) || mailType.equals(MailType.NEW_DOMAIN_REQUEST)) { eventPublisher.publishEvent(new NotificationEvent(this, mailAttributes)); } else { throw new AuthenticationException("You are not allowed to send this mail"); diff --git a/src/main/java/net/geant/nmaas/notifications/NotificationManager.java b/src/main/java/net/geant/nmaas/notifications/NotificationManager.java index 401a06eff..ad62a89f3 100644 --- a/src/main/java/net/geant/nmaas/notifications/NotificationManager.java +++ b/src/main/java/net/geant/nmaas/notifications/NotificationManager.java @@ -70,7 +70,7 @@ public class NotificationManager { try { template = templateService.getHTMLTemplate(); } catch (IOException e) { - log.error(String.format("Cannot retrieve html template: %s", e.getMessage())); + log.error("Cannot retrieve html template: {}", e.getMessage()); throw new ProcessingException(e); } @@ -193,7 +193,7 @@ public class NotificationManager { } private String getFilledTemplate(Template template, LanguageMailContentView langContent, UserView user, MailAttributes mailAttributes, MailTemplateView mailTemplate) throws IOException, TemplateException { - boolean showAdditional = mailAttributes.getOtherAttributes().get("message") != null; + boolean showAdditional = mailAttributes.getMailType() == MailType.NEW_ACTIVE_APP && mailAttributes.getOtherAttributes().get("message") != null; return FreeMarkerTemplateUtils.processTemplateIntoString(template, ImmutableMap.builder() .putAll(mailTemplate.getGlobalInformation()) .put(MailTemplateElements.PORTAL_LINK, this.portalAddress == null ? "" : this.portalAddress) -- GitLab