Join requests now present an "are you sure?" modal
This commit is contained in:
@@ -105,7 +105,7 @@ class OrganisationMembersController extends SimpleController
|
||||
Capsule::transaction(function () use ($organisation, $currentUser, $classMapper, $config) {
|
||||
$organisation->members()->attach($currentUser->id, [
|
||||
'flag_admin' => false,
|
||||
'flag_approved' => !$config['organisation']['membership']['require_approval'],
|
||||
'flag_approved' => !$config['organisation.membership.require_approval'],
|
||||
]);
|
||||
|
||||
$organisation->save();
|
||||
@@ -976,6 +976,55 @@ class OrganisationMembersController extends SimpleController
|
||||
return $sprunje->toResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get join confirmation modal.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
* @param array $args
|
||||
*
|
||||
* @throws NotFoundException If organisation is not found
|
||||
* @throws ForbiddenException If user is not authorized to access page
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function getModalConfirmJoin(Request $request, Response $response, $args)
|
||||
{
|
||||
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
|
||||
$authorizer = $this->ci->authorizer;
|
||||
|
||||
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
|
||||
$classMapper = $this->ci->classMapper;
|
||||
|
||||
/** @var \UserFrosting\Support\Repository\Repository $config */
|
||||
$config = $this->ci->config;
|
||||
|
||||
/** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */
|
||||
$currentUser = $this->ci->currentUser;
|
||||
|
||||
|
||||
$organisation = $this->getOrganisationFromParams($args);
|
||||
|
||||
// If the organisation no longer exists, forward to main organisation listing page
|
||||
if (!$organisation) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
// Access-controlled page
|
||||
if (!$authorizer->checkAccess($currentUser, 'join_organisation', [
|
||||
'organisation' => $organisation,
|
||||
])) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
return $this->ci->view->render($response, 'modals/confirm-join-organisation.html.twig', [
|
||||
'organisation' => $organisation,
|
||||
'approval_required' => $config['organisation.membership.require_approval'],
|
||||
'form' => [
|
||||
'action' => "api/organisations/o/{$organisation->slug}/members",
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get leave confirmation modal.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user