Skip to content

Commit 83d7454

Browse files
committed
feat: using laravel helper to set limit content message
1 parent b8cde2b commit 83d7454

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

resources/views/events/github/label/created.blade.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55
66
$label = $payload->label;
7-
$description = strlen($label->description) < 100 ? $label->description : substr($label->description, 0, 100).'...';
87
?>
98

109
{!! __('tg-notifier::events/github/label.created.title', [
@@ -14,4 +13,4 @@
1413
) !!}
1514

1615
🔖 <b>{{ $payload->label->name }}</b>
17-
<b>{!! __('tg-notifier::events/shared/github._description.title') !!}:</b> {{ $description }}
16+
<b>{!! __('tg-notifier::events/shared/github._description.title') !!}:</b> {{ \Illuminate\Support\Str::limit($label->description) }}

resources/views/events/shared/partials/github/_body.blade.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
* @var $event string
55
*/
66
7+
use Illuminate\Support\Str;
8+
79
$html = '';
810
if (isset($event) && isset($payload) && !empty($payload->{$event}->body)) {
9-
$body = $payload->{$event}->body;
10-
if (strlen($body) > 100) {
11-
$body = substr($body, 0, 100).'...';
12-
}
13-
14-
$html = htmlentities($body);
11+
$html = htmlentities(Str::limit($payload->{$event}->body));
1512
}
1613
?>
1714
@if(!empty($html))

resources/views/events/shared/partials/gitlab/_body.blade.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @var $event string
55
*/
66
7+
use Illuminate\Support\Str;
8+
79
$html = '';
810
if (isset($event) && isset($payload)) {
911
if (!empty($payload->object_attributes->description)) {
@@ -19,11 +21,7 @@
1921
} else {
2022
return '';
2123
}
22-
if (strlen($body) > 100) {
23-
$body = substr($body, 0, 100) . '...';
24-
}
25-
26-
$html = htmlentities($body);
24+
$html = htmlentities(Str::limit($body));
2725
}
2826
?>
2927
@if(!empty($html))

0 commit comments

Comments
 (0)