fix: registration

fix: user deletion
This commit is contained in:
Andras Bacsai 2023-09-14 18:22:08 +02:00
parent 949407368e
commit 9f2fbc661a
3 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,6 @@ public function delete()
$currentTeam = currentTeam();
$currentTeam->delete();
$team = auth()->user()->teams()->first();
$currentTeam->members->each(function ($user) use ($currentTeam) {
if ($user->id === auth()->user()->id) {
return;

View File

@ -78,7 +78,7 @@ public function isAdminFromSession()
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';
}

View File

@ -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) {