From 6afd98e28206679d67d186d149704243571bb0c3 Mon Sep 17 00:00:00 2001 From: brufdev Date: Sun, 20 Apr 2025 16:29:10 +0100 Subject: [PATCH] Remove HTTP layer from action --- app/Actions/ProcessImportedVault.php | 6 ++---- app/Livewire/Modals/ImportVault.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Actions/ProcessImportedVault.php b/app/Actions/ProcessImportedVault.php index 23803a4..28f8f02 100644 --- a/app/Actions/ProcessImportedVault.php +++ b/app/Actions/ProcessImportedVault.php @@ -11,13 +11,11 @@ use ZipArchive; final readonly class ProcessImportedVault { - public function handle(string $fileName, string $filePath): void + public function handle(User $user, string $fileName, string $filePath): void { - /** @var User $currentUser */ - $currentUser = auth()->user(); $nodeIds = ['.' => null]; $vaultName = pathinfo($fileName, PATHINFO_FILENAME); - $vault = new CreateVault()->handle($currentUser, [ + $vault = new CreateVault()->handle($user, [ 'name' => $vaultName, ]); diff --git a/app/Livewire/Modals/ImportVault.php b/app/Livewire/Modals/ImportVault.php index ad0d636..e27eb5c 100644 --- a/app/Livewire/Modals/ImportVault.php +++ b/app/Livewire/Modals/ImportVault.php @@ -40,7 +40,7 @@ final class ImportVault extends Component $fileName = $file->getClientOriginalName(); $filePath = $file->getRealPath(); - new ProcessImportedVault()->handle($fileName, $filePath); + new ProcessImportedVault()->handle($user, $fileName, $filePath); $this->closeModal(); $this->dispatch('toast', message: __('Vault imported'), type: 'success');