Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update view template for some github events #41

Merged
merged 8 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/telegram-git-notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

/** Set the path to the view file */
'view' => [
'ignore-message' => env('IGNORE_MESSAGE', 'ignore-message'),

'namespace' => env('TGN_VIEW_NAMESPACE', 'tg-notifier'),

'default' => env(
Expand Down
20 changes: 20 additions & 0 deletions lang/de/events/github/pull_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,35 @@

return [
'review' => '👥 Reviewers: ',
'assigned' => [
'title' => '‍👷‍♂️🛠️ <b>Assigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been assigned in the pull request <b>:pullRequest</b>',
],
'closed' => [
'title' => ':title - 🦑:repo by :user',
'title_merged' => '✅ <b>Pull Request Merged</b>',
'title_closed' => '🚫 <b>Pull Request Closed</b>',
],
'labeled' => [
'title' => '‍👷‍♂️🛠️ <b>Labeled Pull Request</b> - 🦑:repo by :user',
],
'locked' => [
'title' => '‍👷‍♂️🛠️ <b>Locked Pull Request</b> - 🦑:repo by :user',
],
'opened' => [
'title' => '👷‍♂️🛠️ <b>New Pull Request</b> - 🦑:repo by :user',
],
'reopened' => [
'title' => '👷‍♂️🛠️ <b>Reopened Pull Request</b> - 🦑:repo by :user',
],
'unassigned' => [
'title' => '‍👷‍♂️🛠️ <b>Unassigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been unassigned in the pull request <b>:pullRequest</b>',
],
'unlabeled' => [
'title' => '‍👷‍♂️🛠️ <b>Unlabeled Pull Request</b> - 🦑:repo by :user',
],
'unlocked' => [
'title' => '‍👷‍♂️🛠️ <b>Unlocked Pull Request</b> - 🦑:repo by :user',
],
];
25 changes: 25 additions & 0 deletions lang/en/events/github/label.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
pxthinh marked this conversation as resolved.
Show resolved Hide resolved

return [
'created' => [
'title' => '💬 <b>New Label</b> ⚠️ - 🦑:repo by :user',
],
'deleted' => [
'title' => '🗑 <b>Label Deleted</b> - 🦑:repo by :user',
],
'edited' => [
'title' => '👷‍♂️🛠️ <b>Label has been edited</b> - 🦑:repo by :user',
'changes' => [
'title' => [
'name' => '📖 <b>Title</b> has been changed',
'from' => '📝 <b>From:</b> :title_from',
'to' => '🏷 <b>To:</b> :title_to',
],
'description' => [
'name' => '📖 <b>Description</b> has been changed',
'from' => '📝 <b>From:</b> :description_from',
'to' => '🏷 <b>To:</b> :description_to',
],
],
],
];
20 changes: 20 additions & 0 deletions lang/en/events/github/pull_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,35 @@

return [
'review' => '👥 Reviewers: ',
'assigned' => [
'title' => '‍👷‍♂️🛠️ <b>Assigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been assigned in the pull request <b>:pullRequest</b>',
],
'closed' => [
'title' => ':title - 🦑:repo by :user',
'title_merged' => '✅ <b>Pull Request Merged</b>',
'title_closed' => '🚫 <b>Pull Request Closed</b>',
],
'labeled' => [
'title' => '‍👷‍♂️🛠️ <b>Labeled Pull Request</b> - 🦑:repo by :user',
],
'locked' => [
'title' => '‍👷‍♂️🛠️ <b>Locked Pull Request</b> - 🦑:repo by :user',
],
'opened' => [
'title' => '👷‍♂️🛠️ <b>New Pull Request</b> - 🦑:repo by :user',
],
'reopened' => [
'title' => '👷‍♂️🛠️ <b>Reopened Pull Request</b> - 🦑:repo by :user',
],
'unassigned' => [
'title' => '‍👷‍♂️🛠️ <b>Unassigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been unassigned in the pull request <b>:pullRequest</b>',
],
'unlabeled' => [
'title' => '‍👷‍♂️🛠️ <b>Unlabeled Pull Request</b> - 🦑:repo by :user',
],
'unlocked' => [
'title' => '‍👷‍♂️🛠️ <b>Unlocked Pull Request</b> - 🦑:repo by :user',
],
];
20 changes: 20 additions & 0 deletions lang/ja/events/github/pull_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,35 @@

return [
'review' => '👥 Reviewers: ',
'assigned' => [
'title' => '‍👷‍♂️🛠️ <b>Assigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been assigned in the pull request <b>:pullRequest</b>',
],
'closed' => [
'title' => ':title - 🦑:repo by :user',
'title_merged' => '✅ <b>Pull Request Merged</b>',
'title_closed' => '🚫 <b>Pull Request Closed</b>',
],
'labeled' => [
'title' => '‍👷‍♂️🛠️ <b>Labeled Pull Request</b> - 🦑:repo by :user',
],
'locked' => [
'title' => '‍👷‍♂️🛠️ <b>Locked Pull Request</b> - 🦑:repo by :user',
],
'opened' => [
'title' => '👷‍♂️🛠️ <b>New Pull Request</b> - 🦑:repo by :user',
],
'reopened' => [
'title' => '👷‍♂️🛠️ <b>Reopened Pull Request</b> - 🦑:repo by :user',
],
'unassigned' => [
'title' => '‍👷‍♂️🛠️ <b>Unassigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been unassigned in the pull request <b>:pullRequest</b>',
],
'unlabeled' => [
'title' => '‍👷‍♂️🛠️ <b>Unlabeled Pull Request</b> - 🦑:repo by :user',
],
'unlocked' => [
'title' => '‍👷‍♂️🛠️ <b>Unlocked Pull Request</b> - 🦑:repo by :user',
],
];
20 changes: 20 additions & 0 deletions lang/vi/events/github/pull_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,35 @@

return [
'review' => '👥 Reviewers: ',
'assigned' => [
'title' => '‍👷‍♂️🛠️ <b>Assigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been assigned in the pull request <b>:pullRequest</b>',
],
'closed' => [
'title' => ':title - 🦑:repo by :user',
'title_merged' => '✅ <b>Pull Request Merged</b>',
'title_closed' => '🚫 <b>Pull Request Closed</b>',
],
'labeled' => [
'title' => '‍👷‍♂️🛠️ <b>Labeled Pull Request</b> - 🦑:repo by :user',
],
'locked' => [
'title' => '‍👷‍♂️🛠️ <b>Locked Pull Request</b> - 🦑:repo by :user',
],
'opened' => [
'title' => '👷‍♂️🛠️ <b>New Pull Request</b> - 🦑:repo by :user',
],
'reopened' => [
'title' => '👷‍♂️🛠️ <b>Reopened Pull Request</b> - 🦑:repo by :user',
],
'unassigned' => [
'title' => '‍👷‍♂️🛠️ <b>Unassigned Pull Request</b> - 🦑:repo by :user',
'body' => ':name has been unassigned in the pull request <b>:pullRequest</b>',
],
'unlabeled' => [
'title' => '‍👷‍♂️🛠️ <b>Unlabeled Pull Request</b> - 🦑:repo by :user',
],
'unlocked' => [
'title' => '‍👷‍♂️🛠️ <b>Unlocked Pull Request</b> - 🦑:repo by :user',
],
];
12 changes: 8 additions & 4 deletions resources/views/events/github/issue_comment/created.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
$issue = $payload->issue;
?>

@if(empty($issue->pull_request))
{!! __('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>"
]
) !!}
'issue' => "<a href='$issue->html_url'>{$payload->repository->full_name}#$issue->number</a>",
'user' => "<a href='{$issue->user->html_url}'>@{$issue->user->login}</a>"
]
) !!}

