From feefb8c7bce74005fd9189ac0cec1660a3e3961e Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Sat, 3 Jan 2026 13:42:41 +0100 Subject: [PATCH 1/4] CFP bloquer la modification du profil --- sources/AppBundle/Controller/Event/CFP/EditAction.php | 6 ++++-- .../AppBundle/Controller/Event/CFP/ProposeAction.php | 9 ++------- .../Controller/Event/CFP/SidebarRenderer.php | 8 ++------ .../AppBundle/Controller/Event/CFP/SpeakerAction.php | 5 ++--- .../Controller/Event/Speaker/SuggestionAction.php | 11 ++++------- templates/event/cfp/closed.html.twig | 2 ++ templates/event/cfp/home.html.twig | 2 ++ templates/event/speaker-suggestion/closed.html.twig | 10 ---------- 8 files changed, 18 insertions(+), 35 deletions(-) delete mode 100644 templates/event/speaker-suggestion/closed.html.twig diff --git a/sources/AppBundle/Controller/Event/CFP/EditAction.php b/sources/AppBundle/Controller/Event/CFP/EditAction.php index e25d6e7fa..c7cd5df2c 100644 --- a/sources/AppBundle/Controller/Event/CFP/EditAction.php +++ b/sources/AppBundle/Controller/Event/CFP/EditAction.php @@ -22,7 +22,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Contracts\Translation\TranslatorInterface; @@ -44,11 +46,11 @@ public function __construct( private readonly Authentication $authentication, ) {} - public function __invoke(Request $request) + public function __invoke(Request $request): RedirectResponse|Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); $githubUser = $this->authentication->getGithubUser(); - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', ['event' => $event]); } $speaker = $this->speakerFactory->getSpeaker($event); diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index 6411d376f..fd8cba5e3 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -9,7 +9,6 @@ use AppBundle\Event\Form\TalkType; use AppBundle\Event\Model\Talk; use AppBundle\Event\Talk\TalkFormHandler; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -29,7 +28,7 @@ public function __construct( public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); @@ -48,11 +47,7 @@ public function __invoke(Request $request): Response $form = $this->createForm(TalkType::class, $talk, [ TalkType::IS_AFUP_DAY => $event->isAfupDay(), ]); - if ($event->isCfpOpen()) { - $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); - } else { - $form->add('save', SubmitType::class, ['label' => 'CFP fermé', 'attr' => ['disabled' => 'disabled']]); - } + $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); if ($this->talkFormHandler->handle($request, $event, $form, $speaker)) { $this->addFlash('success', $this->translator->trans('Proposition enregistrée !')); diff --git a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php index 4916c6753..89fbb1478 100644 --- a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php +++ b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php @@ -7,7 +7,6 @@ use AppBundle\CFP\SpeakerFactory; use AppBundle\Event\Model\Event; use AppBundle\Event\Model\Repository\TalkRepository; -use DateTime; use Twig\Environment; class SidebarRenderer @@ -18,12 +17,9 @@ public function __construct( private readonly Environment $twig, ) {} - /** - * @return string - */ - public function render(Event $event) + public function render(Event $event): string { - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return ''; } diff --git a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php index 2c7216aa6..f49d2398a 100644 --- a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php +++ b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php @@ -9,7 +9,6 @@ use AppBundle\Controller\Event\EventActionHelper; use AppBundle\Event\Form\SpeakerType; use AppBundle\Event\Model\Repository\SpeakerRepository; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; @@ -32,13 +31,13 @@ public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - $speaker = $this->speakerFactory->getSpeaker($event); - if ($event->getDateEndCallForPapers() < new DateTime() && $speaker->getId() === null) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); } + $speaker = $this->speakerFactory->getSpeaker($event); $form = $this->createForm(SpeakerType::class, $speaker, [ SpeakerType::OPT_PHOTO_REQUIRED => null === $speaker->getPhoto(), ]); diff --git a/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php b/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php index 79dc764d4..c8b3cf78d 100644 --- a/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php +++ b/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php @@ -28,13 +28,10 @@ public function __invoke(Request $request, string $eventSlug): Response { $event = $this->eventActionHelper->getEvent($eventSlug); - if ($event->getDateEndCallForPapers() < new \DateTime()) { - return $this->render( - 'event/speaker-suggestion/closed.html.twig', - [ - 'event' => $event, - ], - ); + if (!$event->isCfpOpen()) { + return $this->render('event/cfp/closed.html.twig', [ + 'event' => $event, + ]); } $form = $this->createForm(SpeakerSuggestionType::class); diff --git a/templates/event/cfp/closed.html.twig b/templates/event/cfp/closed.html.twig index 684e5113c..89506e7dc 100644 --- a/templates/event/cfp/closed.html.twig +++ b/templates/event/cfp/closed.html.twig @@ -1,6 +1,7 @@ {% extends 'event/cfp/base.html.twig' %} {% block content %} +

