Skip to content

Commit

Permalink
Merge pull request #3398 from MTES-MCT/feature/3397-remove-cookie-header
Browse files Browse the repository at this point in the history
[BO] Erreurs liste des signalements
  • Loading branch information
emilschn authored Dec 6, 2024
2 parents 89b5e7f + d393f4f commit 90be4b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/Controller/Back/ExportSignalementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ public function index(
): Response {
/** @var User $user */
$user = $this->getUser();

$filters = $options = json_decode($request->cookies->get('filters'), true)
?? $request->getSession()->get('filters', ['isImported' => '1']);

$filters = $options = $request->getSession()->get('filters', ['isImported' => '1']);
$count_signalements = $signalementManager->findSignalementAffectationList($user, $options, true);
$textFilters = $signalementExportFiltersDisplay->filtersToText($filters);

Expand Down
11 changes: 1 addition & 10 deletions src/Controller/Back/SignalementListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Manager\SignalementManager;
use App\Service\Signalement\SearchFilter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down Expand Up @@ -45,19 +44,11 @@ public function list(
$session->set('signalementSearchQuery', $signalementQuery);
$signalements = $signalementManager->findSignalementAffectationList($user, $filters);

$response = $this->json(
return $this->json(
$signalements,
Response::HTTP_OK,
['content-type' => 'application/json'],
['groups' => ['signalements:read']]
);

$cookie = Cookie::create('filters')
->withValue(json_encode($filters))
->withExpires(strtotime('+1 hour'));

$response->headers->setCookie($cookie);

return $response;
}
}

0 comments on commit 90be4b8

Please sign in to comment.