Skip to content

Commit

Permalink
feat: update view and lang for issue comment event and ping
Browse files Browse the repository at this point in the history
  • Loading branch information
pxthinh committed Nov 17, 2023
1 parent 5c21ad8 commit e641f78
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 35 deletions.
14 changes: 14 additions & 0 deletions lang/en/events/github/issue_comment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

return [
'issue_comment_title' => '📢',
'created' => [
'title' => '💬 <b>New Issue Comment</b> ⚠️ to 🦑 :issue by :user',
],
'deleted' => [
'title' => '🗑 <b>Issue Comment Deleted</b> 💬 from 🦑 :issue by :user',
],
'edited' => [
'title' => '📝 <b>Issue Comment Edited</b> 💬 in 🦑 :issue by :user',
],
];
10 changes: 10 additions & 0 deletions lang/en/events/github/ping.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
'default' => [
'title' => '♻️ <b>Connection Successful</b>',
'organization' => '🏢 Organization: <b>:organization</b>',
'full_name' => '📦 Repository: 🦑<b>:full_name</b>',
'sender' => '👤 Sender (triggered the event): <b>:sender</b>',
],
];
18 changes: 11 additions & 7 deletions resources/views/events/github/issue_comment/created.blade.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$event = 'comment';
$issue = $payload->issue;
?>

$message = "💬 <b>New Issue Comment</b> ⚠️ to 🦑<a href=\"{$payload->issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number}</a> by <a href=\"{$payload->comment->user->html_url}\">@{$payload->comment->user->login}</a>\n\n";
{!! __('tg-notifier::events/github/issue_comment.created.title', [
'issue' => "<a href='$issue->html_url'>{$payload->repository->full_name}#$issue->number</a>",
'user' => "<a href='{$issue->user->html_url}'>@{$issue->user->login}</a>"
]
) !!}

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} <b><?= $issue->title; ?></b>

$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'))
18 changes: 11 additions & 7 deletions resources/views/events/github/issue_comment/deleted.blade.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$event = 'comment';
$issue = $payload->issue;
?>

$message = "️🗑 <b>Issue Comment Deleted</b> 💬 from 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
{!! __('tg-notifier::events/github/issue_comment.deleted.title', [
'issue' => "<a href='$issue->html_url'>{$payload->repository->full_name}#$issue->number</a>",
'user' => "<a href='{$issue->user->html_url}'>@{$issue->user->login}</a>"
]
) !!}

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} <b><?= $issue->title; ?></b>

$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'))
18 changes: 11 additions & 7 deletions resources/views/events/github/issue_comment/edited.blade.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$event = 'comment';
$issue = $payload->issue;
?>

$message = "️📝 <b>Issue Comment Edited</b> 💬 in 🦑<a href=\"{$payload->issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number}</a> by <a href=\"{$payload->comment->user->html_url}\">@{$payload->comment->user->login}</a>\n\n";
{!! __('tg-notifier::events/github/issue_comment.edited.title', [
'issue' => "<a href='$issue->html_url'>{$payload->repository->full_name}#$issue->number</a>",
'user' => "<a href='{$issue->user->html_url}'>@{$issue->user->login}</a>"
]
) !!}

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issue_comment.issue_comment_title') !!} <b><?= $issue->title; ?></b>

$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'))
25 changes: 11 additions & 14 deletions resources/views/events/github/ping/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
/**
* @var $payload mixed
*/
?>

$message = "♻️ <b>Connection Successful</b>\n\n";
{!! __('tg-notifier::events/github/ping.default.title') !!}

if (isset($payload->organization)) {
$message .= "🏢 Organization: <b>{$payload->organization->login}</b>\n";
}
if (isset($payload->repository)) {
$message .= "📦 Repository: 🦑<b>{$payload->repository->full_name}</b>\n";
}
if (isset($payload->sender)) {
$message .= "👤 Sender (triggered the event): <b>{$payload->sender->login}</b>\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

0 comments on commit e641f78

Please sign in to comment.