From 6e1c52c8014083f3fcc0133b64e46f013f3afab8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 16:41:36 +0300 Subject: add hash to email --- juick-api/src/main/java/com/juick/api/EmailManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'juick-api/src/main') 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 6ba790d3..0093413e 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 com.juick.service.UserService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,6 +35,8 @@ public class EmailManager implements ApplicationListener { SubscriptionService subscriptionService; @Inject MessagesService messagesService; + @Inject + UserService userService; @Override public void onApplicationEvent(MessageEvent event) { Message msg = event.getMessage(); @@ -75,8 +78,9 @@ public class EmailManager implements ApplicationListener { message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(email)); 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", - StringUtils.isNotEmpty(msg.getText()) ? formatPost(msg) : "", formatUrl(msg))); + "or discussion. Configure notifications at https://juick.com/settings?hash=%s", + StringUtils.isNotEmpty(msg.getText()) ? formatPost(msg) : "", formatUrl(msg), + userService.getHashByUID(userService.getUserByEmail(email).getUid()))); message.saveChanges(); transport.connect(); transport.sendMessage(message, message.getAllRecipients()); -- cgit v1.2.3