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: registration fix: user deletion

Andras Bacsai9f2fbc661aa5
diff --git a/app/Http/Livewire/Team/Delete.php b/app/Http/Livewire/Team/Delete.php
index 32e386ebc2..b09395df4f 100644
--- a/app/Http/Livewire/Team/Delete.php
+++ b/app/Http/Livewire/Team/Delete.php
@@ -12,7 +12,6 @@ class Delete extends Component
$currentTeam = currentTeam();
$currentTeam->delete();
- $team = auth()->user()->teams()->first();
$currentTeam->members->each(function ($user) use ($currentTeam) {
if ($user->id === auth()->user()->id) {
return;
diff --git a/app/Models/User.php b/app/Models/User.php
index 1671db496d..7df1344086 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -78,7 +78,7 @@ class User extends Authenticatable implements SendsEmail
if ($is_part_of_root_team && $is_admin_of_root_team) {
return true;
}
- $role = $teams->where('id', auth()->user()->id)->first()->pivot->role;
+ $role = $teams->where('id', session('currentTeam')->id)->first()->pivot->role;
return $role === 'admin' || $role === 'owner';
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index f42ac83d7a..ad449e3c74 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -2,6 +2,7 @@
use App\Models\InstanceSettings;
use App\Models\Team;
+use App\Models\User;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\TelegramChannel;
@@ -60,7 +61,7 @@ function showBoarding(): bool
function refreshSession(?Team $team = null): void
{
if (!$team) {
- $team = Team::find(currentTeam()->id);
+ $team = User::find(auth()->user()->id)->teams->first();
}
Cache::forget('team:' . auth()->user()->id);
Cache::remember('team:' . auth()->user()->id, 3600, function() use ($team) {