Search in sources :

Example 1 with Email

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);
}
Also used : Email(codeu.utils.Email) Activity(codeu.model.data.Activity)

Example 2 with Email

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);
}
Also used : Email(codeu.utils.Email) Activity(codeu.model.data.Activity)

Aggregations

Activity (codeu.model.data.Activity)2 Email (codeu.utils.Email)2