use of codeu.utils.Email in project codeu-2018-team12 by codeu-2018-team12.
the class ChatServlet method createActivity.
/**
* Constructs an activity object and adds it to activityStore
*/
private void createActivity(Conversation conversation, User user, String messageContent, boolean containsImage) {
String activityMessage;
if (containsImage) {
activityMessage = " sent a picture in " + "<a href=\"/chat/" + conversation.getTitle() + "\">" + conversation.getTitle() + "</a>.";
} else {
activityMessage = " sent a message in " + "<a href=\"/chat/" + conversation.getTitle() + "\">" + conversation.getTitle() + "</a>" + ": " + messageContent;
}
Activity activity = new Activity(UUID.randomUUID(), user.getId(), conversation.getId(), Instant.now(), "messageSent", activityMessage, conversation.getConversationUsers(), conversation.getIsPublic());
activityStore.addActivity(activity);
Email email = new Email();
email.sendEmailNotification(user, conversation);
}
use of codeu.utils.Email in project codeu-2018-team12 by codeu-2018-team12.
the class DirectMessageServlet method createActivity.
/**
* Constructs an activity object and adds it to activityStore
*/
private void createActivity(Conversation conversation, User user, String messageContent, boolean containsImage) {
String activityMessage;
if (containsImage) {
activityMessage = " sent a picture in" + "<a href=\"/chat/" + conversation.getTitle() + "\">" + conversation.getTitle() + "</a>.";
} else {
activityMessage = " sent a direct message in " + "<a href=\"/chat/" + conversation.getTitle() + "\">" + conversation.getTitle() + "</a>" + ": " + messageContent;
}
Activity activity = new Activity(UUID.randomUUID(), user.getId(), conversation.getId(), Instant.now(), "messageSent", activityMessage, conversation.getConversationUsers(), conversation.getIsPublic());
activityStore.addActivity(activity);
Email email = new Email();
email.sendEmailNotification(user, conversation);
}