From 8e273dd79956aaafe9511b57dae8513b32bed59a Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sun, 2 Nov 2025 18:19:23 +0100 Subject: [PATCH] fix: broadcast S3DownloadFinished to correct user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The event was broadcasting to the first user in the team instead of the actual user who triggered the download. This caused the download message to never hide for other team members. - Pass userId in S3DownloadFinished event data - Use the specific userId from event data for broadcasting - Remove unused User model import - Ensures broadcast reaches the correct user's private channel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Events/S3DownloadFinished.php | 11 +++-------- app/Livewire/Project/Database/Import.php | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/Events/S3DownloadFinished.php b/app/Events/S3DownloadFinished.php index f7ec1bf0e..ddc2ead30 100644 --- a/app/Events/S3DownloadFinished.php +++ b/app/Events/S3DownloadFinished.php @@ -3,7 +3,6 @@ namespace App\Events; use App\Models\Server; -use App\Models\User; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; @@ -18,17 +17,13 @@ class S3DownloadFinished implements ShouldBroadcast public function __construct($teamId, $data = null) { - // Get the first user from the team to broadcast to - $user = User::whereHas('teams', function ($query) use ($teamId) { - $query->where('teams.id', $teamId); - })->first(); - - $this->userId = $user?->id; - if (is_null($data)) { return; } + // Get userId from event data (the user who triggered the download) + $this->userId = data_get($data, 'userId'); + $containerName = data_get($data, 'containerName'); $serverId = data_get($data, 'serverId'); diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.php index 9b502339f..9cf11c26c 100644 --- a/app/Livewire/Project/Database/Import.php +++ b/app/Livewire/Project/Database/Import.php @@ -401,6 +401,7 @@ public function downloadFromS3() // Execute download commands $activity = remote_process($commands, $this->server, ignore_errors: false, callEventOnFinish: 'S3DownloadFinished', callEventData: [ + 'userId' => Auth::id(), 'downloadPath' => $downloadPath, 'containerName' => $containerName, 'serverId' => $this->server->id,