diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-03 14:04:25 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-08-14 09:31:27 +0200 |
commit | 7fec706f68c8494c601542e0867eccbe24f612c0 (patch) | |
tree | 796a0d4c9e241395e62db137ecda8028b1627c86 /apps/files/lib/Controller | |
parent | 0c0ba5f552d76424a130414eb32fe1ecf48372ad (diff) | |
download | nextcloud-server-7fec706f68c8494c601542e0867eccbe24f612c0.tar.gz nextcloud-server-7fec706f68c8494c601542e0867eccbe24f612c0.zip |
refactor(files): Drop unneeded initial state
The initial state is no longer used, it was only used in legacy UI and in the f2v rewrite
it was only used for the `id` which can be loaded just from the URL.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/lib/Controller')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index cdad09d27a1..16d0c3ea1f0 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -221,61 +221,10 @@ class ViewController extends Controller { $policy->addAllowedWorkerSrcDomain('\'self\''); $response->setContentSecurityPolicy($policy); - $this->provideInitialState($dir, $fileid); - return $response; } /** - * Add openFileInfo in initialState. - * @param string $dir - the ?dir= URL param - * @param string $fileid - the fileid URL param - * @return void - */ - private function provideInitialState(string $dir, ?string $fileid): void { - if ($fileid === null) { - return; - } - - $user = $this->userSession->getUser(); - - if ($user === null) { - return; - } - - $uid = $user->getUID(); - $userFolder = $this->rootFolder->getUserFolder($uid); - $node = $userFolder->getFirstNodeById((int) $fileid); - - if ($node === null) { - return; - } - - // properly format full path and make sure - // we're relative to the user home folder - $isRoot = $node === $userFolder; - $path = $userFolder->getRelativePath($node->getPath()); - $directory = $userFolder->getRelativePath($node->getParent()->getPath()); - - // Prevent opening a file from another folder. - if ($dir !== $directory) { - return; - } - - $this->initialState->provideInitialState( - 'fileInfo', [ - 'id' => $node->getId(), - 'name' => $isRoot ? '' : $node->getName(), - 'path' => $path, - 'directory' => $directory, - 'mime' => $node->getMimetype(), - 'type' => $node->getType(), - 'permissions' => $node->getPermissions(), - ] - ); - } - - /** * Redirects to the trashbin file list and highlight the given file id * * @param int $fileId file id to show |