fix: registration
fix: user deletion
This commit is contained in:
@@ -12,7 +12,6 @@ class Delete extends Component
|
|||||||
$currentTeam = currentTeam();
|
$currentTeam = currentTeam();
|
||||||
$currentTeam->delete();
|
$currentTeam->delete();
|
||||||
|
|
||||||
$team = auth()->user()->teams()->first();
|
|
||||||
$currentTeam->members->each(function ($user) use ($currentTeam) {
|
$currentTeam->members->each(function ($user) use ($currentTeam) {
|
||||||
if ($user->id === auth()->user()->id) {
|
if ($user->id === auth()->user()->id) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class User extends Authenticatable implements SendsEmail
|
|||||||
if ($is_part_of_root_team && $is_admin_of_root_team) {
|
if ($is_part_of_root_team && $is_admin_of_root_team) {
|
||||||
return true;
|
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';
|
return $role === 'admin' || $role === 'owner';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use App\Models\InstanceSettings;
|
use App\Models\InstanceSettings;
|
||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
|
use App\Models\User;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
@@ -60,7 +61,7 @@ function showBoarding(): bool
|
|||||||
function refreshSession(?Team $team = null): void
|
function refreshSession(?Team $team = null): void
|
||||||
{
|
{
|
||||||
if (!$team) {
|
if (!$team) {
|
||||||
$team = Team::find(currentTeam()->id);
|
$team = User::find(auth()->user()->id)->teams->first();
|
||||||
}
|
}
|
||||||
Cache::forget('team:' . auth()->user()->id);
|
Cache::forget('team:' . auth()->user()->id);
|
||||||
Cache::remember('team:' . auth()->user()->id, 3600, function() use ($team) {
|
Cache::remember('team:' . auth()->user()->id, 3600, function() use ($team) {
|
||||||
|
|||||||
Reference in New Issue
Block a user