This commit is contained in:
2022-02-22 10:44:42 +00:00
parent 940d5b0d2f
commit db19560e45

View File

@@ -206,8 +206,6 @@ class OrganisationMembersController extends SimpleController
// Begin transaction - DB will be rolled back if an exception occurs // Begin transaction - DB will be rolled back if an exception occurs
Capsule::transaction(function () use ($organisation, $currentUser, $classMapper, $config) { Capsule::transaction(function () use ($organisation, $currentUser, $classMapper, $config) {
$organisation->members()->detach($currentUser->id);
if ($config['organisation']['membership']['require_approval']) { if ($config['organisation']['membership']['require_approval']) {
// Find the mapping // Find the mapping
$tokenOwner = $classMapper->getClassMapping('organisation_member')::query() $tokenOwner = $classMapper->getClassMapping('organisation_member')::query()
@@ -218,6 +216,8 @@ class OrganisationMembersController extends SimpleController
$approval = $this->ci->repoOrganisationMembershipApproval->removeExisting($tokenOwner); $approval = $this->ci->repoOrganisationMembershipApproval->removeExisting($tokenOwner);
} }
$organisation->members()->detach($currentUser->id);
// Create activity record // Create activity record
$this->ci->userActivityLogger->info("User {$currentUser->user_name} cancelled the request to join the organisation {$organisation->name}.", [ $this->ci->userActivityLogger->info("User {$currentUser->user_name} cancelled the request to join the organisation {$organisation->name}.", [
'type' => 'organisation_join', 'type' => 'organisation_join',