From f4fb9935158709d37a7ccba946fe209cf33f3c30 Mon Sep 17 00:00:00 2001 From: Paul Andrieux Date: Tue, 18 Feb 2020 11:14:40 +0100 Subject: [PATCH 1/3] Inject alert only on requests that has a session --- EventListener/AlertifyListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EventListener/AlertifyListener.php b/EventListener/AlertifyListener.php index b24ecdd..a9f25f6 100644 --- a/EventListener/AlertifyListener.php +++ b/EventListener/AlertifyListener.php @@ -71,8 +71,9 @@ protected function injectAlertify(Response $response, Request $request) $hasMetaRefresh = false !== strripos($content, 'http-equiv="refresh"'); $forceInject = $response->headers->get('X-Inject-Alertify', false); $isRedirectResponse = $response instanceof RedirectResponse; + $hasPreviousSession = $request->hasPreviousSession(); - if ($hasBody && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) { + if ($hasBody && $hasPreviousSession && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) { if ($response->getStatusCode() === 204) { throw new IncompatibleStatusCodeException(); } From fc0089ca5207f4ba1727f378b48930b118d41d5e Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 18 Feb 2020 12:08:04 +0100 Subject: [PATCH 2/3] unlimit composer memory --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fa286e4..e0453f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ cache: php: - 7.0 -install: composer update +install: COMPOSER_MEMORY_LIMIT=-1 composer update script: vendor/bin/phpunit -v From 7207a9694ea2e8618426daad92d191eb5714b9c3 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 18 Feb 2020 12:09:10 +0100 Subject: [PATCH 3/3] CS fix --- .../AlertifyExtensionTest.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Tests/DependencyInjection/AlertifyExtensionTest.php b/Tests/DependencyInjection/AlertifyExtensionTest.php index 9704547..a23d66e 100644 --- a/Tests/DependencyInjection/AlertifyExtensionTest.php +++ b/Tests/DependencyInjection/AlertifyExtensionTest.php @@ -38,21 +38,21 @@ public function testContexts() $container = new ContainerBuilder(); $loader = new TroopersAlertifyExtension(); $loader->load([[ - 'contexts' => [ - 'front' => [ - 'engine' => 'notie', - 'options' => [ - 'animationDelay' => 300, - ], - ], - 'back' => [ - 'engine' => 'pushjs', - 'translationDomain' => 'admin', + 'contexts' => [ + 'front' => [ + 'engine' => 'notie', + 'options' => [ + 'animationDelay' => 300, ], ], - 'default' => [ - 'engine' => 'notie', - ], ]], $container); + 'back' => [ + 'engine' => 'pushjs', + 'translationDomain' => 'admin', + ], + ], + 'default' => [ + 'engine' => 'notie', + ], ]], $container); $this->assertSame([ 'contexts' => [ 'front' => [