mirror of
https://github.com/brufdev/many-notes.git
synced 2026-04-24 18:58:37 -05:00
Fix coding style
This commit is contained in:
@@ -61,6 +61,7 @@ final readonly class CreateVaultNode
|
||||
|
||||
// Save node to disk
|
||||
$nodePath = new GetPathFromVaultNode()->handle($node);
|
||||
|
||||
if ($node->is_file) {
|
||||
Storage::disk('local')->put($nodePath, $attributes['content'] ?? '');
|
||||
} else {
|
||||
|
||||
@@ -14,6 +14,7 @@ final readonly class DeleteCollaborationInvite
|
||||
{
|
||||
$vault->collaborators()->detach($user);
|
||||
$notifications = $user->notifications()->where('type', CollaborationInvited::class)->get();
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
if ($notification->data['vault_id'] === $vault->id) {
|
||||
$notification->delete();
|
||||
|
||||
@@ -44,6 +44,7 @@ final readonly class DeleteVault
|
||||
DB::commit();
|
||||
} catch (Throwable) {
|
||||
DB::rollBack();
|
||||
|
||||
throw new Exception(__('Something went wrong'));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,13 @@ final readonly class DeleteVaultNode
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$deletedNodes = $this->deleteFromDatabase($node);
|
||||
|
||||
DB::commit();
|
||||
} catch (Throwable) {
|
||||
DB::rollBack();
|
||||
|
||||
throw new Exception(__('Something went wrong'));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ final readonly class ExportVault
|
||||
}
|
||||
|
||||
Storage::disk('local')->put($relativePath, '');
|
||||
|
||||
if ($zip->open($path, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
|
||||
throw new Exception(__('Something went wrong'));
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ final readonly class ProcessImportedVault
|
||||
{
|
||||
public function handle(string $fileName, string $filePath): void
|
||||
{
|
||||
$nodeIds = ['.' => null];
|
||||
$vaultName = pathinfo($fileName, PATHINFO_FILENAME);
|
||||
/** @var User $currentUser */
|
||||
$currentUser = auth()->user();
|
||||
$nodeIds = ['.' => null];
|
||||
$vaultName = pathinfo($fileName, PATHINFO_FILENAME);
|
||||
$vault = new CreateVault()->handle($currentUser, [
|
||||
'name' => $vaultName,
|
||||
]);
|
||||
@@ -24,6 +24,7 @@ final readonly class ProcessImportedVault
|
||||
// Create vault nodes with valid zip files and folders
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($filePath);
|
||||
|
||||
for ($i = 0, $zipCount = $zip->count(); $i < $zipCount; $i++) {
|
||||
$entryName = $zip->getNameIndex($i);
|
||||
|
||||
@@ -62,6 +63,7 @@ final readonly class ProcessImportedVault
|
||||
|
||||
$attributes['content'] = (string) $zip->getFromIndex($i);
|
||||
}
|
||||
|
||||
$node = new CreateVaultNode()->handle($vault, $attributes);
|
||||
|
||||
if (!array_key_exists($entryDirName, $nodeIds)) {
|
||||
|
||||
@@ -50,7 +50,6 @@ final readonly class ProcessVaultNodeLinks
|
||||
*/
|
||||
$fullPath = $node->ancestorsAndSelf()->get()->last()->full_path;
|
||||
$path = new ResolveTwoPaths()->handle($fullPath, $link['path']);
|
||||
|
||||
$destinationNode = new GetVaultNodeFromPath()->handle($node->vault_id, $path);
|
||||
|
||||
if (is_null($destinationNode)) {
|
||||
|
||||
@@ -34,6 +34,7 @@ final class UserMenu extends Component
|
||||
public function editProfile(): void
|
||||
{
|
||||
$this->profileForm->update();
|
||||
|
||||
$this->dispatch('close-modal');
|
||||
$this->dispatch('toast', message: __('Profile updated'), type: 'success');
|
||||
}
|
||||
@@ -41,6 +42,7 @@ final class UserMenu extends Component
|
||||
public function editPassword(): void
|
||||
{
|
||||
$this->passwordForm->update();
|
||||
|
||||
$this->dispatch('close-modal');
|
||||
$this->dispatch('toast', message: __('Password updated'), type: 'success');
|
||||
}
|
||||
|
||||
@@ -30,13 +30,16 @@ final class ImportVault extends Component
|
||||
public function updatedFile(): void
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
/** @var TemporaryUploadedFile $file */
|
||||
$file = $this->file;
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$filePath = $file->getRealPath();
|
||||
|
||||
new ProcessImportedVault()->handle($fileName, $filePath);
|
||||
$this->dispatch('vault-imported');
|
||||
$this->closeModal();
|
||||
|
||||
$this->dispatch('vault-imported');
|
||||
$this->dispatch('toast', message: __('Vault imported'), type: 'success');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user