summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-07-04 14:04:28 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-07-04 14:04:28 +0200
commitb7b42cf1c8543c86d7296ada73644d0207643185 (patch)
treeb6448db70d5d2743fee01275a4269dc4305137c0
parente4a3f8d3c44f3238071d03f793cd2c5395062b5e (diff)
parent5e8959a5b36f8ff150497d818ba09a8828ba5a7b (diff)
downloadnextcloud-server-b7b42cf1c8543c86d7296ada73644d0207643185.tar.gz
nextcloud-server-b7b42cf1c8543c86d7296ada73644d0207643185.zip
Merge pull request #9432 from owncloud/share-preview
Return and use isPreviewAvailable for share previews
-rw-r--r--apps/files_sharing/js/sharedfilelist.js9
-rw-r--r--apps/files_sharing/lib/api.php6
2 files changed, 10 insertions, 5 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index 304f77a8d77..ea9071cfcb8 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -166,11 +166,10 @@
}
else {
file.type = 'file';
- // force preview retrieval as we don't have mime types,
- // the preview endpoint will fall back to the mime type
- // icon if no preview exists
- file.isPreviewAvailable = true;
- file.icon = true;
+ if (share.isPreviewAvailable) {
+ file.icon = true;
+ file.isPreviewAvailable = true;
+ }
}
file.share = {
id: share.id,
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 2e824a4a9df..50ba74f5beb 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -60,6 +60,9 @@ class Api {
foreach ($shares as &$share) {
if ($share['item_type'] === 'file' && isset($share['path'])) {
$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
+ if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
+ $share['isPreviewAvailable'] = true;
+ }
}
$newShares[] = $share;
}
@@ -214,6 +217,9 @@ class Api {
foreach ($shares as &$share) {
if ($share['item_type'] === 'file') {
$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']);
+ if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
+ $share['isPreviewAvailable'] = true;
+ }
}
}
$result = new \OC_OCS_Result($shares);