From a3521524c9f213cb0611c17e65bedbbdb705896b Mon Sep 17 00:00:00 2001 From: pxthinh Date: Thu, 16 Nov 2023 22:46:16 +0700 Subject: [PATCH 1/3] feat: update view and lang for issue event --- lang/en/events/github/issues.php | 24 +++++++++++++++ .../events/github/issues/deleted.blade.php | 16 +++++++--- .../events/github/issues/edited.blade.php | 30 +++++++++++-------- .../events/github/issues/locked.blade.php | 16 ++++++---- .../events/github/issues/opened.blade.php | 16 ++++++---- .../events/github/issues/pinned.blade.php | 16 ++++++---- .../events/github/issues/reopened.blade.php | 16 ++++++---- .../events/github/issues/unlocked.blade.php | 16 ++++++---- .../events/github/issues/unpinned.blade.php | 16 ++++++---- 9 files changed, 120 insertions(+), 46 deletions(-) diff --git a/lang/en/events/github/issues.php b/lang/en/events/github/issues.php index ac99d7b..649cfda 100644 --- a/lang/en/events/github/issues.php +++ b/lang/en/events/github/issues.php @@ -5,4 +5,28 @@ 'closed' => [ 'title' => '🚫 Issue Closed to 🦑 :issue by :user', ], + 'deleted' => [ + 'title' => '🗑 Issue Deleted form 🦑 :issue by :user', + ], + 'edited' => [ + 'title' => '⚠️ Issue has been edited to 🦑 :issue by :user', + ], + 'locked' => [ + 'title' => '🔒 Issue Locked form 🦑 :issue by :user', + ], + 'opened' => [ + 'title' => '⚠️ New Issue to 🦑 :issue by :user', + ], + 'pinned' => [ + 'title' => '📌 Issue Pinned form 🦑 :issue by :user', + ], + 'reopened' => [ + 'title' => '⚠️ Issue has been reopened ⚠️ to 🦑 :issue by :user', + ], + 'unlocked' => [ + 'title' => '🔐 Issue Unlocked form 🦑 :issue by :user', + ], + 'unpinned' => [ + 'title' => '🔔 Issue Unpinned form 🦑 :issue by :user', + ], ]; diff --git a/resources/views/events/github/issues/deleted.blade.php b/resources/views/events/github/issues/deleted.blade.php index 6243ff6..a04857d 100644 --- a/resources/views/events/github/issues/deleted.blade.php +++ b/resources/views/events/github/issues/deleted.blade.php @@ -1,12 +1,20 @@ Issue Deleted form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.deleted.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -echo $message; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) + +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/edited.blade.php b/resources/views/events/github/issues/edited.blade.php index bfd0259..115c855 100644 --- a/resources/views/events/github/issues/edited.blade.php +++ b/resources/views/events/github/issues/edited.blade.php @@ -1,21 +1,27 @@ Issue has been edited to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.edited.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -if (isset($payload->changes->title)) { - $message .= "📖 Title has been changed\n"; - $message .= " 📝 From: {$payload->changes->title->from}\n"; - $message .= " 🏷 To: {$payload->issue->title}\n"; -} elseif (isset($payload->changes->body)) { - $message .= "📖 Body has been changed\n"; - $message .= "Please check the issue for more details\n"; -} +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@if(isset($payload->changes->title)) + {!! "📖 Title has been changed\n" !!} + {!! " 📝 From: {$payload->changes->title->from}\n" !!} + {!! " 🏷 To: {$payload->issue->title}\n" !!} +@elseif(isset($payload->changes->body)) + {!! "📖 Body has been changed\n"!!} + {!! "Please check the issue for more details\n"!!} +@endif diff --git a/resources/views/events/github/issues/locked.blade.php b/resources/views/events/github/issues/locked.blade.php index b4dd435..7c2e722 100644 --- a/resources/views/events/github/issues/locked.blade.php +++ b/resources/views/events/github/issues/locked.blade.php @@ -1,14 +1,20 @@ Issue Locked form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.locked.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/opened.blade.php b/resources/views/events/github/issues/opened.blade.php index 8783af8..41c4b73 100644 --- a/resources/views/events/github/issues/opened.blade.php +++ b/resources/views/events/github/issues/opened.blade.php @@ -1,14 +1,20 @@ New Issue to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.opened.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/pinned.blade.php b/resources/views/events/github/issues/pinned.blade.php index a65aa38..5ef633d 100644 --- a/resources/views/events/github/issues/pinned.blade.php +++ b/resources/views/events/github/issues/pinned.blade.php @@ -1,14 +1,20 @@ Issue Pinned form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.pinned.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/reopened.blade.php b/resources/views/events/github/issues/reopened.blade.php index 3de4cd4..c8ca1a2 100644 --- a/resources/views/events/github/issues/reopened.blade.php +++ b/resources/views/events/github/issues/reopened.blade.php @@ -1,14 +1,20 @@ Issue has been reopened ⚠️ to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.reopened.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/unlocked.blade.php b/resources/views/events/github/issues/unlocked.blade.php index e29739f..7bc8759 100644 --- a/resources/views/events/github/issues/unlocked.blade.php +++ b/resources/views/events/github/issues/unlocked.blade.php @@ -1,14 +1,20 @@ Issue Unlocked form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.unlocked.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) diff --git a/resources/views/events/github/issues/unpinned.blade.php b/resources/views/events/github/issues/unpinned.blade.php index 33cec4f..0a8e287 100644 --- a/resources/views/events/github/issues/unpinned.blade.php +++ b/resources/views/events/github/issues/unpinned.blade.php @@ -1,14 +1,20 @@ Issue Unpinned form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n"; +$issue = $payload->issue; +?> -$message .= "📢 {$payload->issue->title}\n"; +{!! __('tg-notifier::events/github/issues.unpinned.title', [ + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] + ) !!} -$message .= require __DIR__ . '/../../shared/partials/github/_assignees.php'; +{!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> -$message .= require __DIR__ . '/../../shared/partials/github/_body.php'; +@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) -echo $message; +@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event')) From 133da2761fc4fa09692606092b3b10f3fa6a8998 Mon Sep 17 00:00:00 2001 From: pxthinh Date: Thu, 16 Nov 2023 23:31:34 +0700 Subject: [PATCH 2/3] fix: add to the translation for edited --- lang/en/events/github/issues.php | 11 +++++++++++ resources/views/events/github/issues/edited.blade.php | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lang/en/events/github/issues.php b/lang/en/events/github/issues.php index 649cfda..7beb0f4 100644 --- a/lang/en/events/github/issues.php +++ b/lang/en/events/github/issues.php @@ -10,6 +10,17 @@ ], 'edited' => [ 'title' => '⚠️ Issue has been edited to 🦑 :issue by :user', + 'changes' => [ + 'title' => [ + 'title' => '📖 Title has been changed', + 'from' => ' 📝 From: :title_from', + 'to' => ' 🏷 To: :title_to', + ], + 'body' => [ + 'title' => '📖 Body has been changed', + 'body' => 'Please check the issue for more details', + ] + ] ], 'locked' => [ 'title' => '🔒 Issue Locked form 🦑 :issue by :user', diff --git a/resources/views/events/github/issues/edited.blade.php b/resources/views/events/github/issues/edited.blade.php index 115c855..a983584 100644 --- a/resources/views/events/github/issues/edited.blade.php +++ b/resources/views/events/github/issues/edited.blade.php @@ -18,10 +18,10 @@ @include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) @if(isset($payload->changes->title)) - {!! "📖 Title has been changed\n" !!} - {!! " 📝 From: {$payload->changes->title->from}\n" !!} - {!! " 🏷 To: {$payload->issue->title}\n" !!} + {!! __('tg-notifier::events/github/issues.edited.changes.title.title') !!} + {!! __('tg-notifier::events/github/issues.edited.changes.title.from', ['title_from' => $payload->changes->title->from]) !!} + {!! __('tg-notifier::events/github/issues.edited.changes.title.to', ['title_to' => $payload->issue->title]) !!} @elseif(isset($payload->changes->body)) - {!! "📖 Body has been changed\n"!!} - {!! "Please check the issue for more details\n"!!} + {!! __('tg-notifier::events/github/issues.edited.changes.body.title')!!} + {!! __('tg-notifier::events/github/issues.edited.changes.body.body')!!} @endif From 5c21ad843a322be9d273a08016b8dd7a63db3ebf Mon Sep 17 00:00:00 2001 From: pxthinh Date: Fri, 17 Nov 2023 21:36:23 +0700 Subject: [PATCH 3/3] fix: update to the translation for edited --- lang/en/events/github/issues.php | 12 ++++++------ lang/en/events/shared/github.php | 3 +++ .../views/events/github/issues/edited.blade.php | 7 +++---- .../shared/partials/github/_assignees.blade.php | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lang/en/events/github/issues.php b/lang/en/events/github/issues.php index 7beb0f4..87cff4a 100644 --- a/lang/en/events/github/issues.php +++ b/lang/en/events/github/issues.php @@ -12,15 +12,15 @@ 'title' => '⚠️ Issue has been edited to 🦑 :issue by :user', 'changes' => [ 'title' => [ - 'title' => '📖 Title has been changed', - 'from' => ' 📝 From: :title_from', - 'to' => ' 🏷 To: :title_to', + 'name' => '📖 Title has been changed', + 'from' => '📝 From: :title_from', + 'to' => '🏷 To: :title_to', ], 'body' => [ 'title' => '📖 Body has been changed', - 'body' => 'Please check the issue for more details', - ] - ] + 'message' => 'Please check the issue for more details', + ], + ], ], 'locked' => [ 'title' => '🔒 Issue Locked form 🦑 :issue by :user', diff --git a/lang/en/events/shared/github.php b/lang/en/events/shared/github.php index 782d6b6..ce3f29f 100644 --- a/lang/en/events/shared/github.php +++ b/lang/en/events/shared/github.php @@ -4,4 +4,7 @@ '_body' => [ 'title' => '📖 Content:', ], + '_assignee' => [ + 'title' => '🙋 Assignee: ', + ], ]; diff --git a/resources/views/events/github/issues/edited.blade.php b/resources/views/events/github/issues/edited.blade.php index a983584..f3826ac 100644 --- a/resources/views/events/github/issues/edited.blade.php +++ b/resources/views/events/github/issues/edited.blade.php @@ -16,12 +16,11 @@ {!! __('tg-notifier::events/github/issues.issue_title') !!} title; ?> @include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event')) - @if(isset($payload->changes->title)) - {!! __('tg-notifier::events/github/issues.edited.changes.title.title') !!} +{!! __('tg-notifier::events/github/issues.edited.changes.title.name') !!} {!! __('tg-notifier::events/github/issues.edited.changes.title.from', ['title_from' => $payload->changes->title->from]) !!} {!! __('tg-notifier::events/github/issues.edited.changes.title.to', ['title_to' => $payload->issue->title]) !!} @elseif(isset($payload->changes->body)) - {!! __('tg-notifier::events/github/issues.edited.changes.body.title')!!} - {!! __('tg-notifier::events/github/issues.edited.changes.body.body')!!} +{!! __('tg-notifier::events/github/issues.edited.changes.body.title') !!} +{!! __('tg-notifier::events/github/issues.edited.changes.body.message') !!} @endif diff --git a/resources/views/events/shared/partials/github/_assignees.blade.php b/resources/views/events/shared/partials/github/_assignees.blade.php index 6220e0a..6fa61b0 100644 --- a/resources/views/events/shared/partials/github/_assignees.blade.php +++ b/resources/views/events/shared/partials/github/_assignees.blade.php @@ -5,7 +5,7 @@ */ if (isset($event) && isset($payload) && !empty($payload->{$event}->assignees)) { - $assigneeText = "🙋 Assignee: "; + $assigneeText = __('tg-notifier::events/shared/github._assignee.title'); $assigneeArray = []; foreach ($payload->{$event}->assignees as $assignee) { $assigneeArray[] = "html_url}\">@{$assignee->login} ";