Skip to content

Commit 0c5b31a

Browse files
committed
feat: use DECT as Telegram handle
1 parent d4f8193 commit 0c5b31a

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

includes/view/Locations_view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
4747
if (config('enable_dect') && $location->dect) {
4848
$dect = heading(__('Contact'), 3)
4949
. description([__('general.dect') => sprintf(
50-
'<a href="tel:%s">%1$s</a>',
50+
'<a href="https://t.me/%s">%1$s</a>',
5151
htmlspecialchars($location->dect)
5252
)]);
5353
}

includes/view/User_view.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function Users_view(
9696
. user_info_icon($user);
9797
$u['first_name'] = htmlspecialchars((string) $user->personalData->first_name);
9898
$u['last_name'] = htmlspecialchars((string) $user->personalData->last_name);
99-
$u['dect'] = sprintf('<a href="tel:%s">%1$s</a>', htmlspecialchars((string) $user->contact->dect));
99+
$u['dect'] = sprintf('<a href="https://t.me/%s">%1$s</a>', htmlspecialchars((string) $user->contact->dect));
100100
$u['arrived'] = icon_bool($user->state->arrived);
101101
if (config('enable_voucher')) {
102102
$u['got_voucher'] = $user->state->got_voucher;
@@ -713,7 +713,7 @@ function User_view(
713713
config('enable_dect') && $user_source->contact->dect ?
714714
heading(
715715
icon('phone')
716-
. ' <a href="tel:' . htmlspecialchars($user_source->contact->dect) . '">'
716+
. ' <a href="https://t.me/' . htmlspecialchars($user_source->contact->dect) . '">'
717717
. htmlspecialchars($user_source->contact->dect)
718718
. '</a>'
719719
)

resources/api/openapi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ components:
322322
type: string
323323
nullable: true
324324
example: 4242
325-
description: The DECT number is a short internal number where users can be easily reached
325+
description: The Telegram handle stored in the dect field is used as a way to easily reach users
326326
mobile:
327327
type: string
328328
nullable: true

resources/views/pages/angeltypes/about.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<dl class="row card-text">
7979
{% for type, info in {
8080
'contact_name': {'name': __('general.name')},
81-
'contact_dect': {'name': __('general.dect'), 'url': 'tel'},
81+
'contact_dect': {'name': __('general.dect'), 'pattern': 'https://t.me/%s'},
8282
'contact_email': {'name': __('general.email'), 'url': 'mailto'},
8383
} %}
8484
{% if angeltype[type] and (type != 'contact_dect' or config('enable_dect')) %}
@@ -90,6 +90,10 @@
9090
<a href="{{ info['url'] }}:{{ angeltype[type] | e('html_attr') }}">
9191
{{ angeltype[type] }}
9292
</a>
93+
{% elseif info.pattern is defined %}
94+
<a href="{{ info.pattern | format(angeltype[type]) }}">
95+
{{ angeltype[type] }}
96+
</a>
9397
{% else %}
9498
{{ angeltype[type] }}
9599
{% endif %}

resources/views/pages/registration.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@
280280
"dect",
281281
__('general.dect'),
282282
{
283-
'type': 'tel-local',
284283
'max_length': 40,
285284
'required': isDectRequired,
286285
'required_icon': isDectRequired,

src/Controllers/Admin/LocationsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function save(Request $request): Response
9292

9393
$location->name = $data['name'];
9494
$location->description = $data['description'];
95-
$location->dect = $data['dect'];
95+
$location->dect = ltrim($data['dect'], '@');
9696
$location->map_url = $data['map_url'];
9797

9898
$location->save();

src/Controllers/SettingsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function saveProfile(Request $request): Response
9191
}
9292

9393
if (config('enable_dect')) {
94-
$user->contact->dect = $data['dect'];
94+
$user->contact->dect = ltrim($data['dect'], '@');
9595
}
9696

9797
$user->contact->mobile = $data['mobile'];

0 commit comments

Comments
 (0)