From ca5ad58f87a092f2c946f88c2e0a3aec6b486e2c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 15:31:16 +0300 Subject: email: do not send null when body is empty --- juick-api/src/main/java/com/juick/api/EmailManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'juick-api/src/main/java') diff --git a/juick-api/src/main/java/com/juick/api/EmailManager.java b/juick-api/src/main/java/com/juick/api/EmailManager.java index 411e86ec..6ba790d3 100644 --- a/juick-api/src/main/java/com/juick/api/EmailManager.java +++ b/juick-api/src/main/java/com/juick/api/EmailManager.java @@ -6,6 +6,7 @@ import com.juick.server.util.HttpBadRequestException; import com.juick.service.EmailService; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; @@ -75,7 +76,7 @@ public class EmailManager implements ApplicationListener { message.setSubject(subject); message.setText(String.format("%s\n%s\n\n---\nYou are receiving this because you are subscribed to this user " + "or discussion. Configure notifications at https://juick.com/settings", - formatPost(msg), formatUrl(msg))); + StringUtils.isNotEmpty(msg.getText()) ? formatPost(msg) : "", formatUrl(msg))); message.saveChanges(); transport.connect(); transport.sendMessage(message, message.getAllRecipients()); -- cgit v1.2.3