Skip to content

Commit a10f22f

Browse files
authored
Merge pull request #7 from eurofurence/upstream
chore: pull from upstream & Telegram in place of DECT, fix localisation issues
2 parents 6fc27dd + 594de51 commit a10f22f

35 files changed

+171
-156
lines changed

DEVELOPMENT.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ ln -s ../../bin/pre-commit .git/hooks/pre-commit
4141

4242
## Docker
4343

44-
We suggest using Docker for the Development local build.
44+
> [!TIP]
45+
> We suggest using Docker for the Development local build.
46+
> This repo [ships a docker setup](docker/dev) for a quick development start.
47+
> If you use another uid/gid than 1000 on your machine you have to adjust it in [docker/dev/.env](docker/dev/.env).
4548
46-
If unspecific issues appear try using Docker version >= 20.10.14.
47-
48-
This repo [ships a docker setup](docker/dev) for a quick development start.
49-
50-
If you use another uid/gid than 1000 on your machine you have to adjust it in [docker/dev/.env](docker/dev/.env).
5149

52-
Run this once
50+
Make sure you're in the `docker/dev` subfolder:
5351

5452
```bash
5553
cd docker/dev
54+
```
55+
56+
Then, run
57+
```bash
5658
docker compose up
5759
```
5860

@@ -215,3 +217,11 @@ For some reason *PhpStorm* is unable to detect the server name.
215217
But without a server name it's impossible to set up path mappings.
216218
Because of that the docker setup sets the server name *engelsystem*.
217219
To get Xdebug working you have to create a server with the name *engelsystem* manually.
220+
221+
## Troubleshooting
222+
223+
### Docker version
224+
If unspecific issues appear try using Docker version >= 20.10.14.
225+
226+
### `service "es_workspace" is not running`
227+
Make sure you're running your docker commands from the `docker/dev` directory, not from `docker`

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ The Engelsystem can now be used.
6060
* Both Apache and Nginx allow for different VirtualHost configurations.
6161

