Support disabling the arrival feature

Setting `autoarrive` to true will now cause all newly registered angels
to be automatically confirmed as arrived.
This commit is contained in:
Janne Heß 2019-03-06 19:28:07 +01:00 committed by msquare
parent afa4506e11
commit 69ac1b2d21
3 changed files with 13 additions and 1 deletions

View File

@ -82,6 +82,9 @@ return [
// Only arrived angels can sign up for shifts // Only arrived angels can sign up for shifts
'signup_requires_arrival' => false, 'signup_requires_arrival' => false,
// Whether newly-registered user should automatically be marked as arrived
'autoarrive' => false,
// Number of hours that an angel has to sign out own shifts // Number of hours that an angel has to sign out own shifts
'last_unsubscribe' => 3, 'last_unsubscribe' => 3,

View File

@ -217,7 +217,12 @@ function guest_register()
->associate($user) ->associate($user)
->save(); ->save();
(new State())->user() $state = new State([]);
if (config('autoarrive')) {
$state->arrived = true;
$state->arrival_date = new Carbon();
}
$state->user()
->associate($user) ->associate($user)
->save(); ->save();

View File

@ -114,6 +114,10 @@ function make_navigation()
'admin_event_config' => __('Event config'), 'admin_event_config' => __('Event config'),
]; ];
if (config('autoarrive')) {
unset($admin_pages['admin_arrive']);
}
foreach ($admin_pages as $menu_page => $title) { foreach ($admin_pages as $menu_page => $title) {
if (auth()->can($menu_page)) { if (auth()->can($menu_page)) {
$admin_menu[] = toolbar_item_link( $admin_menu[] = toolbar_item_link(