Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: broadcast S3DownloadFinished to correct user

Andras Bacsai8e273dd79956
diff --git a/app/Events/S3DownloadFinished.php b/app/Events/S3DownloadFinished.php
index f7ec1bf0e3..ddc2ead30c 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 9b502339ff..9cf11c26c5 100644
--- a/app/Livewire/Project/Database/Import.php
+++ b/app/Livewire/Project/Database/Import.php
@@ -401,6 +401,7 @@ EOD;
// 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,