6262
### Docker
63+
64+
For instructions on how to build the Docker container for development, please consult the [DEVELOPMENT.md](DEVELOPMENT.md).
65+
6366
#### Build
6467
To build the `es_server` container:
6568
```bash

config/config.default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413

414414
// Whether to show the current day of the event (-2, -1, 0, 1, 2…) in footer and on the dashboard.
415415
// The event start date has to be set for it to appear.
416-
'enable_show_day_of_event' => (bool) env('ENABLE_SHOW_DAY_OF_EVENT', false),
416+
'enable_day_of_event' => (bool) env('ENABLE_DAY_OF_EVENT', false),
417417
// If true there will be a day 0 (-1, 0, 1…). If false there won't (-1, 1…)
418418
'event_has_day0' => (bool) env('EVENT_HAS_DAY0', true),
419419

includes/controller/angeltypes_controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ function angeltype_delete_controller()
6565

6666
if (request()->hasPostData('delete')) {
6767
$angeltype->delete();
68-
engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype, true));
69-
success(sprintf(__('Angeltype %s deleted.'), $angeltype->name));
68+
engelsystem_log('Deleted angel type: ' . AngelType_name_render($angeltype, true));
69+
success(sprintf(__('Angel type %s deleted.'), $angeltype->name));
7070
throw_redirect(url('/angeltypes'));
7171
}
7272

7373
return [
74-
sprintf(__('Delete angeltype %s'), htmlspecialchars($angeltype->name)),
74+
sprintf(__('Delete angel type %s'), htmlspecialchars($angeltype->name)),
7575
AngelType_delete_view($angeltype),
7676
];
7777
}
@@ -137,7 +137,7 @@ function angeltype_edit_controller()
137137

138138
success(__('Angel type saved.'));
139139
engelsystem_log(
140-
'Saved angeltype: ' . $angeltype->name . ($angeltype->restricted ? ', restricted' : '')
140+
'Saved angel type: ' . $angeltype->name . ($angeltype->restricted ? ', restricted' : '')
141141
. ($angeltype->shift_self_signup ? ', shift_self_signup' : '')
142142
. (config('driving_license_enabled')
143143
? (($angeltype->requires_driver_license ? ', requires driver license' : '') . ', ')

includes/controller/shift_entries_controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function shift_entry_create_controller_supporter(Shift $shift, AngelType $angelt
149149
}
150150

151151
if (!$signup_user->userAngelTypes()->wherePivot('angel_type_id', $angeltype->id)->exists()) {
152-
error(__('User is not in angeltype.'));
152+
error(__('User is not in angel type.'));
153153
throw_redirect(shift_link($shift));
154154
}
155155

@@ -186,7 +186,7 @@ function shift_entry_create_controller_supporter(Shift $shift, AngelType $angelt
186186
function shift_entry_error_message(ShiftSignupState $shift_signup_state)
187187
{
188188
match ($shift_signup_state->getState()) {
189-
ShiftSignupStatus::ANGELTYPE => error(__('You need be accepted member of the angeltype.')),
189+
ShiftSignupStatus::ANGELTYPE => error(__('You need be accepted member of the angel type.')),
190190
ShiftSignupStatus::COLLIDES => error(__('This shift collides with one of your shifts.')),
191191
ShiftSignupStatus::OCCUPIED => error(__('This shift is already occupied.')),
192192
ShiftSignupStatus::SHIFT_ENDED => error(__('This shift ended already.')),

includes/controller/shifts_controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function shift_edit_controller()
104104
$shifttype_id = $request->input('shifttype_id');
105105
} else {
106106
$valid = false;
107-
error(__('Please select a shifttype.'));
107+
error(__('Please select a shift type.'));
108108
}
109109

110110
if ($request->has('start') && $tmp = DateTime::createFromFormat('Y-m-d H:i', $request->input('start'))) {
@@ -208,7 +208,7 @@ function shift_edit_controller()
208208
. info(__('This page is much more comfortable with javascript.'), true)
209209
. '</noscript>',
210210
form([
211-
form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id),
211+
form_select('shifttype_id', __('Shift type'), $shifttypes, $shifttype_id),
212212
form_text('title', __('title.title'), $title),
213213
form_select('rid', __('Location:'), $locations, $rid),
214214
form_text('start', __('Start:'), $start->format('Y-m-d H:i')),

includes/controller/user_angeltypes_controller.php

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use Engelsystem\Http\Exceptions\HttpForbidden;
4+
use Engelsystem\Http\Exceptions\HttpNotFound;
35
use Engelsystem\Mail\EngelsystemMailer;
46
use Engelsystem\Models\AngelType;
57
use Engelsystem\Models\User\User;
@@ -38,19 +40,18 @@ function user_angeltypes_unconfirmed_hint()
3840
$unconfirmed_links[] = '<a href="'
3941
. url('/angeltypes', ['action' => 'view', 'angeltype_id' => $user_angeltype->angel_type_id])
4042
. '">' . htmlspecialchars($user_angeltype->angelType->name)
41-
. ' (+' . $user_angeltype->count . ')'
43+
. ' (+' . $user_angeltype->users_count . ')'
4244
. '</a>';
4345
}
4446

4547
$count = $unconfirmed_user_angeltypes->count();
4648
return
4749
_e(
48-
'There is %d unconfirmed angeltype.',
49-
'There are %d unconfirmed angeltypes.',
50+
'There are unconfirmed angels in %d angel type. Angel type that needs approval:',
51+
'There are unconfirmed angels in %d angel types. Angel types that need approvals:',
5052
$count,
5153
[$count]
5254
)
53-
. ' ' . __('Angel types which need approvals:')
5455
. ' ' . join(', ', $unconfirmed_links);
5556
}
5657

@@ -70,7 +71,7 @@ function user_angeltypes_delete_all_controller(): array
7071

7172
$angeltype = AngelType::findOrFail($request->input('angeltype_id'));
7273
if (!auth()->user()->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) {
73-
error(__('You are not allowed to delete all users for this angeltype.'));
74+
error(__('You are not allowed to delete all users for this angel type.'));
7475
throw_redirect(url('/angeltypes'));
7576
}
7677

@@ -79,8 +80,8 @@ function user_angeltypes_delete_all_controller(): array
7980
->whereNull('confirm_user_id')
8081
->delete();
8182

82-
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype, true)));
83-
success(sprintf(__('Denied all users for angeltype %s.'), $angeltype->name));
83+
engelsystem_log(sprintf('Denied all users for angel type %s', AngelType_name_render($angeltype, true)));
84+
success(sprintf(__('Denied all users for angel type %s.'), $angeltype->name));
8485
throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]));
8586
}
8687

@@ -107,7 +108,7 @@ function user_angeltypes_confirm_all_controller(): array
107108

108109
$angeltype = AngelType::findOrFail($request->input('angeltype_id'));
109110
if (!auth()->can('admin_user_angeltypes') && !$user->isAngelTypeSupporter($angeltype)) {
110-
error(__('You are not allowed to confirm all users for this angeltype.'));
111+
error(__('You are not allowed to confirm all users for this angel type.'));
111112
throw_redirect(url('/angeltypes'));
112113
}
113114

@@ -118,8 +119,8 @@ function user_angeltypes_confirm_all_controller(): array
118119
->whereNull('confirm_user_id')
119120
->update(['confirm_user_id' => $user->id]);
120121

121-
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype, true)));
122-
success(sprintf(__('Confirmed all users for angeltype %s.'), $angeltype->name));
122+
engelsystem_log(sprintf('Confirmed all users for angel type %s', AngelType_name_render($angeltype, true)));
123+
success(sprintf(__('Confirmed all users for angel type %s.'), $angeltype->name));
123124

124125
foreach ($users as $user) {
125126
user_angeltype_confirm_email($user, $angeltype);
@@ -145,15 +146,14 @@ function user_angeltype_confirm_controller(): array
145146
$request = request();
146147

147148
if (!$request->has('user_angeltype_id')) {
148-
error(__('User angeltype doesn\'t exist.'));
149-
throw_redirect(url('/angeltypes'));
149+
throw new HttpNotFound();
150150
}
151151

152152
/** @var UserAngelType $user_angeltype */
153153
$user_angeltype = UserAngelType::findOrFail($request->input('user_angeltype_id'));
154154
$angeltype = $user_angeltype->angelType;
155155
if (!$user->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) {
156-
error(__('You are not allowed to confirm this users angeltype.'));
156+
error(__('You are not allowed to confirm this users angel type.'));
157157
throw_redirect(url('/angeltypes'));
158158
}
159159

@@ -163,19 +163,19 @@ function user_angeltype_confirm_controller(): array
163163
$user_angeltype->save();
164164

165165
engelsystem_log(sprintf(
166-
'%s confirmed for angeltype %s',
166+
'%s confirmed for angel type %s',
167167
User_Nick_render($user_source, true),
168168
AngelType_name_render($angeltype, true)
169169
));
170-
success(sprintf(__('%s confirmed for angeltype %s.'), $user_source->displayName, $angeltype->name));
170+
success(sprintf(__('%s confirmed for angel type %s.'), $user_source->displayName, $angeltype->name));
171171

172172
user_angeltype_confirm_email($user_source, $angeltype);
173173

174174
throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]));
175175
}
176176

177177
return [
178-
__('Confirm angeltype for user'),
178+
__('Confirm angel type for user'),
179179
UserAngelType_confirm_view($user_angeltype, $user_source, $angeltype),
180180
];
181181
}
@@ -223,8 +223,7 @@ function user_angeltype_delete_controller(): array
223223
$user = auth()->user();
224224

225225
if (!$request->has('user_angeltype_id')) {
226-
error(__('User angeltype doesn\'t exist.'));
227-
throw_redirect(url('/angeltypes'));
226+
throw new HttpNotFound();
228227
}
229228

230229
/** @var UserAngelType $user_angeltype */
@@ -237,7 +236,7 @@ function user_angeltype_delete_controller(): array
237236
&& !$user->isAngelTypeSupporter($angeltype)
238237
&& !auth()->can('admin_user_angeltypes')
239238
) {
240-
error(__('You are not allowed to delete this users angeltype.'));
239+
error(__('You are not allowed to delete this users angel type.'));
241240
throw_redirect(url('/angeltypes'));
242241
}
243242

@@ -251,7 +250,7 @@ function user_angeltype_delete_controller(): array
251250
}
252251

253252
return [
254-
__('Leave angeltype'),
253+
__('Leave angel type'),
255254
UserAngelType_delete_view($user_angeltype, $user_source, $angeltype, $isOwnAngelType),
256255
];
257256
}
@@ -266,14 +265,11 @@ function user_angeltype_update_controller(): array
266265
$supporter = false;
267266
$request = request();
268267

269-
if (!auth()->can('admin_angel_types') && !config('supporters_can_promote')) {
270-
error(__('You are not allowed to set supporter rights.'));
271-
throw_redirect(url('/angeltypes'));
272-
}
273-
274268
if (!$request->has('user_angeltype_id')) {
275-
error(__('User angeltype doesn\'t exist.'));
276-
throw_redirect(url('/angeltypes'));
269+
throw new HttpNotFound();
270+
}
271+
if (!auth()->can('admin_angel_types') && !config('supporters_can_promote')) {
272+
throw new HttpForbidden();
277273
}
278274

279275
if ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) {
@@ -389,7 +385,7 @@ function user_angeltype_add_controller(): array
389385
}
390386

391387
return [
392-
__('Add user to angeltype'),
388+
__('Add user to angel type'),
393389
UserAngelType_add_view($angeltype, $users_select, $user_source->id),
394390
];
395391
}

includes/helper/legacy_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function dateWithEventDay(string $day): string
3131
$dayOfEvent = DayOfEvent::get($date);
3232
$dateFormatted = $date->format(__('general.date'));
3333

34-
if (!config('enable_show_day_of_event') || is_null($dayOfEvent)) {
34+
if (is_null($dayOfEvent)) {
3535
return $dateFormatted;
3636
}
3737

includes/pages/admin_active.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function admin_active()
270270
$parameters['show_all_shifts'] = 1;
271271
}
272272
$actions[] = form(
273-
[form_submit('submit', icon('plus-lg') . __('set active'), 'btn-sm', false, 'secondary')],
273+
[form_submit('submit', icon('plus-lg') . __('Set active'), 'btn-sm', false, 'secondary')],
274274
url('/admin-active', $parameters),
275275
false,
276276
true

includes/pages/admin_arrive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function admin_arrive()
212212
table(array_merge(
213213
['name' => __('general.name'),],
214214
($admin_arrive ? ['rendered_planned_arrival_date' => __('Planned arrival')] : []),
215-
['arrived' => __('Arrived?')],
215+
['arrived' => __('Arrived')],
216216
($admin_arrive ? [
217217
'rendered_arrival_date' => __('Arrival date'),
218218
'rendered_planned_departure_date' => __('Planned departure'),

0 commit comments

Comments
 (0)