CFP: {{ event.title }}

{{ 'Désolé ! Le CFP est terminé pour cet évènement !' }}

{{ 'L\'accès est réservés à celles et ceux ayant déjà proposé des conférences.' }}

@@ -8,4 +9,5 @@ {{ 'Accès à mes conférences'|trans }} +
{% endblock %} diff --git a/templates/event/cfp/home.html.twig b/templates/event/cfp/home.html.twig index 8b497ddee..2c2ad8fb6 100644 --- a/templates/event/cfp/home.html.twig +++ b/templates/event/cfp/home.html.twig @@ -5,7 +5,9 @@

CFP: {{ event.title }}

{{ 'Mon espace conférencier'|trans }}

+ {% if event.cfpOpen %}

Modifier

+ {% endif %} {% if speaker.id == 0 %}

{{ 'Vous n\'avez pas encore rempli votre profil conférencier.'|trans }}

{% else %} diff --git a/templates/event/speaker-suggestion/closed.html.twig b/templates/event/speaker-suggestion/closed.html.twig deleted file mode 100644 index 321591f21..000000000 --- a/templates/event/speaker-suggestion/closed.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'event/base.html.twig' %} - -{% block content %} -
-

Suggérer un·e conférencier·e

- - Les suggestions pour le {{ event.title }} sont fermées. -
- -{% endblock %} From cae57069cc4380ae6a25e1065a2b886cb09a3fdc Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Sat, 3 Jan 2026 13:54:54 +0100 Subject: [PATCH 2/4] CFP bloquer la modification du profil, test fonctionnel --- .../Controller/Event/CFP/ProposeAction.php | 3 ++- .../Controller/Event/CFP/SidebarRenderer.php | 3 ++- .../Controller/Event/CFP/SpeakerAction.php | 3 ++- tests/behat/features/EventPages/Cfp.feature | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index fd8cba5e3..6da7d3bb7 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -9,6 +9,7 @@ use AppBundle\Event\Form\TalkType; use AppBundle\Event\Model\Talk; use AppBundle\Event\Talk\TalkFormHandler; +use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -28,7 +29,7 @@ public function __construct( public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if (!$event->isCfpOpen()) { + if (new DateTime() > $event->getDateEndCallForPapers()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); diff --git a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php index 89fbb1478..55043c0db 100644 --- a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php +++ b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php @@ -7,6 +7,7 @@ use AppBundle\CFP\SpeakerFactory; use AppBundle\Event\Model\Event; use AppBundle\Event\Model\Repository\TalkRepository; +use DateTime; use Twig\Environment; class SidebarRenderer @@ -19,7 +20,7 @@ public function __construct( public function render(Event $event): string { - if (!$event->isCfpOpen()) { + if ($event->getDateEndCallForPapers() < new DateTime()) { return ''; } diff --git a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php index f49d2398a..931f15948 100644 --- a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php +++ b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php @@ -9,6 +9,7 @@ use AppBundle\Controller\Event\EventActionHelper; use AppBundle\Event\Form\SpeakerType; use AppBundle\Event\Model\Repository\SpeakerRepository; +use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; @@ -31,7 +32,7 @@ public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if (!$event->isCfpOpen()) { + if (new DateTime() > $event->getDateEndCallForPapers()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); diff --git a/tests/behat/features/EventPages/Cfp.feature b/tests/behat/features/EventPages/Cfp.feature index 335c8eb8d..c1d57b7e8 100644 --- a/tests/behat/features/EventPages/Cfp.feature +++ b/tests/behat/features/EventPages/Cfp.feature @@ -93,6 +93,21 @@ Feature: Event pages - CFP When I follow "Nouvelle proposition" Then I should see "Le CFP n'est pas encore ouvert." + Scenario: Le CFP est terminé + Given I am on "/event/passed/cfp" + Then I should see "Oauth login test" + When I follow "Connect as userGithub1" + Then I should see "Mon espace conférencier" + Then I should see "Mes propositions" + When I should not see "Nouvelle proposition" + Then I should not see "Proposer une conférence" + When I should not see "Mon profil conférencier" + Then I should not see "Modifier" + When I am on "/event/passed/cfp/speaker" + Then I should see "Le CFP est terminé" + When I am on "/event/passed/cfp/propose" + Then I should see "Le CFP est terminé" + Scenario: On vote pour une conférence Given I am on "/event/afup-day-lyon/vote" Then I should see "Oauth login test" From e612e1b5b89f974bace5d68936216779b9e4a2c2 Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Sat, 3 Jan 2026 14:08:32 +0100 Subject: [PATCH 3/4] CFP bloquer la modification du profil, test fonctionnel --- sources/AppBundle/Controller/Event/CFP/ProposeAction.php | 8 ++++++-- tests/behat/features/EventPages/Cfp.feature | 9 ++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index 6da7d3bb7..6411d376f 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -29,7 +29,7 @@ public function __construct( public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if (new DateTime() > $event->getDateEndCallForPapers()) { + if ($event->getDateEndCallForPapers() < new DateTime()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); @@ -48,7 +48,11 @@ public function __invoke(Request $request): Response $form = $this->createForm(TalkType::class, $talk, [ TalkType::IS_AFUP_DAY => $event->isAfupDay(), ]); - $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); + if ($event->isCfpOpen()) { + $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); + } else { + $form->add('save', SubmitType::class, ['label' => 'CFP fermé', 'attr' => ['disabled' => 'disabled']]); + } if ($this->talkFormHandler->handle($request, $event, $form, $speaker)) { $this->addFlash('success', $this->translator->trans('Proposition enregistrée !')); diff --git a/tests/behat/features/EventPages/Cfp.feature b/tests/behat/features/EventPages/Cfp.feature index c1d57b7e8..9ed7cdc31 100644 --- a/tests/behat/features/EventPages/Cfp.feature +++ b/tests/behat/features/EventPages/Cfp.feature @@ -99,13 +99,12 @@ Feature: Event pages - CFP When I follow "Connect as userGithub1" Then I should see "Mon espace conférencier" Then I should see "Mes propositions" - When I should not see "Nouvelle proposition" - Then I should not see "Proposer une conférence" - When I should not see "Mon profil conférencier" + Then I should not see "Nouvelle proposition" + Then I should not see "Mon profil conférencier" Then I should not see "Modifier" - When I am on "/event/passed/cfp/speaker" + Given I am on "/event/passed/cfp/speaker" Then I should see "Le CFP est terminé" - When I am on "/event/passed/cfp/propose" + Given I am on "/event/passed/cfp/propose" Then I should see "Le CFP est terminé" Scenario: On vote pour une conférence From 447a87e914fd23053f78a41ede80098a49777e2c Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Sun, 4 Jan 2026 13:09:36 +0100 Subject: [PATCH 4/4] better lock --- .../Controller/Event/CFP/ProposeAction.php | 9 ++----- .../Controller/Event/CFP/SidebarRenderer.php | 3 +-- .../Controller/Event/CFP/SpeakerAction.php | 3 +-- templates/event/cfp/closed.html.twig | 13 +++++----- tests/behat/features/EventPages/Cfp.feature | 24 ++++++++----------- 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index 6411d376f..fd8cba5e3 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -9,7 +9,6 @@ use AppBundle\Event\Form\TalkType; use AppBundle\Event\Model\Talk; use AppBundle\Event\Talk\TalkFormHandler; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -29,7 +28,7 @@ public function __construct( public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); @@ -48,11 +47,7 @@ public function __invoke(Request $request): Response $form = $this->createForm(TalkType::class, $talk, [ TalkType::IS_AFUP_DAY => $event->isAfupDay(), ]); - if ($event->isCfpOpen()) { - $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); - } else { - $form->add('save', SubmitType::class, ['label' => 'CFP fermé', 'attr' => ['disabled' => 'disabled']]); - } + $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); if ($this->talkFormHandler->handle($request, $event, $form, $speaker)) { $this->addFlash('success', $this->translator->trans('Proposition enregistrée !')); diff --git a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php index 55043c0db..89fbb1478 100644 --- a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php +++ b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php @@ -7,7 +7,6 @@ use AppBundle\CFP\SpeakerFactory; use AppBundle\Event\Model\Event; use AppBundle\Event\Model\Repository\TalkRepository; -use DateTime; use Twig\Environment; class SidebarRenderer @@ -20,7 +19,7 @@ public function __construct( public function render(Event $event): string { - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return ''; } diff --git a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php index 931f15948..f49d2398a 100644 --- a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php +++ b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php @@ -9,7 +9,6 @@ use AppBundle\Controller\Event\EventActionHelper; use AppBundle\Event\Form\SpeakerType; use AppBundle\Event\Model\Repository\SpeakerRepository; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; @@ -32,7 +31,7 @@ public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if (new DateTime() > $event->getDateEndCallForPapers()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); diff --git a/templates/event/cfp/closed.html.twig b/templates/event/cfp/closed.html.twig index 89506e7dc..8f0e78c43 100644 --- a/templates/event/cfp/closed.html.twig +++ b/templates/event/cfp/closed.html.twig @@ -2,12 +2,11 @@ {% block content %}
-

CFP: {{ event.title }}

-

{{ 'Désolé ! Le CFP est terminé pour cet évènement !' }}

-

{{ 'L\'accès est réservés à celles et ceux ayant déjà proposé des conférences.' }}

- - {{ 'Accès à mes conférences'|trans }} - - +

CFP: {{ event.title }}

+

Désolé ... le CFP est fermé pour cet évènement !

+ + Accès à mes conférences + +
{% endblock %} diff --git a/tests/behat/features/EventPages/Cfp.feature b/tests/behat/features/EventPages/Cfp.feature index 9ed7cdc31..5d2412c4e 100644 --- a/tests/behat/features/EventPages/Cfp.feature +++ b/tests/behat/features/EventPages/Cfp.feature @@ -80,18 +80,14 @@ Feature: Event pages - CFP Then I should see "Oauth login test" When I follow "Connect as userGithub1" Then I should see "Mon espace conférencier" - When I follow "Mon profil conférencier" - # Création du profile - Then The "speaker[civility]" field should only contain the follow values '["M", "Mme"]' - When I fill in "speaker[firstname]" with "Mon prénom" - And I fill in "speaker[lastname]" with "Mon prénom" - And I fill in "speaker[email]" with "monemail@provider.fr" - And I fill in "speaker[biography]" with "Ma biographie" - And I attach the file "avatar1.png" to "speaker[photoFile]" - And I press "Sauvegarder" - # Nouvelle proposition - When I follow "Nouvelle proposition" - Then I should see "Le CFP n'est pas encore ouvert." + Then I should see "Mes propositions" + Then I should not see "Nouvelle proposition" + Then I should not see "Mon profil conférencier" + Then I should not see "Modifier" + Given I am on "/event/passed/cfp/speaker" + Then I should see "Le CFP est fermé" + Given I am on "/event/passed/cfp/propose" + Then I should see "Le CFP est fermé" Scenario: Le CFP est terminé Given I am on "/event/passed/cfp" @@ -103,9 +99,9 @@ Feature: Event pages - CFP Then I should not see "Mon profil conférencier" Then I should not see "Modifier" Given I am on "/event/passed/cfp/speaker" - Then I should see "Le CFP est terminé" + Then I should see "Le CFP est fermé" Given I am on "/event/passed/cfp/propose" - Then I should see "Le CFP est terminé" + Then I should see "Le CFP est fermé" Scenario: On vote pour une conférence Given I am on "/event/afup-day-lyon/vote"