Show "not marked as arrived" Notification only from set arrival date

This commit is contained in:
Xu 2023-12-22 11:08:39 +01:00 committed by Igor Scheller
parent 14dbe7f5d9
commit 4fa99b8a04
4 changed files with 11 additions and 9 deletions

View File

@ -284,7 +284,7 @@ function view_user_shifts()
$canSignUpForShifts = true;
if (config('signup_requires_arrival') && !$user->state->arrived) {
$canSignUpForShifts = false;
info(render_user_arrived_hint((bool) $user->state->user_info));
info(render_user_arrived_hint());
}
$formattedDays = collect($days)->map(function ($value) {

View File

@ -24,7 +24,7 @@ function header_render_hints()
// Important hints:
$hints_renderer->addHint(render_user_freeloader_hint(), true);
$hints_renderer->addHint(render_user_arrived_hint(), true);
$hints_renderer->addHint(render_user_arrived_hint(true), true);
$hints_renderer->addHint(render_user_pronoun_hint(), true);
$hints_renderer->addHint(render_user_firstname_hint(), true);
$hints_renderer->addHint(render_user_lastname_hint(), true);

View File

@ -17,7 +17,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
$assignNotice = '';
if (config('signup_requires_arrival') && !$user->state->arrived) {
$assignNotice = info(render_user_arrived_hint((bool) $user->state->user_info), true);
$assignNotice = info(render_user_arrived_hint(), true);
}
$description = '';

View File

@ -981,16 +981,18 @@ function render_user_freeloader_hint()
*
* @return string|null
*/
function render_user_arrived_hint(bool $is_user_shifts = false)
function render_user_arrived_hint(bool $is_sys_menu = false)
{
$user_info = auth()->user()->state->user_info;
if (config('signup_requires_arrival') && !auth()->user()->state->arrived) {
$user = auth()->user();
$user_arrival_date = $user->personalData->planned_arrival_date;
$is_before_arrival_date = $is_sys_menu && $user_arrival_date && Carbon::now() < $user_arrival_date;
if (config('signup_requires_arrival') && !$user->state->arrived && !$is_before_arrival_date) {
/** @var Carbon $buildup */
$buildup = config('buildup_start');
if (!empty($buildup) && $buildup->lessThan(new Carbon())) {
return !$user_info
? __('You are not marked as arrived. Please go to heaven, get your angel badge and/or tell them that you arrived already.')
: ($is_user_shifts ? __('user_info.not_arrived_hint') : null);
return $user->state->user_info
? ($is_sys_menu ? null : __('user_info.not_arrived_hint'))
: __('You are not marked as arrived. Please go to heaven, get your angel badge and/or tell them that you arrived already.');
}
}