Fixed bug preventing admin leaving organisation
This commit is contained in:
@@ -279,7 +279,8 @@ class OrganisationMembersController extends SimpleController
|
||||
|
||||
// Check if the user is a member of the organisation, pending or no relation at all
|
||||
$memberCheck = $organisation->members()->where('user_id', $currentUser->id)->withPivot('flag_approved')->first();
|
||||
if (!$memberCheck || !$memberCheck->pivot->flag_approved) {
|
||||
$adminCheck = $organisation->administrators()->where('user_id', $currentUser->id)->withPivot('flag_approved')->first();
|
||||
if (!($memberCheck && $memberCheck->pivot->flag_approved) && !($adminCheck && $adminCheck->pivot->flag_approved)) {
|
||||
$ms->addMessageTranslated('danger', 'ORGANISATION.NOT_A_MEMBER', [
|
||||
'name' => $organisation->name
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user