Skip to content

Commit

Permalink
fix: registration
Browse files Browse the repository at this point in the history
fix: user deletion
  • Loading branch information
andrasbacsai committed Sep 14, 2023
1 parent 9494073 commit 9f2fbc6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/Http/Livewire/Team/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
3 changes: 2 additions & 1 deletion bootstrap/helpers/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9f2fbc6

Please sign in to comment.