Skip to content

Commit a1b33f5

Browse files
committed
fix: update some view template for event
- push event on github - feature flat event on gitlab
1 parent 5e54bba commit a1b33f5

File tree

9 files changed

+45
-17
lines changed

9 files changed

+45
-17
lines changed

lang/de/events/github/push.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'default' => [
55
'title' => '👷⚙️ <b>:count</b> new :noun to 🦑<b>:user:<code>:branch</code></b>',
6-
'commit' => ':commit: :commit_message - by <i>:commit_name</i>',
6+
'commit' => ':commit: :commit_message - by <i>:commit_by</i>',
77
'pushed' => '👤 Pushed by : <b>:name</b>',
88
],
99
];

lang/en/events/github/push.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'default' => [
55
'title' => '👷⚙️ <b>:count</b> new :noun to 🦑<b>:user:<code>:branch</code></b>',
6-
'commit' => ':commit: :commit_message - by <i>:commit_name</i>',
6+
'commit' => '[:commit] :commit_message - by <i>:commit_by</i>',
77
'pushed' => '👤 Pushed by : <b>:name</b>',
88
],
99
];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
return [
4+
'title' => [
5+
'enabled' => '<b>Feature Flag Enabled</b> 🦊:flag_tag by :user_tag',
6+
'disabled' => '<b>Feature Flag Disabled</b> 🦊:flag_tag by :user_tag',
7+
],
8+
'name' => 'Name: <b>:flag_name</b>',
9+
];

lang/en/events/shared/gitlab.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return [
4+
'_body' => [
5+
'title' => '📖 <b>Content:</b>',
6+
],
7+
'_assignee' => [
8+
'title' => '🙋 Assignee: ',
9+
],
10+
];

lang/ja/events/github/push.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'default' => [
55
'title' => '👷⚙️ <b>:count</b> new :noun to 🦑<b>:user:<code>:branch</code></b>',
6-
'commit' => ':commit: :commit_message - by <i>:commit_name</i>',
6+
'commit' => ':commit: :commit_message - by <i>:commit_by</i>',
77
'pushed' => '👤 Pushed by : <b>:name</b>',
88
],
99
];

lang/vi/events/github/push.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'default' => [
55
'title' => '👷⚙️ <b>:count</b> new :noun to 🦑<b>:user:<code>:branch</code></b>',
6-
'commit' => ':commit: :commit_message - by <i>:commit_name</i>',
6+
'commit' => ':commit: :commit_message - by <i>:commit_by</i>',
77
'pushed' => '👤 Pushed by : <b>:name</b>',
88
],
99
];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{!! __('tg-notifier::events/github/push.default.commit', [
2626
'commit' => "<a href='$commit->url'>$commitId</a>",
2727
'commit_message' => $commit->message,
28-
'commit_name' => $commit->author->name,
28+
'commit_by' => $commit->author->name,
2929
]
3030
) !!}
3131
@endforeach
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
<?php
22
/**
33
* @var $payload mixed
4+
* @var $event string
45
*/
56
7+
$flagUrl = $payload->project->web_url."/-/feature_flags/".$payload->object_attributes->id;
8+
$flatTag = "<a href=\"{$flagUrl}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->name}</a>";
9+
$userTag = "<a href=\"{$payload->user_url}\">{$payload->user->name}</a>";
10+
611
if ($payload->object_attributes->active) {
7-
$active = "Enabled";
12+
$active = "enabled";
813
$icon = "🚩";
914
} else {
10-
$active = "Disabled";
15+
$active = "disabled";
1116
$icon = "🏴";
1217
}
18+
?>
1319

14-
$flagUrl = $payload->project->web_url . "/-/feature_flags/" . $payload->object_attributes->id;
15-
16-
$message = "{$icon} <b>Feature Flag {$active}</b> - 🦊<a href=\"{$flagUrl}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->name}</a> by <a href=\"{$payload->user_url}\">{$payload->user->name}</a>\n\n";
17-
18-
$message .= "{$icon} Name: <b>{$payload->object_attributes->name}</b> \n\n";
20+
{!! $icon !!} {!! __('tg-notifier::events/gitlab/feature_flag.title'.$active, [
21+
'flag_tag' => $flagTag,
22+
'user_tag' => $userTag,
23+
]) !!}
1924

20-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
25+
{!! $icon !!} {!! __('tg-notifier::events/gitlab/feature_flag.name', ['flag_name' => $payload->object_attributes->name]) !!}
2126

22-
echo $message;
27+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22
/**
33
* @var $payload mixed
4+
* @var $event string
45
*/
56
7+
$html = '';
68
if (isset($event) && isset($payload)) {
79
if (!empty($payload->object_attributes->description)) {
810
$body = $payload->object_attributes->description;
@@ -21,7 +23,9 @@
2123
$body = substr($body, 0, 50) . '...';
2224
}
2325
24-
return "📖 <b>Content:</b>\n{$body}";
26+
$html = __('tg-notifier::events/shared/gitlab._body.title', ['body' => $body])
27+
."\n"
28+
.htmlentities($body);
2529
}
26-
27-
return '';
30+
?>
31+
{!! $html !!}

0 commit comments

Comments
 (0)