use of org.mamute.model.User in project mamute by caelum.
the class NewQuestionMailer method send.
public void send(List<User> subscribed, Question question) {
linker.linkTo(QuestionController.class).showQuestion(question, question.getSluggedTitle());
String questionLink = linker.get();
TemplateMail template = templates.template("new_question_notification").with("question", question).with("bundle", bundle).with("questionLink", questionLink).with("logoUrl", emailLogo);
for (User user : subscribed) {
boolean notSameAuthor = !user.equals(question.getAuthor());
if (notSameAuthor) {
Email email = template.to(user.getName(), user.getEmail());
mailer.asyncSend(email);
}
}
}
use of org.mamute.model.User in project mamute by caelum.
the class NotificationMailer method send.
public void send(NotificationMail notificationMail) {
User to = notificationMail.getTo();
Email email = buildEmail(notificationMail);
email.setCharset("utf-8");
try {
mailer.send(email);
} catch (EmailException e) {
LOG.error("Could not send notifications mail to: " + to.getEmail(), e);
}
}
use of org.mamute.model.User in project mamute by caelum.
the class SubscribeUsersToNewQuestion method subscribeUsers.
public void subscribeUsers(@Observes QuestionCreated questionCreated) {
Question question = questionCreated.getQuestion();
List<User> subscribed = users.findUsersSubscribedToAllQuestions();
for (User user : subscribed) {
watchers.add(question, new Watcher(user));
}
newQuestionMailer.send(subscribed, question);
}
use of org.mamute.model.User in project mamute by caelum.
the class TestCase method user.
protected User user(String name, String email) {
User user = new User(SanitizedText.fromTrustedText(name), email);
user.confirmEmail();
return user;
}
use of org.mamute.model.User in project mamute by caelum.
the class UserDAOTest method should_find_by_session_key.
@Test
public void should_find_by_session_key() {
User gui = user("Guilherme Sonar", "gui@email.com.br");
users.save(gui);
UserSession userSession = gui.newSession();
users.save(userSession);
assertEquals(gui, users.findBySessionKey(userSession.getSessionKey()).getUser());
assertNull(users.findBySessionKey("12345"));
assertNull(users.findBySessionKey(null));
}
Aggregations