Skip to content

Commit 6a22e26

Browse files
committed
fix: update push event - for create new branch
1 parent f1b6096 commit 6a22e26

File tree

6 files changed

+36
-29
lines changed

6 files changed

+36
-29
lines changed

lang/de/events/gitlab/push.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22

33
return [
4-
'default' => [
5-
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
6-
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
7-
'pusher' => '👤 Pushed by : <b>:name</b>',
8-
],
4+
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
5+
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
6+
'pusher' => 'Pushed by : <b>:name</b>',
7+
'new_branch_title' => '<b>A new branch has been pushed to the project</b> :repo',
98
];

lang/en/events/gitlab/push.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22

33
return [
4-
'default' => [
5-
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
6-
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
7-
'pusher' => '👤 Pushed by : <b>:name</b>',
8-
],
4+
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
5+
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
6+
'pusher' => 'Pushed by : <b>:name</b>',
7+
'new_branch_title' => '<b>A new branch has been pushed to the project</b> :repo',
98
];

lang/ja/events/gitlab/push.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22

33
return [
4-
'default' => [
5-
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
6-
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
7-
'pusher' => '👤 Pushed by : <b>:name</b>',
8-
],
4+
'title' => '<b>:count</b> new :noun to <b>:repo:<code>:branch</code></b>',
5+
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
6+
'pusher' => 'Pushed by : <b>:name</b>',
7+
'new_branch_title' => '<b>A new branch has been pushed to the project</b> :repo',
98
];

lang/vi/app.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
return [
4-
'by' => 'by',
5-
'unknown_callback' => 'Unknown Callback. Something went wrong!',
6-
'invalid_request' => 'Invalid Request!',
7-
'branch' => 'Branch',
4+
'by' => 'bởi',
5+
'unknown_callback' => 'Không rõ Callback. Đã xảy ra lỗi!',
6+
'invalid_request' => 'Yêu cầu không hợp lệ!',
7+
'branch' => 'Tên nhánh',
88
];

lang/vi/events/gitlab/push.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22

33
return [
4-
'default' => [
5-
'title' => '<b>:count</b> :noun mới trong <b>:repo:<code>:branch</code></b>',
6-
'commit' => '[:commit] :commit_message - bởi <i>:commit_by</i>',
7-
'pusher' => '👤 Đẩy lên bởi: : <b>:name</b>',
8-
],
4+
'title' => '<b>:count</b> :noun mới trong <b>:repo:<code>:branch</code></b>',
5+
'commit' => '[:commit] :commit_message - bởi <i>:commit_by</i>',
6+
'pusher' => 'Đẩy lên bởi: : <b>:name</b>',
7+
'new_branch_title' => '<b>Một nhánh mới đã được tạo trong dự án</b> :repo',
98
];

resources/views/events/gitlab/push/default.blade.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,35 @@
88
99
$ref = explode('/', $payload->ref);
1010
$branch = implode('/', array_slice($ref, 2));
11+
$repo = "🦊<a href='{$payload->project->web_url}'>{$payload->project->path_with_namespace}</a>";
1112
?>
12-
13-
👷⚙️ {!! __('tg-notifier::events/gitlab/push.default.title', [
13+
@if(empty($payload->commits)) {{-- New branch created --}}
14+
🎊 {!! __('tg-notifier::events/gitlab/push.new_branch_title', [
15+
'repo' => $repo,
16+
]) !!}
17+
@else
18+
👷⚙️ {!! __('tg-notifier::events/gitlab/push.title', [
1419
'count' => $count,
1520
'noun' => $noun,
16-
'repo' => "🦑<a href='{$payload->project->web_url}'>{$payload->project->path_with_namespace}</a>",
21+
'repo' => $repo,
1722
'branch' => $branch,
1823
]) !!}
1924

2025
@foreach($payload->commits as $commit)
2126
@php
2227
$commitId = substr($commit->id, -7);
28+
29+
$commit->message = $commit->message ?? '';
30+
$commit->message = explode("\n", $commit->message)[0];
2331
@endphp
24-
{!! __('tg-notifier::events/gitlab/push.default.commit', [
32+
{!! __('tg-notifier::events/gitlab/push.commit', [
2533
'commit' => "<a href='$commit->url'>$commitId</a>",
2634
'commit_message' => $commit->message,
2735
'commit_by' => $commit->author->name,
2836
]) !!}
37+
2938
@endforeach
39+
@endif
3040

31-
{!! __('tg-notifier::events/gitlab/push.default.pusher', ['name' => $payload->user_name]) !!}
41+
🌲 {{ __('tg-notifier::app.branch') }}: <code>{{ $branch }}</code>
42+
👤 {!! __('tg-notifier::events/gitlab/push.pusher', ['name' => $payload->user_name]) !!}

0 commit comments

Comments
 (0)