Skip to content

Commit 435e953

Browse files
authored
Merge pull request #82 from cslant/feature/laravel-helper-set-limit-content
feat: using laravel helper to set limit content message
2 parents 12cdeea + 0660eb3 commit 435e953

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
/**
33
* @var object $payload
44
*/
5+
use Illuminate\Support\Str;
56
67
$changes = $payload->changes;
78
$label = $payload->label;
8-
$description = strlen($label->description) < 100 ? $label->description : substr($label->description, 0, 100).'...';
9+
$description = Str::limit($label->description);
910
if (isset($changes->description->from)) {
10-
$description_changes = strlen($changes->description->from) < 100 ? $changes->description->from : substr($changes->description->from, 0, 100).'...';
11+
$description_changes = Str::limit($changes->description->from);
1112
}
1213
?>
1314

resources/views/events/github/pull_request/labeled.blade.php

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

109
‍👷‍♂️🛠️ {!! __('tg-notifier::events/github/pull_request.labeled.title', [
@@ -14,4 +13,4 @@
1413
) !!}
1514

1615
🔖 {!! __('tg-notifier::events/github/pull_request.labeled.name') !!}: <code>{{ $payload->label->name }}</code>
17-
📑 {!! __('tg-notifier::events/github/pull_request.labeled.description') !!}: {{ $description }}
16+
📑 {!! __('tg-notifier::events/github/pull_request.labeled.description') !!}: {{ Str::limit($payload->label->description) }}

resources/views/events/github/pull_request/unlabeled.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
/**
33
* @var object $payload
44
*/
5+
use Illuminate\Support\Str;
56
67
$pull_request = $payload->pull_request;
7-
$description = strlen($payload->label->description) > 100 ? $payload->label->description : substr($payload->label->description, 0, 100).'...';
8+
$description = Str::limit($payload->label->description);
89
?>
910

1011
‍👷‍♂️🛠️ {!! __('tg-notifier::events/github/pull_request.unlabeled.title', [

0 commit comments

Comments
 (0)