fix: admins should now invite owner
This commit is contained in:
@@ -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.'.');
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<div class="flex flex-1 gap-2">
|
||||
<x-forms.input id="email" type="email" label="Email" name="email" placeholder="Email" required />
|
||||
<x-forms.select id="role" name="role" label="Role">
|
||||
@if (auth()->user()->role() === 'owner')
|
||||
<option value="owner">Owner</option>
|
||||
@endif
|
||||
<option value="admin">Admin</option>
|
||||
<option value="member">Member</option>
|
||||
</x-forms.select>
|
||||
|
||||
Reference in New Issue
Block a user