summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-10-19 11:13:11 +0200
committerGitHub <noreply@github.com>2019-10-19 11:13:11 +0200
commitb425b3487820b8168e87d9007067862fb8caebaa (patch)
treef35fa0133f0b32fed5d7785e851f7bc918bac17b /apps
parentdd0e73829cc052f7ded4647d9bafa1f5d72b2a7b (diff)
parent5c7c30822067ce99ecfa7cff803b28a86b8554c1 (diff)
downloadnextcloud-server-b425b3487820b8168e87d9007067862fb8caebaa.tar.gz
nextcloud-server-b425b3487820b8168e87d9007067862fb8caebaa.zip
Merge pull request #17575 from nextcloud/include-the-share-in-the-files_sharing-loadadditionalscripts-event
Include the share in the Files_Sharing::loadAdditionalScripts event
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php3
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php14
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 0725e520b2d..f5cbb63e083 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -445,7 +445,8 @@ class ShareController extends AuthPublicShareController {
\OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]);
\OCP\Util::addHeader('meta', ['property' => "og:image", 'content' => $ogPreview]);
- $this->eventDispatcher->dispatch('OCA\Files_Sharing::loadAdditionalScripts');
+ $event = new GenericEvent(null, ['share' => $share]);
+ $this->eventDispatcher->dispatch('OCA\Files_Sharing::loadAdditionalScripts', $event);
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index ea9bd8316e2..97e234ca22c 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -254,7 +254,12 @@ class ShareControllerTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatch')
- ->with('OCA\Files_Sharing::loadAdditionalScripts');
+ ->with(
+ 'OCA\Files_Sharing::loadAdditionalScripts',
+ $this->callback(function($event) use ($share) {
+ return $event->getArgument('share') === $share;
+ })
+ );
$this->l10n->expects($this->any())
->method('t')
@@ -374,7 +379,12 @@ class ShareControllerTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatch')
- ->with('OCA\Files_Sharing::loadAdditionalScripts');
+ ->with(
+ 'OCA\Files_Sharing::loadAdditionalScripts',
+ $this->callback(function($event) use ($share) {
+ return $event->getArgument('share') === $share;
+ })
+ );
$this->l10n->expects($this->any())
->method('t')