feat: limit calendar past events

This commit is contained in:
Maël Gangloff 2024-09-02 22:20:03 +02:00
parent e7165a1487
commit 7bdb289461
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class DomainRefreshController extends AbstractController
* @throws HttpExceptionInterface * @throws HttpExceptionInterface
* @throws \Throwable * @throws \Throwable
*/ */
public function __invoke(string $ldhName, KernelInterface $kernel): ?Domain public function __invoke(string $ldhName, KernelInterface $kernel): Domain
{ {
$idnDomain = strtolower(idn_to_ascii($ldhName)); $idnDomain = strtolower(idn_to_ascii($ldhName));
$userId = $this->getUser()->getUserIdentifier(); $userId = $this->getUser()->getUserIdentifier();

View File

@ -297,7 +297,7 @@ class WatchListController extends AbstractController
} }
/** @var DomainEvent $event */ /** @var DomainEvent $event */
foreach ($domain->getEvents()->toArray() as $event) { foreach ($domain->getEvents()->filter(fn (DomainEvent $e) => $e->getDate()->diff(new \DateTimeImmutable('now'))->y <= 10)->getIterator() as $event) {
$calendar->addEvent((new Event()) $calendar->addEvent((new Event())
->setLastModified(new Timestamp($domain->getUpdatedAt())) ->setLastModified(new Timestamp($domain->getUpdatedAt()))
->setStatus(EventStatus::CONFIRMED()) ->setStatus(EventStatus::CONFIRMED())