diff options
author | 2017-12-25 15:31:16 +0300 | |
---|---|---|
committer | 2017-12-25 15:31:16 +0300 | |
commit | ca5ad58f87a092f2c946f88c2e0a3aec6b486e2c (patch) | |
tree | cda972e38be9022775c1e29abba6e12f64600e36 /juick-api/src/main/java | |
parent | 8549d81c88fec6af20d1314aba43702941fe177b (diff) |
email: do not send null when body is empty
Diffstat (limited to 'juick-api/src/main/java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/EmailManager.java | 3 |
1 files changed, 2 insertions, 1 deletions
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<MessageEvent> { 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()); |