fix: admins should now invite owner

This commit is contained in:
Andras Bacsai
2024-10-24 20:57:30 +02:00
parent 091cbdf048
commit 8182305ac4
2 changed files with 7 additions and 2 deletions

View File

@@ -41,6 +41,9 @@ class InviteLink extends Component
{
try {
$this->validate();
if (auth()->user()->role() === 'admin' && $this->role === 'owner') {
throw new \Exception('Admins cannot invite owners.');
}
$member_emails = currentTeam()->members()->get()->pluck('email');
if ($member_emails->contains($this->email)) {
return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of ".currentTeam()->name.'.');