diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-13 14:26:14 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-13 14:56:55 +0200 |
commit | 5e9ca79788fba962418865c0431d25a0a2dc89f7 (patch) | |
tree | 1f923ece8661459d18398b3d0b87c5973bff361d /apps/files | |
parent | 3891cd9068596481cf1717e9b1a5bcae1cc0ce09 (diff) | |
download | nextcloud-server-5e9ca79788fba962418865c0431d25a0a2dc89f7.tar.gz nextcloud-server-5e9ca79788fba962418865c0431d25a0a2dc89f7.zip |
Do not calculate non essential info
There is no need to calculate a human readable date on the server side.
We supply the mtime and a client can easily convert that himself if
needed. This is already done most of the time since the date is often
not in the exact right format.
There is also no need to attach icon info. We have that available in
javascript. And else the client should get the right icon based on the
mimetype for its platform.
* Updated tests
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/helper.php | 2 | ||||
-rw-r--r-- | apps/files/tests/ajax_rename.php | 6 | ||||
-rw-r--r-- | apps/files/tests/controller/apicontrollertest.php | 6 |
3 files changed, 0 insertions, 14 deletions
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 6bfdc0a095c..fb14cea731f 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -137,10 +137,8 @@ class Helper { $entry['id'] = $i['fileid']; $entry['parentId'] = $i['parent']; - $entry['date'] = \OCP\Util::formatDate($i['mtime']); $entry['mtime'] = $i['mtime'] * 1000; // only pick out the needed attributes - $entry['icon'] = \OCA\Files\Helper::determineIcon($i); if (\OC::$server->getPreviewManager()->isAvailable($i)) { $entry['isPreviewAvailable'] = true; } diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php index 45d49c9549d..00a62fa002d 100644 --- a/apps/files/tests/ajax_rename.php +++ b/apps/files/tests/ajax_rename.php @@ -117,9 +117,6 @@ class Test_OC_Files_App_Rename extends \Test\TestCase { $this->assertEquals('abcdef', $result['data']['etag']); $this->assertFalse(isset($result['data']['tags'])); $this->assertEquals('/', $result['data']['path']); - $icon = \OC_Helper::mimetypeIcon('dir-external'); - $icon = substr($icon, 0, -3) . 'svg'; - $this->assertEquals($icon, $result['data']['icon']); } /** @@ -182,9 +179,6 @@ class Test_OC_Files_App_Rename extends \Test\TestCase { $this->assertEquals('abcdef', $result['data']['etag']); $this->assertEquals(array('tag1', 'tag2'), $result['data']['tags']); $this->assertEquals('/', $result['data']['path']); - $icon = \OC_Helper::mimetypeIcon('text'); - $icon = substr($icon, 0, -3) . 'svg'; - $this->assertEquals($icon, $result['data']['icon']); \OC::$server->registerService('TagManager', function ($c) use ($oldTagManager) { return $oldTagManager; diff --git a/apps/files/tests/controller/apicontrollertest.php b/apps/files/tests/controller/apicontrollertest.php index 35d00af75ba..7f34c0a5642 100644 --- a/apps/files/tests/controller/apicontrollertest.php +++ b/apps/files/tests/controller/apicontrollertest.php @@ -110,9 +110,7 @@ class ApiControllerTest extends TestCase { [ 'id' => null, 'parentId' => null, - 'date' => \OCP\Util::formatDate(55), 'mtime' => 55000, - 'icon' => \OCA\Files\Helper::determineIcon($fileInfo), 'name' => 'root.txt', 'permissions' => null, 'mimetype' => 'application/pdf', @@ -175,9 +173,7 @@ class ApiControllerTest extends TestCase { [ 'id' => null, 'parentId' => null, - 'date' => \OCP\Util::formatDate(55), 'mtime' => 55000, - 'icon' => \OCA\Files\Helper::determineIcon($fileInfo1), 'name' => 'root.txt', 'permissions' => null, 'mimetype' => 'application/pdf', @@ -194,9 +190,7 @@ class ApiControllerTest extends TestCase { [ 'id' => null, 'parentId' => null, - 'date' => \OCP\Util::formatDate(999), 'mtime' => 999000, - 'icon' => \OCA\Files\Helper::determineIcon($fileInfo2), 'name' => 'root.txt', 'permissions' => null, 'mimetype' => 'application/binary', |