[Pkg-owncloud-commits] [owncloud] 35/62: Disable video preview if previews are disabled

David Prévot taffit at moszumanska.debian.org
Tue Jun 23 23:39:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.

commit 083356fe9d81e1092106366b7ebcae47947f87b5
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Tue Jun 9 16:33:26 2015 +0200

    Disable video preview if previews are disabled
---
 apps/files_sharing/lib/controllers/sharecontroller.php  | 1 +
 apps/files_sharing/templates/public.php                 | 2 +-
 apps/files_sharing/tests/controller/sharecontroller.php | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index c89e005..71aef14 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -199,6 +199,7 @@ class ShareController extends Controller {
 
 		$shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token));
 		$shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10);
+		$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
 
 		return new TemplateResponse($this->appName, 'public', $shareTmpl, 'base');
 	}
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 4ec4d26..a1c901f 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -80,7 +80,7 @@ $previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'fals
 		<?php if (isset($_['folder'])): ?>
 			<?php print_unescaped($_['folder']); ?>
 		<?php else: ?>
-			<?php if (substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
+			<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
 				<div id="imgframe">
 					<video tabindex="0" controls="" preload="none">
 						<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index ed17dd8..6e61dbb 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -166,6 +166,7 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
 			'fileSize' => '33 B',
 			'nonHumanFileSize' => 33,
 			'maxSizeAnimateGif' => 10,
+			'previewEnabled' => true,
 		);
 		$expectedResponse = new TemplateResponse($this->container['AppName'], 'public', $sharedTmplParams, 'base');
 		$this->assertEquals($expectedResponse, $response);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list