aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-25 16:41:36 +0300
committerGravatar Vitaly Takmazov2017-12-25 16:41:36 +0300
commit6e1c52c8014083f3fcc0133b64e46f013f3afab8 (patch)
treeca42f7eb66ddf475a5d2fa23f95220088ccf67c5 /juick-api/src/main/java/com/juick/api
parentb1eb6fd80ba37364c6f04cc15fd3da4462476292 (diff)
add hash to email
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r--juick-api/src/main/java/com/juick/api/EmailManager.java8
1 files changed, 6 insertions, 2 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 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<MessageEvent> {
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<MessageEvent> {
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());