📢 <b>{{ $issue->title }}</b>

@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event'))
@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event'))
@else
{{ config('telegram-git-notifier.view.ignore-message') }}
@endif
4 changes: 4 additions & 0 deletions resources/views/events/github/issue_comment/deleted.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$issue = $payload->issue;
?>

@if(empty($issue->pull_request))
{!! __('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>"
Expand All @@ -17,3 +18,6 @@

@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event'))
@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event'))
@else
{{ config('telegram-git-notifier.view.ignore-message') }}
@endif
4 changes: 4 additions & 0 deletions resources/views/events/github/issue_comment/edited.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$issue = $payload->issue;
?>

@if(empty($issue->pull_request))
{!! __('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>"
Expand All @@ -17,3 +18,6 @@

@include('tg-notifier::events.shared.partials.github._assignees', compact('payload', 'event'))
@include('tg-notifier::events.shared.partials.github._body', compact('payload', 'event'))
@else
{{ config('telegram-git-notifier.view.ignore-message') }}
@endif
17 changes: 17 additions & 0 deletions resources/views/events/github/label/created.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* @var $payload object
*/
$label = $payload->label;
$description = strlen($label->description) > 50 ? $label->description : substr($label->description, 0, 50).'...';
?>

{!! __('tg-notifier::events/github/label.created.title', [
'repo' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>",
'user' => "<a href='{$payload->sender->html_url}'>@{$payload->sender->login}</a>",
]
) !!}

📢 <b>{{ $payload->label->name }}</b>
{{ $description }}
13 changes: 13 additions & 0 deletions resources/views/events/github/label/deleted.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* @var $payload object
*/
?>

{!! __('tg-notifier::events/github/label.deleted.title', [
'repo' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>",
'user' => "<a href='{$payload->sender->html_url}'>@{$payload->sender->login}</a>",
]
) !!}

📢 <b>{{ $payload->label->name }}</b>
34 changes: 34 additions & 0 deletions resources/views/events/github/label/edited.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* @var $payload object
*/
$changes = $payload->changes;
$label = $payload->label;
$description = strlen($label->description) < 50 ? $label->description : substr($label->description, 0, 50).'...';
if (isset($changes->description->from)) {
$description_changes = strlen($changes->description->from) < 50 ? $changes->description->from : substr($changes->description->from, 0, 50).'...';
}
?>

{!! __('tg-notifier::events/github/label.edited.title', [
'repo' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>",
'user' => "<a href='{$payload->sender->html_url}'>@{$payload->sender->login}</a>",
]
) !!}

@if(isset($changes->name->from))
{!! __('tg-notifier::events/github/label.edited.changes.title.name') !!}
{!! __('tg-notifier::events/github/label.edited.changes.title.from', ['title_from' => $payload->changes->name->from]) !!}
{!! __('tg-notifier::events/github/label.edited.changes.title.to', ['title_to' => $payload->label->name]) !!}
@else
📢 <b>{{ $label->name }}</b>
@endif

@if(isset($changes->description->from))
{!! __('tg-notifier::events/github/label.edited.changes.description.name') !!}
{!! __('tg-notifier::events/github/label.edited.changes.description.from', ['description_from' => $description_changes]) !!}
{!! __('tg-notifier::events/github/label.edited.changes.description.to', ['description_to' => $description]) !!}
@else
{{ $description }}
@endif
19 changes: 19 additions & 0 deletions resources/views/events/github/pull_request/assigned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* @var $payload object
*/
$pull_request = $payload->pull_request;
?>

{!! __('tg-notifier::events/github/pull_request.assigned.title', [
'repo' => "<a href='$pull_request->html_url'>{$payload->repository->full_name}#$pull_request->number</a>",
'user' => "<a href='{$pull_request->user->html_url}'>@{$pull_request->user->login}</a>",
]
) !!}

{!! __('tg-notifier::events/github/pull_request.assigned.body', [
'name' => "<a href='{$payload->assignee->html_url}'>@{$payload->assignee->login}</a>",
'pullRequest' => "$pull_request->title",
]
) !!}
17 changes: 17 additions & 0 deletions resources/views/events/github/pull_request/labeled.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* @var $payload object
*/

$pull_request = $payload->pull_request;
$description = strlen($payload->label->description) > 50 ? $payload->label->description : substr($payload->label->description, 0, 50).'...';
?>

{!! __('tg-notifier::events/github/pull_request.labeled.title', [
'repo' => "<a href='$pull_request->html_url'>{$payload->repository->full_name}#$pull_request->number</a>",
'user' => "<a href='{$pull_request->user->html_url}'>@{$pull_request->user->login}</a>",
]
) !!}

📢 <b>{{ $payload->label->name }}</b>
{{ $description }}
15 changes: 15 additions & 0 deletions resources/views/events/github/pull_request/locked.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* @var $payload object
*/

$pull_request = $payload->pull_request;
?>

{!! __('tg-notifier::events/github/pull_request.locked.title', [
'repo' => "<a href='$pull_request->html_url'>{$payload->repository->full_name}#$pull_request->number</a>",
'user' => "<a href='{$pull_request->user->html_url}'>@{$pull_request->user->login}</a>"
]
) !!}

📢 <b>{{ $pull_request->title }}</b>
19 changes: 19 additions & 0 deletions resources/views/events/github/pull_request/unassigned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* @var $payload object
*/

$pull_request = $payload->pull_request;
?>

{!! __('tg-notifier::events/github/pull_request.unassigned.title', [
'repo' => "<a href='$pull_request->html_url'>{$payload->repository->full_name}#$pull_request->number</a>",
'user' => "<a href='{$pull_request->user->html_url}'>@{$pull_request->user->login}</a>"
]
) !!}

{!! __('tg-notifier::events/github/pull_request.unassigned.body', [
'name' => "<a href='{$payload->assignee->html_url}'>@{$payload->assignee->login}</a>",
'pullRequest' => "$pull_request->title",
]
) !!}
16 changes: 16 additions & 0 deletions resources/views/events/github/pull_request/unlabeled.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* @var $payload object
*/

$pull_request = $payload->pull_request;
?>

{!! __('tg-notifier::events/github/pull_request.unlabeled.title', [
'repo' => "<a href='$pull_request->html_url'>{$payload->repository->full_name}#$pull_request->number</a>",
'user' => "<a href='{$pull_request->user->html_url}'>@{$pull_request->user->login}</a>",
]
) !!}

📢 <b>{{ $payload->label->name }}</b>
{{ substr($payload->label->description, 0, 50).'...' }}
Loading