From e641f786970ddb74194058720444e2a392fce96c Mon Sep 17 00:00:00 2001 From: pxthinh Date: Fri, 17 Nov 2023 23:38:25 +0700 Subject: [PATCH] feat: update view and lang for issue comment event and ping --- lang/en/events/github/issue_comment.php | 14 +++++++++++ lang/en/events/github/ping.php | 10 ++++++++ .../github/issue_comment/created.blade.php | 18 +++++++------ .../github/issue_comment/deleted.blade.php | 18 +++++++------ .../github/issue_comment/edited.blade.php | 18 +++++++------ .../events/github/ping/default.blade.php | 25 ++++++++----------- 6 files changed, 68 insertions(+), 35 deletions(-) create mode 100644 lang/en/events/github/issue_comment.php create mode 100644 lang/en/events/github/ping.php diff --git a/lang/en/events/github/issue_comment.php b/lang/en/events/github/issue_comment.php new file mode 100644 index 0000000..5f972d7 --- /dev/null +++ b/lang/en/events/github/issue_comment.php @@ -0,0 +1,14 @@ + '📢', + 'created' => [ + 'title' => '💬 New Issue Comment ⚠️ to 🦑 :issue by :user', + ], + 'deleted' => [ + 'title' => '🗑 Issue Comment Deleted 💬 from 🦑 :issue by :user', + ], + 'edited' => [ + 'title' => '📝 Issue Comment Edited 💬 in 🦑 :issue by :user', + ], +]; diff --git a/lang/en/events/github/ping.php b/lang/en/events/github/ping.php new file mode 100644 index 0000000..7d9d2b9 --- /dev/null +++ b/lang/en/events/github/ping.php @@ -0,0 +1,10 @@ + [ + 'title' => '♻️ Connection Successful', + 'organization' => '🏢 Organization: :organization', + 'full_name' => '📦 Repository: 🦑:full_name', + 'sender' => '👤 Sender (triggered the event): :sender', + ], +]; diff --git a/resources/views/events/github/issue_comment/created.blade.php b/resources/views/events/github/issue_comment/created.blade.php index 9de1023..903bd0a 100644 --- a/resources/views/events/github/issue_comment/created.blade.php +++ b/resources/views/events/github/issue_comment/created.blade.php @@ -1,16 +1,20 @@ issue; +?> -$message = "💬 New Issue Comment ⚠️ to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by comment->user->html_url}\">@{$payload->comment->user->login}\n\n"; +{!! __('tg-notifier::events/github/issue_comment.created.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; - -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issue_comment/deleted.blade.php b/resources/views/events/github/issue_comment/deleted.blade.php index 3e20ec5..e799881 100644 --- a/resources/views/events/github/issue_comment/deleted.blade.php +++ b/resources/views/events/github/issue_comment/deleted.blade.php @@ -1,16 +1,20 @@ issue; +?> -$message = "️🗑 Issue Comment Deleted 💬 from 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +{!! __('tg-notifier::events/github/issue_comment.deleted.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; - -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issue_comment/edited.blade.php b/resources/views/events/github/issue_comment/edited.blade.php index d544192..749d1d9 100644 --- a/resources/views/events/github/issue_comment/edited.blade.php +++ b/resources/views/events/github/issue_comment/edited.blade.php @@ -1,16 +1,20 @@ issue; +?> -$message = "️📝 Issue Comment Edited 💬 in 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by comment->user->html_url}\">@{$payload->comment->user->login}\n\n"; +{!! __('tg-notifier::events/github/issue_comment.edited.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; - -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/ping/default.blade.php b/resources/views/events/github/ping/default.blade.php index 70f7454..181ee15 100644 --- a/resources/views/events/github/ping/default.blade.php +++ b/resources/views/events/github/ping/default.blade.php @@ -2,19 +2,16 @@ /** * @var $payload mixed */ +?> -$message = "♻️ Connection Successful\n\n"; +{!! __('tg-notifier::events/github/ping.default.title') !!} -if (isset($payload->organization)) { - $message .= "🏢 Organization: {$payload->organization->login}\n"; -} - -if (isset($payload->repository)) { - $message .= "📦 Repository: 🦑{$payload->repository->full_name}\n"; -} - -if (isset($payload->sender)) { - $message .= "👤 Sender (triggered the event): {$payload->sender->login}\n"; -} - -echo $message; +@if(isset($payload->organization)) +{!! __('tg-notifier::events/github/ping.default.organization', ['organization' => $payload->organization->login]) !!} +@endif +@if(isset($payload->repository)) +{!! __('tg-notifier::events/github/ping.default.full_name', ['full_name' => $payload->repository->full_name]) !!} +@endif +@if(isset($payload->sender)) +{!! __('tg-notifier::events/github/ping.default.sender', ['sender' => $payload->sender->login]) !!} +@endif