mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
fix: broadcast S3DownloadFinished to correct user
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user