Include the share in the Files_Sharing::loadAdditionalScripts event
This provides a better context for apps using the event, for example to load one script or another depending on whether the share is a file or a folder. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
6c0e6b531d
commit
c765dc46e7
2 changed files with 14 additions and 3 deletions
|
@ -445,7 +445,8 @@ class ShareController extends AuthPublicShareController {
|
||||||
\OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]);
|
\OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]);
|
||||||
\OCP\Util::addHeader('meta', ['property' => "og:image", 'content' => $ogPreview]);
|
\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 = new \OCP\AppFramework\Http\ContentSecurityPolicy();
|
||||||
$csp->addAllowedFrameDomain('\'self\'');
|
$csp->addAllowedFrameDomain('\'self\'');
|
||||||
|
|
|
@ -254,7 +254,12 @@ class ShareControllerTest extends \Test\TestCase {
|
||||||
|
|
||||||
$this->eventDispatcher->expects($this->once())
|
$this->eventDispatcher->expects($this->once())
|
||||||
->method('dispatch')
|
->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())
|
$this->l10n->expects($this->any())
|
||||||
->method('t')
|
->method('t')
|
||||||
|
@ -374,7 +379,12 @@ class ShareControllerTest extends \Test\TestCase {
|
||||||
|
|
||||||
$this->eventDispatcher->expects($this->once())
|
$this->eventDispatcher->expects($this->once())
|
||||||
->method('dispatch')
|
->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())
|
$this->l10n->expects($this->any())
|
||||||
->method('t')
|
->method('t')
|
||||||
|
|
Loading…
Reference in a new issue