Fixed "remove member" bug

This commit is contained in:
2022-02-28 11:31:07 +00:00
parent 001559ed12
commit 6b7e7cd53b

View File

@@ -358,8 +358,8 @@ class OrganisationMembersController extends SimpleController
} }
// Check if the user is a member of the organisation, pending or no relation at all // 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(); $memberCheck = $organisation->members()->where('user_id', $user->id)->withPivot('flag_approved')->first();
$adminCheck = $organisation->administrators()->where('user_id', $currentUser->id)->withPivot('flag_approved')->first(); $adminCheck = $organisation->administrators()->where('user_id', $user->id)->withPivot('flag_approved')->first();
if (!($memberCheck && $memberCheck->pivot->flag_approved) && !($adminCheck && $adminCheck->pivot->flag_approved)) { if (!($memberCheck && $memberCheck->pivot->flag_approved) && !($adminCheck && $adminCheck->pivot->flag_approved)) {
$ms->addMessageTranslated('danger', 'ORGANISATION.MEMBER.NOT_FOUND', [ $ms->addMessageTranslated('danger', 'ORGANISATION.MEMBER.NOT_FOUND', [
'name' => $organisation->name, 'name' => $organisation->name,