public function spamCheck(CommentPersistEvent $event)
 {
     $comment = $event->getComment();
     if ($this->spamDetector->isSpam($comment)) {
         if (null !== $this->logger) {
             $this->logger->info('Comment is marked as spam from detector, aborting persistence.');
         }
         $event->abortPersistence();
     }
 }
Beispiel #2
0
 public function onCommentPrePersist(CommentPersistEvent $event)
 {
     $comment = $event->getComment();
     //        var_dump($comment->getNotifyToAdmin());
     //        die;
     if (!$this->commentManager->isNewComment($comment)) {
         return;
     }
     if ($comment instanceof SignedCommentInterface) {
         $author = $comment->getAuthor();
     }
     $this->send_report_reply($comment->getThread()->getIncident(), $comment->getBody(), !$comment->getNotifyToAdmin());
 }