]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add acutal response to BeforeTemplateRenderedEvent
authorJulius Härtl <jus@bitgrid.net>
Wed, 23 Sep 2020 06:43:36 +0000 (08:43 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 5 Oct 2020 19:53:05 +0000 (19:53 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php
lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php

index 6c65ee8b2c63329bc123464b16207331ba091e4b..28f322f42b7c6358ee0b6ce5ddb50f7f607998e7 100644 (file)
@@ -71,7 +71,7 @@ class AdditionalScriptsMiddleware extends Middleware {
                                $isLoggedIn = false;
                        }
 
-                       $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn));
+                       $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn, $response));
                }
 
                return $response;
index 3d48e9a269d1a356df17b3ba7d424fb0e72e7757..b96b86abd571431e407fd2a0b5c4bc97c6ee8da6 100644 (file)
@@ -27,6 +27,7 @@ declare(strict_types=1);
 
 namespace OCP\AppFramework\Http\Events;
 
+use OCP\AppFramework\Http\TemplateResponse;
 use OCP\EventDispatcher\Event;
 
 /**
@@ -38,14 +39,17 @@ use OCP\EventDispatcher\Event;
 class BeforeTemplateRenderedEvent extends Event {
        /** @var bool */
        private $loggedIn;
+       /** @var TemplateResponse */
+       private $response;
 
        /**
         * @since 20.0.0
         */
-       public function __construct(bool $loggedIn) {
+       public function __construct(bool $loggedIn, TemplateResponse $response) {
                parent::__construct();
 
                $this->loggedIn = $loggedIn;
+               $this->response = $response;
        }
 
        /**
@@ -54,4 +58,11 @@ class BeforeTemplateRenderedEvent extends Event {
        public function isLoggedIn(): bool {
                return $this->loggedIn;
        }
+
+       /**
+        * @since 20.0.0
+        */
+       public function getResponse(): TemplateResponse {
+               return $this->response;
+       }
 }