From c92c577b5e05ea1d932c6739b87fea8beea21e1b Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 2 May 2014 17:37:16 +0200 Subject: - Introduce isShared() and isMounted() on FileInfo class - Reuse these methods on determineIcon() - Generate permission string for the desktop client - expose {http://owncloud.org/ns}permissions as additional WebDAV property containing the permission string --- apps/files/lib/helper.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'apps/files') diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 0ae87d12fbf..3d395081411 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -27,20 +27,11 @@ class Helper */ public static function determineIcon($file) { if($file['type'] === 'dir') { - $dir = $file['directory']; $icon = \OC_Helper::mimetypeIcon('dir'); - $absPath = $file->getPath(); - $mount = \OC\Files\Filesystem::getMountManager()->find($absPath); - if (!is_null($mount)) { - $sid = $mount->getStorageId(); - if (!is_null($sid)) { - $sid = explode(':', $sid); - if ($sid[0] === 'shared') { - $icon = \OC_Helper::mimetypeIcon('dir-shared'); - } elseif ($sid[0] !== 'local' and $sid[0] !== 'home') { - $icon = \OC_Helper::mimetypeIcon('dir-external'); - } - } + if ($file->isShared()) { + $icon = \OC_Helper::mimetypeIcon('dir-shared'); + } elseif ($file->isMounted()) { + $icon = \OC_Helper::mimetypeIcon('dir-external'); } }else{ $icon = \OC_Helper::mimetypeIcon($file->getMimetype()); -- cgit v1.2.3 From 95fe55f9e7215e8de77e80ad418e4d199a13fdb5 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 2 May 2014 20:35:03 +0200 Subject: fix broken unit test --- apps/files/tests/ajax_rename.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apps/files') diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php index 74ca1e4495d..1b69e438061 100644 --- a/apps/files/tests/ajax_rename.php +++ b/apps/files/tests/ajax_rename.php @@ -24,6 +24,16 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { private static $user; + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + private $viewMock; + + /** + * @var \OCA\Files\App + */ + private $files; + function setUp() { // mock OC_L10n if (!self::$user) { @@ -72,7 +82,7 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { ->method('getFileInfo') ->will($this->returnValue(new \OC\Files\FileInfo( '/', - null, + new \OC\Files\Storage\Local(array('datadir' => '/')), '/', array( 'fileid' => 123, -- cgit v1.2.3