Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup in MailService.java #28250

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
<%_ } _%>
}
Loading