diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-02-07 15:57:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 15:57:14 +0100 |
commit | 0e9903c420aee76648e61c4c14b750ea01125bb1 (patch) | |
tree | 4869d5a2df8054b416103855fe951989aaf03afd /lib/private/AppFramework/Middleware | |
parent | 6dc21fff45abbb2bde2611a82c746f873389bfd7 (diff) | |
parent | b68567e9ba5b4b081378061bf938b5b505638fb3 (diff) | |
download | nextcloud-server-0e9903c420aee76648e61c4c14b750ea01125bb1.tar.gz nextcloud-server-0e9903c420aee76648e61c4c14b750ea01125bb1.zip |
Merge pull request #13969 from nextcloud/enh/additional_scripts_no_on_public_pages
No need to emit additonalscript event on public pages
Diffstat (limited to 'lib/private/AppFramework/Middleware')
-rw-r--r-- | lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php index de1a02026bf..3ab084cd894 100644 --- a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php +++ b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php @@ -25,8 +25,10 @@ declare(strict_types=1); namespace OC\AppFramework\Middleware; use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http\StandaloneTemplateResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Middleware; +use OCP\AppFramework\PublicShareController; use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -42,10 +44,18 @@ class AdditionalScriptsMiddleware extends Middleware { } public function afterController($controller, $methodName, Response $response): Response { + /* + * There is no need to emit these signals on a public share page + * There is a separate event for that already + */ + if ($controller instanceof PublicShareController) { + return $response; + } + if ($response instanceof TemplateResponse) { $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS); - if ($this->userSession->isLoggedIn()) { + if (!($response instanceof StandaloneTemplateResponse) && $this->userSession->isLoggedIn()) { $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN); } } |