Skip to content

Commit

Permalink
minor cleanup in MailService.java
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekmore committed Dec 20, 2024
1 parent 6ce0198 commit 4c1746e
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ public class MailService {
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
<%_ if (reactive) { _%>
Mono.defer(() -> {
this.sendEmailSync(to, subject, content, isMultipart, isHtml);
sendEmailSync(to, subject, content, isMultipart, isHtml);
return Mono.empty();
}).subscribe();
<%_ } else { _%>
this.sendEmailSync(to, subject, content, isMultipart, isHtml);
sendEmailSync(to, subject, content, isMultipart, isHtml);
<%_ } _%>
}

Expand Down Expand Up @@ -127,11 +127,11 @@ public class MailService {
public void sendEmailFromTemplate(<%= user.persistClass %> user, String templateName, String titleKey) {
<%_ if (reactive) { _%>
Mono.defer(() -> {
this.sendEmailFromTemplateSync(user, templateName, titleKey);
sendEmailFromTemplateSync(user, templateName, titleKey);
return Mono.empty();
}).subscribe();
<%_ } else { _%>
this.sendEmailFromTemplateSync(user, templateName, titleKey);
sendEmailFromTemplateSync(user, templateName, titleKey);
<%_ } _%>
}

Expand All @@ -146,7 +146,7 @@ public class MailService {
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process(templateName, context);
String subject = messageSource.getMessage(titleKey, null, locale);
this.sendEmailSync(user.getEmail(), subject, content, false, true);
sendEmailSync(user.getEmail(), subject, content, false, true);
}
<%_ if (!authenticationTypeOauth2) { _%>

Expand All @@ -155,23 +155,23 @@ public class MailService {
<%_ } _%>
public void sendActivationEmail(<%= user.persistClass %> user) {
LOG.debug("Sending activation email to '{}'", user.getEmail());
this.<%- localSendEmailFromTemplateApi %>(user, "mail/activationEmail", "email.activation.title");
<%- localSendEmailFromTemplateApi %>(user, "mail/activationEmail", "email.activation.title");
}

<%_ if (!reactive) { _%>
@Async
<%_ } _%>
public void sendCreationEmail(<%= user.persistClass %> user) {
LOG.debug("Sending creation email to '{}'", user.getEmail());
this.<%- localSendEmailFromTemplateApi %>(user, "mail/creationEmail", "email.activation.title");
<%- localSendEmailFromTemplateApi %>(user, "mail/creationEmail", "email.activation.title");
}

<%_ if (!reactive) { _%>
@Async
<%_ } _%>
public void sendPasswordResetMail(<%= user.persistClass %> user) {
LOG.debug("Sending password reset email to '{}'", user.getEmail());
this.<%- localSendEmailFromTemplateApi %>(user, "mail/passwordResetEmail", "email.reset.title");
<%- localSendEmailFromTemplateApi %>(user, "mail/passwordResetEmail", "email.reset.title");
}
<%_ } _%>
}

0 comments on commit 4c1746e

Please sign in to comment.