summaryrefslogtreecommitdiffstats
path: root/apps/files/controller
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2016-04-12 11:51:50 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2016-04-13 14:25:23 +0200
commit576f7244e6b3b4d5568bebbe17966eb6490210f2 (patch)
tree585ebe3d58ef3beb5221e2167092a56b03f89b5e /apps/files/controller
parenta4683bcfa9d2670a5284b7b27f0a475de8be44b7 (diff)
downloadnextcloud-server-576f7244e6b3b4d5568bebbe17966eb6490210f2.tar.gz
nextcloud-server-576f7244e6b3b4d5568bebbe17966eb6490210f2.zip
fix default value, update js/php tests
Diffstat (limited to 'apps/files/controller')
-rw-r--r--apps/files/controller/apicontroller.php15
-rw-r--r--apps/files/controller/viewcontroller.php2
2 files changed, 15 insertions, 2 deletions
diff --git a/apps/files/controller/apicontroller.php b/apps/files/controller/apicontroller.php
index 82d3ebb58b7..43d426476fe 100644
--- a/apps/files/controller/apicontroller.php
+++ b/apps/files/controller/apicontroller.php
@@ -34,6 +34,7 @@ use OCP\IConfig;
use OCP\IRequest;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\DataDisplayResponse;
+use OCP\AppFramework\Http\Response;
use OCA\Files\Service\TagService;
use OCP\IPreview;
use OCP\Share\IManager;
@@ -201,14 +202,26 @@ class ApiController extends Controller {
return $shareTypes;
}
+ /**
+ * Change the default sort mode
+ *
+ * @NoAdminRequired
+ *
+ * @param string $mode
+ * @param string $direction
+ * @return Response
+ */
public function updateFileSorting($mode, $direction) {
$allowedMode = ['name', 'size', 'mtime'];
$allowedDirection = ['asc', 'desc'];
if (!in_array($mode, $allowedMode) || !in_array($direction, $allowedDirection)) {
- return $this->buildResponse(null)->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
+ $response = new Response();
+ $response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
+ return $response;
}
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting', $mode);
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting_direction', $direction);
+ return new Response();
}
}
diff --git a/apps/files/controller/viewcontroller.php b/apps/files/controller/viewcontroller.php
index a3718729339..6c5f4c6d2a0 100644
--- a/apps/files/controller/viewcontroller.php
+++ b/apps/files/controller/viewcontroller.php
@@ -221,7 +221,7 @@ class ViewController extends Controller {
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
$user = $this->userSession->getUser()->getUID();
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
- $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'name');
+ $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
$params['appNavigation'] = $nav;
$params['appContents'] = $contentItems;
$this->navigationManager->setActiveEntry('files_index');