mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
⚡ create a poll sends a mail to owner
This commit is contained in:
parent
fe59537bc6
commit
f6da68997d
@ -85,4 +85,25 @@ class FramadateController extends AbstractController {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Owner $foundOwner
|
||||
* @param Poll|null $poll
|
||||
*
|
||||
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
|
||||
*/
|
||||
public function sendCreationMailAction( Owner $foundOwner, Poll $poll = null ) {
|
||||
|
||||
// anti spam , limit to every minute TODO
|
||||
|
||||
$config = [
|
||||
'owner' => $foundOwner,
|
||||
'from' => 'ne-pas-repondre@framadate-api.cipherbliss.com',
|
||||
'poll' => $poll,
|
||||
'title' => 'Création de sondage - ' . ( $poll ? $poll->getTitle() : $poll ),
|
||||
'email_template' => 'emails/creation-mail.html.twig',
|
||||
];
|
||||
|
||||
return $this->sendMailWithVars( $config );
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ class PollController extends FramadateController {
|
||||
$precision = 'from an existing user : ' . $foundOwner->getEmail();
|
||||
}
|
||||
|
||||
$this->mail_service->sendCreationMailAction( $foundOwner, $newpoll );
|
||||
$this->sendCreationMailAction( $foundOwner, $newpoll );
|
||||
|
||||
return $this->json( [
|
||||
'message' => 'you created a poll ' . $precision,
|
||||
|
Loading…
Reference in New Issue
Block a user