diff --git a/resources/views/admin/user/delete-worklog.twig b/resources/views/admin/user/delete-worklog.twig index fc5813b1..086dcdf4 100644 --- a/resources/views/admin/user/delete-worklog.twig +++ b/resources/views/admin/user/delete-worklog.twig @@ -11,9 +11,9 @@ {{ csrf() }}
- {{ m.alert(__('worklog.delete.info', [m.user(user)]), 'danger', true) }} + {{ m.alert(__('worklog.delete.info', [m.user(userdata)]), 'danger', true) }} {{ m.button(__('form.cancel'), - url('/users?action=view&user_id=' ~ user.id), + url('/users?action=view&user_id=' ~ userdata.id), null, null, null, diff --git a/resources/views/admin/user/edit-worklog.twig b/resources/views/admin/user/edit-worklog.twig index e7bad20a..000f277a 100644 --- a/resources/views/admin/user/edit-worklog.twig +++ b/resources/views/admin/user/edit-worklog.twig @@ -7,7 +7,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: user.id}), + {{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}), null, 'sm', __('general.back')) }} {{ block('title') }}

@@ -21,7 +21,7 @@
- {{ m.user(user, {'pronoun': true}) }} + {{ m.user(userdata, {'pronoun': true}) }}
{{ f.input('work_date', __('worklog.date'), { diff --git a/resources/views/pages/settings/profile.twig b/resources/views/pages/settings/profile.twig index 26213e19..09d95a13 100644 --- a/resources/views/pages/settings/profile.twig +++ b/resources/views/pages/settings/profile.twig @@ -19,14 +19,14 @@
{{ f.input('nick', __('general.nick'), { - 'value': user.name, + 'value': userdata.name, 'disabled': true, }) }}
{% if config('enable_pronoun') %}
{{ f.input('pronoun', __('settings.profile.pronoun'), { - 'value': user.personalData.pronoun, + 'value': userdata.personalData.pronoun, 'max_length': 15, 'required': isPronounRequired, 'required_icon': isPronounRequired, @@ -40,7 +40,7 @@
{{ f.input('first_name', __('settings.profile.firstname'), { - 'value': user.personalData.first_name, + 'value': userdata.personalData.first_name, 'max_length': 64, 'required': isFirstnameRequired, 'required_icon': isFirstnameRequired, @@ -48,7 +48,7 @@
{{ f.input('last_name', __('settings.profile.lastname'), { - 'value': user.personalData.last_name, + 'value': userdata.personalData.last_name, 'max_length': 64, 'required': isLastnameRequired, 'required_icon': isLastnameRequired, @@ -60,7 +60,7 @@ {% if config('enable_planned_arrival') %}
- {% set planned_arrival_date = user.personalData.planned_arrival_date %} + {% set planned_arrival_date = userdata.personalData.planned_arrival_date %} {{ f.input('planned_arrival_date', __('settings.profile.planned_arrival_date'), { 'type': 'date', 'value': planned_arrival_date ? planned_arrival_date.format('Y-m-d') : '', @@ -71,7 +71,7 @@ }) }}
- {% set planned_departure_date = user.personalData.planned_departure_date %} + {% set planned_departure_date = userdata.personalData.planned_departure_date %} {{ f.input('planned_departure_date', __('settings.profile.planned_departure_date'), { 'type': 'date', 'value': planned_departure_date ? planned_departure_date.format('Y-m-d') : '', @@ -86,7 +86,7 @@ {% if config('enable_dect') %}
{{ f.input('dect', __('general.dect'), { - 'value': user.contact.dect, + 'value': userdata.contact.dect, 'max_length': 40, 'required': isDectRequired, 'required_icon': isDectRequired, @@ -95,14 +95,14 @@ {% endif %}
{{ f.input('mobile', __('settings.profile.mobile'), { - 'value': user.contact.mobile, + 'value': userdata.contact.mobile, 'max_length': 40, 'required': isMobileRequired, 'required_icon': isMobileRequired, }) }} {% if config('enable_mobile_show') %} {{ f.checkbox('mobile_show', __('settings.profile.mobile_show'), { - 'checked': user.settings.mobile_show, + 'checked': userdata.settings.mobile_show, }) }} {% endif %}
@@ -112,7 +112,7 @@
{{ f.input('email', __('general.email'), { 'type': 'email', - 'value': user.email, + 'value': userdata.email, 'max_length': 254, 'required': true, 'required_icon': true, @@ -122,16 +122,16 @@
{{ f.checkbox('email_shiftinfo', __('settings.profile.email_shiftinfo', [config('app_name')]), { - 'checked': user.settings.email_shiftinfo, + 'checked': userdata.settings.email_shiftinfo, }) }} {{ f.checkbox('email_news', __('settings.profile.email_news'), { - 'checked': user.settings.email_news, + 'checked': userdata.settings.email_news, }) }} {{ f.checkbox('email_messages', __('settings.profile.email_messages'), { - 'checked': user.settings.email_messages, + 'checked': userdata.settings.email_messages, }) }} {{ f.checkbox('email_human', __('settings.profile.email_by_human_allowed'), { - 'checked': user.settings.email_human, + 'checked': userdata.settings.email_human, }) }} {% if goodie_enabled %} {% set privacy_email = config('privacy_email') %} @@ -139,7 +139,7 @@ (privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '') %} {{ f.checkbox('email_goody', email_goody_label, { - 'checked': user.settings.email_goody, + 'checked': userdata.settings.email_goody, 'raw_label': true, }) }} {% endif %} @@ -150,11 +150,11 @@ {% if goodie_tshirt %}
{{ f.select('shirt_size', __('settings.profile.shirt_size'), config('tshirt_sizes'), { - 'selected': user.personalData.shirt_size, + 'selected': userdata.personalData.shirt_size, 'required': isTShirtSizeRequired, 'required_icon': isTShirtSizeRequired, 'default_option': __('form.select_placeholder'), - 'disabled': user.state.got_shirt, + 'disabled': userdata.state.got_shirt, 'info': __('settings.profile.shirt_size.hint'), 'raw_form_text': true, 'form_text': (tShirtLink ? m.icon('info-circle') diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php index 89c315ba..95f8c468 100644 --- a/src/Controllers/Admin/UserWorkLogController.php +++ b/src/Controllers/Admin/UserWorkLogController.php @@ -115,7 +115,7 @@ class UserWorkLogController extends BaseController return $this->response->withView( 'admin/user/delete-worklog.twig', - ['user' => $user] + ['userdata' => $user] ); } @@ -157,7 +157,7 @@ class UserWorkLogController extends BaseController return $this->response->withView( 'admin/user/edit-worklog.twig', [ - 'user' => $user, + 'userdata' => $user, 'work_date' => $work_date, 'work_hours' => $work_hours, 'comment' => $comment, diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index 037568e3..ffa1399a 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -45,7 +45,7 @@ class SettingsController extends BaseController 'pages/settings/profile', [ 'settings_menu' => $this->settingsMenu(), - 'user' => $user, + 'userdata' => $user, 'goodie_enabled' => $this->config->get('goodie_type') !== GoodieType::None->value, 'goodie_tshirt' => $this->config->get('goodie_type') === GoodieType::Tshirt->value, 'tShirtLink' => $this->config->get('tshirt_link'), diff --git a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php index 4469f428..6cfb9ecc 100644 --- a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php +++ b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php @@ -50,7 +50,7 @@ class UserWorkLogControllerTest extends ControllerTest ->method('withView') ->willReturnCallback(function (string $view, array $data) { $this->assertEquals('admin/user/edit-worklog.twig', $view); - $this->assertEquals($this->user->id, $data['user']->id); + $this->assertEquals($this->user->id, $data['userdata']->id); $this->assertEquals(Carbon::today(), $data['work_date']); $this->assertEquals(0, $data['work_hours']); $this->assertEquals('', $data['comment']); @@ -96,7 +96,7 @@ class UserWorkLogControllerTest extends ControllerTest $this->response->expects($this->once()) ->method('withView') ->willReturnCallback(function (string $view, array $data) { - $this->assertEquals($this->user->id, $data['user']->id); + $this->assertEquals($this->user->id, $data['userdata']->id); $this->assertEquals(new Carbon('2022-01-01'), $data['work_date']); $this->assertEquals(3.14, $data['work_hours']); $this->assertEquals('a comment', $data['comment']); @@ -252,7 +252,7 @@ class UserWorkLogControllerTest extends ControllerTest $this->response->expects($this->once()) ->method('withView') ->willReturnCallback(function (string $view, array $data) { - $this->assertEquals($this->user->id, $data['user']->id); + $this->assertEquals($this->user->id, $data['userdata']->id); return $this->response; }); $this->controller->showDeleteWorklog($request); diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php index d8b47ca5..9d38d26c 100644 --- a/tests/Unit/Controllers/SettingsControllerTest.php +++ b/tests/Unit/Controllers/SettingsControllerTest.php @@ -96,8 +96,8 @@ class SettingsControllerTest extends ControllerTest ->method('withView') ->willReturnCallback(function ($view, $data) { $this->assertEquals('pages/settings/profile', $view); - $this->assertArrayHasKey('user', $data); - $this->assertEquals($this->user, $data['user']); + $this->assertArrayHasKey('userdata', $data); + $this->assertEquals($this->user, $data['userdata']); return $this->response; });