mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
remove date diff
This commit is contained in:
parent
81b27811c2
commit
00fe90b66b
@ -6,7 +6,6 @@ namespace App\Service;
|
||||
|
||||
use App\Entity\Owner;
|
||||
use App\Entity\Poll;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Swift_Message;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
@ -35,17 +34,7 @@ class MailService {
|
||||
$poll = $newpoll;
|
||||
|
||||
|
||||
// anti spam , limit to every minute
|
||||
$lastSend = $admin_user->getRequestedPollsDate();
|
||||
$now = new \DateTime();
|
||||
|
||||
if ( date_diff( $lastSend, $now ) < 60 ) {
|
||||
// too soon!
|
||||
die( 'too soon!' );
|
||||
}
|
||||
$admin_user->setRequestedPollsDate( $now );
|
||||
$em->persist( $admin_user );
|
||||
$em->flush();
|
||||
// anti spam , limit to every minute TODO
|
||||
|
||||
$templateVars = [
|
||||
'owner' => $admin_user,
|
||||
@ -69,6 +58,7 @@ class MailService {
|
||||
|
||||
/**
|
||||
* send created polls to an owner
|
||||
*
|
||||
* @param Owner $foundOwner
|
||||
*
|
||||
* @return int
|
||||
@ -79,17 +69,17 @@ class MailService {
|
||||
$admin_user = $foundOwner;
|
||||
|
||||
|
||||
// anti spam , limit to every minute
|
||||
$lastSend = $admin_user->getRequestedPollsDate();
|
||||
$now = new \DateTime();
|
||||
// anti spam , limit to every minute TODO
|
||||
// $lastSend = $admin_user->getRequestedPollsDate();
|
||||
// $now = new \DateTime();
|
||||
|
||||
if ( date_diff( $lastSend, $now ) < 60 ) {
|
||||
// too soon!
|
||||
die( 'too soon!' );
|
||||
}
|
||||
$admin_user->setRequestedPollsDate( $now );
|
||||
$em->persist( $admin_user );
|
||||
$em->flush();
|
||||
// if ( date_diff( $lastSend, $now ) < 60 ) {
|
||||
// // too soon!
|
||||
// die( 'too soon!' );
|
||||
// }
|
||||
// $admin_user->setRequestedPollsDate( $now );
|
||||
// $em->persist( $admin_user );
|
||||
// $em->flush();
|
||||
$titleEmail = 'Framadate | Mes sondages';
|
||||
|
||||
$templateVars = [
|
||||
|
Loading…
Reference in New Issue
Block a user