summaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Controller/ApiController.php
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-13 09:33:57 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-13 09:33:57 +0200
commit6f45607f57c55550808824ffdeebbf10353a2554 (patch)
tree632299fe9ad96d6ef54001121a9bfaa61de1bc20 /apps/files/lib/Controller/ApiController.php
parent1f9e50086cc404d6dd46c5ae664f951faaf74c98 (diff)
downloadnextcloud-server-6f45607f57c55550808824ffdeebbf10353a2554.tar.gz
nextcloud-server-6f45607f57c55550808824ffdeebbf10353a2554.zip
Upgraded navigation submenu management and api + created sharing submenu
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib/Controller/ApiController.php')
-rw-r--r--apps/files/lib/Controller/ApiController.php33
1 files changed, 16 insertions, 17 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index aae1bec2e78..fd63d545151 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -291,29 +291,28 @@ class ApiController extends Controller {
}
/**
- * Toggle default for showing/hiding QuickAccess folder
+ * Toggle default for showing/hiding xxx folder
*
* @NoAdminRequired
*
- * @param bool $show
+ * @param bool $show
+ * @param bool $key the key of the folder
*
* @return Response
*/
- public function showQuickAccess($show) {
- $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', (int)$show);
- return new Response();
- }
-
- /**
- * Toggle default for showing/hiding QuickAccess folder
- *
- * @NoAdminRequired
- *
- * @return String
- */
- public function getShowQuickAccess() {
-
- return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0);
+ public function toggleShowFolder(int $show, string $key) {
+ // ensure the edited key exists
+ $navItems = \OCA\Files\App::getNavigationManager()->getAll();
+ foreach ($navItems as $item) {
+ // check if data is valid
+ if (($show === 0 || $show === 1) && isset($item['expandedState']) && $key === $item['expandedState']) {
+ $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', $key, (int)$show);
+ return new Response();
+ }
+ }
+ $response = new Response();
+ $response->setStatus(Http::STATUS_FORBIDDEN);
+ return $response;
}
/**