aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/EmailManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-20 00:07:06 +0300
committerGravatar Vitaly Takmazov2018-11-20 00:07:06 +0300
commit930e6ab6d604963ae6a48c58fc1bd3735071d9ee (patch)
treebb236bf36ccab695bef4d45012135c2396c84f77 /src/main/java/com/juick/server/EmailManager.java
parent74740d5d989f11746266a994840f89e9f6784f73 (diff)
getMessage refactoring
Diffstat (limited to 'src/main/java/com/juick/server/EmailManager.java')
-rw-r--r--src/main/java/com/juick/server/EmailManager.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/com/juick/server/EmailManager.java b/src/main/java/com/juick/server/EmailManager.java
index 1cdafac6..af4ed416 100644
--- a/src/main/java/com/juick/server/EmailManager.java
+++ b/src/main/java/com/juick/server/EmailManager.java
@@ -55,7 +55,7 @@ public class EmailManager implements NotificationListener {
emailNotify(email, subject, msg);
});
} else if (MessageUtils.isReply(msg)) {
- Message originalMessage = messagesService.getMessage(msg.getMid());
+ Message originalMessage = messagesService.getMessage(msg.getMid()).orElseThrow(IllegalStateException::new);
String subject = String.format("New reply to %s", originalMessage.getUser().getName());
subscribedUsers.stream()
.flatMap(user -> emailService.getEmails(user.getUid(), true).stream())
@@ -103,7 +103,7 @@ public class EmailManager implements NotificationListener {
Message replyto = messagesService.getReply(msg.getMid(), msg.getReplyto());
headers.put("In-Reply-To", String.format("<%d.%d@juick.com>", replyto.getMid(), replyto.getRid()));
} else {
- Message original = messagesService.getMessage(msg.getMid());
+ Message original = messagesService.getMessage(msg.getMid()).orElseThrow(IllegalStateException::new);
headers.put("In-Reply-To", String.format("<%d.%d@juick.com>", original.getMid(), original.getRid()));
}
}