Skip to content

Commit

Permalink
CS-5663 - No-register user cannot send comment
Browse files Browse the repository at this point in the history
  • Loading branch information
takeit committed Feb 17, 2015
1 parent 5ce4bfd commit 5b0e064
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Newscoop\EventDispatcher\Events\GenericEvent;
use Doctrine\ORM\EntityManager;
use Newscoop\NewscoopException;

/**
*/
Expand Down Expand Up @@ -54,7 +55,13 @@ public function update(GenericEvent $event)
->getArticle($comment->getThread()->getNumber(), $comment->getLanguage()->getId())
->getSingleResult();

try {
$user = $this->userService->getCurrentUser();
} catch (NewscoopException $e) {
$user = null;
}

$authors = \ArticleAuthor::GetAuthorsByArticle($comment->getThread()->getNumber(), $comment->getLanguage()->getId());
$this->emailService->sendCommentNotification($comment, $article, $authors, $this->userService->getCurrentUser());
$this->emailService->sendCommentNotification($comment, $article, $authors, $user);
}
}

0 comments on commit 5b0e064

Please sign in to comment.