Skip to content

Commit f4fb993

Browse files
authored
Inject alert only on requests that has a session
1 parent eded39a commit f4fb993

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

EventListener/AlertifyListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ protected function injectAlertify(Response $response, Request $request)
7171
$hasMetaRefresh = false !== strripos($content, 'http-equiv="refresh"');
7272
$forceInject = $response->headers->get('X-Inject-Alertify', false);
7373
$isRedirectResponse = $response instanceof RedirectResponse;
74+
$hasPreviousSession = $request->hasPreviousSession();
7475

75-
if ($hasBody && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) {
76+
if ($hasBody && $hasPreviousSession && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) {
7677
if ($response->getStatusCode() === 204) {
7778
throw new IncompatibleStatusCodeException();
7879
}

0 commit comments

Comments
 (0)