mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
add other mails
This commit is contained in:
parent
f6da68997d
commit
f40eb596b4
@ -115,7 +115,10 @@ class CommentController extends FramadateController {
|
|||||||
$em->persist( $comment );
|
$em->persist( $comment );
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->mail_service->sendCommentNotification($comment);
|
if($poll->getMailOnComment()){
|
||||||
|
$this->sendCommentNotificationAction($foundOwner, $comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => 'you created a comment',
|
'message' => 'you created a comment',
|
||||||
|
@ -106,4 +106,46 @@ class FramadateController extends AbstractController {
|
|||||||
|
|
||||||
return $this->sendMailWithVars( $config );
|
return $this->sendMailWithVars( $config );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Owner $owner
|
||||||
|
* @param $comment
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
|
||||||
|
*/
|
||||||
|
public function sendCommentNotificationAction( Owner $owner, $comment ) {
|
||||||
|
|
||||||
|
$config = [
|
||||||
|
'owner' => $owner,
|
||||||
|
'comment' => $comment,
|
||||||
|
'poll' => $comment->getPoll(),
|
||||||
|
'title' => 'Framadate | Commentaire de "' . $owner->getPseudo() . '" - sondage ' . $comment->getPoll()->getTitle(),
|
||||||
|
'email_template' => 'emails/comment-notification.html.twig',
|
||||||
|
];
|
||||||
|
$this->sendMailWithVars( $config );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Owner $owner
|
||||||
|
* @param $stackOfVotes
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
|
||||||
|
*/
|
||||||
|
public function sendVoteNotificationAction( Owner $owner, $stackOfVotes ) {
|
||||||
|
|
||||||
|
$config = [
|
||||||
|
'owner' => $owner,
|
||||||
|
'comment' => $stackOfVotes,
|
||||||
|
'poll' => $stackOfVotes->getPoll(),
|
||||||
|
'title' => 'Framadate | Vote de "' . $owner->getPseudo() . '" - sondage ' . $stackOfVotes->getPoll()->getTitle(),
|
||||||
|
'email_template' => 'emails/vote-notification.html.twig',
|
||||||
|
];
|
||||||
|
$this->sendMailWithVars( $config );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,12 @@ class VoteController extends FramadateController {
|
|||||||
$choices[] = $c->display();
|
$choices[] = $c->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($poll->getMailOnVote()){
|
||||||
|
$this->sendVoteNotificationAction($stack->getOwner(), $stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => 'you created a vote stack' . $precision,
|
'message' => 'you created a vote stack' . $precision,
|
||||||
'poll' => $poll,
|
'poll' => $poll,
|
||||||
|
Loading…
Reference in New Issue
Block a user