From 7fec706f68c8494c601542e0867eccbe24f612c0 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 3 Aug 2024 14:04:25 +0200 Subject: 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 --- apps/files/lib/Controller/ViewController.php | 51 ---------------------------- 1 file changed, 51 deletions(-) (limited to 'apps/files/lib/Controller/ViewController.php') 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,60 +221,9 @@ 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 * -- cgit v1.2.3