Skip to content

Commit

Permalink
Merge pull request #24 from pxthinh/feature/view_template
Browse files Browse the repository at this point in the history
update view and lang for issue event
  • Loading branch information
tanhongit authored Nov 17, 2023
2 parents a531fd5 + 5c21ad8 commit e20a444
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 48 deletions.
35 changes: 35 additions & 0 deletions lang/en/events/github/issues.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,39 @@
'closed' => [
'title' => '🚫 <b>Issue Closed </b> to 🦑 :issue by :user',
],
'deleted' => [
'title' => '🗑 <b>Issue Deleted</b> form 🦑 :issue by :user',
],
'edited' => [
'title' => '⚠️ <b>Issue has been edited</b> to 🦑 :issue by :user',
'changes' => [
'title' => [
'name' => '📖 <b>Title</b> has been changed',
'from' => '📝 <b>From:</b> :title_from',
'to' => '🏷 <b>To:</b> :title_to',
],
'body' => [
'title' => '📖 <b>Body</b> has been changed',
'message' => 'Please check the issue for more details',
],
],
],
'locked' => [
'title' => '🔒 <b>Issue Locked</b> form 🦑 :issue by :user',
],
'opened' => [
'title' => '⚠️ <b>New Issue</b> to 🦑 :issue by :user',
],
'pinned' => [
'title' => '📌 <b>Issue Pinned</b> form 🦑 :issue by :user',
],
'reopened' => [
'title' => '⚠️ <b>Issue has been reopened</b> ⚠️ to 🦑 :issue by :user',
],
'unlocked' => [
'title' => '🔐 <b>Issue Unlocked</b> form 🦑 :issue by :user',
],
'unpinned' => [
'title' => '🔔 <b>Issue Unpinned</b> form 🦑 :issue by :user',
],
];
3 changes: 3 additions & 0 deletions lang/en/events/shared/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
'_body' => [
'title' => '📖 <b>Content:</b>',
],
'_assignee' => [
'title' => '🙋 Assignee: ',
],
];
16 changes: 12 additions & 4 deletions resources/views/events/github/issues/deleted.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "️🗑 <b>Issue Deleted</b> form 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

echo $message;
@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event'))

@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event'))
31 changes: 18 additions & 13 deletions resources/views/events/github/issues/edited.blade.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "⚠️ <b>Issue has been edited</b> to 🦑<a href=\"{$payload->issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number}</a> by <a href=\"{$payload->issue->user->html_url}\">@{$payload->issue->user->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

if (isset($payload->changes->title)) {
$message .= "📖 <b>Title</b> has been changed\n";
$message .= " 📝 <b>From:</b> {$payload->changes->title->from}\n";
$message .= " 🏷 <b>To:</b> {$payload->issue->title}\n";
} elseif (isset($payload->changes->body)) {
$message .= "📖 <b>Body</b> has been changed\n";
$message .= "Please check the issue for more details\n";
}
echo $message;
@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event'))
@if(isset($payload->changes->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.message') !!}
@endif
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/locked.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "🔒 <b>Issue Locked</b> form 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.locked.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/opened.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "⚠️ <b>New Issue</b> to 🦑<a href=\"{$payload->issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number}</a> by <a href=\"{$payload->issue->user->html_url}\">@{$payload->issue->user->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.opened.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/pinned.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "📌 <b>Issue Pinned</b> form 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.pinned.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/reopened.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "⚠️ <b>Issue has been reopened</b> ⚠️ to 🦑<a href=\"{$payload->issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number}</a> by <a href=\"{$payload->issue->user->html_url}\">@{$payload->issue->user->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.reopened.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/unlocked.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "🔐 <b>Issue Unlocked</b> form 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.unlocked.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
16 changes: 11 additions & 5 deletions resources/views/events/github/issues/unpinned.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* @var $payload mixed
* @var $event string
*/
$message = "🔔 <b>Issue Unpinned</b> form 🦑<a href=\"{$payload->repository->html_url}\">{$payload->repository->full_name} </a> by <a href=\"{$payload->sender->html_url}\">@{$payload->sender->login}</a>\n\n";
$issue = $payload->issue;
?>

$message .= "📢 <b>{$payload->issue->title}</b>\n";
{!! __('tg-notifier::events/github/issues.unpinned.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 .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
{!! __('tg-notifier::events/github/issues.issue_title') !!} <b><?= $issue->title; ?></b>

$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'))
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = "<a href=\"{$assignee->html_url}\">@{$assignee->login}</a> ";
Expand Down

0 comments on commit e20a444

Please sign in to comment.