Skip to content

Fix/update Gitlab event template #72

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

Merged
merged 10 commits into from
May 12, 2024
Merged
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## 📝 Introduction

Laravel Telegram Git Notifier is a package that allows you to create a Telegram bot to receive notifications from GitHub
Laravel Telegram Git Notifier is a Laravel package that allows you to create a Telegram bot to receive notifications from GitHub
or GitLab events and manage customization through messages and buttons on Telegram.

- Send notifications of your GitHub/GitLab repositories to Telegram Bots, Groups, Super Groups (Multiple Topics), and
Expand Down Expand Up @@ -58,13 +58,12 @@ information.
- [x] Issue Comment
- [x] Pull Request
- [x] Pull Request Review
- [x] Pull Request Review Comment
- [x] Fork
- [x] Commit Comment
- [x] Deployment
- [x] Deployment Status
- [x] Fork
- [x] Gollum
- [x] Workflow
- [x] Watch

... and more events can be seen in the [all GitHub events available](https://docs.cslant.com/telegram-git-notifier/prologue/event-availability/github)
Expand Down
2 changes: 1 addition & 1 deletion lang/de/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
return [
'by' => 'by',
'unknown_callback' => 'Unknown Callback. Something went wrong!',
'invalid_request' => '🤨 Invalid Request!',
'invalid_request' => 'Invalid Request!',
];
6 changes: 3 additions & 3 deletions lang/de/events/gitlab/tag_push.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'title' => '⚙️ <b>A new tag has been pushed to the project</b> 🦊:repo',
'name' => '🔖 <b>Tag Name</b>: :tag_name',
'pusher' => '👤 Pushed by: <b>:pusher</b>',
'title' => '<b>A new tag has been pushed to the project</b> :repo',
'name' => '<b>Tag Name</b>: :tag_name',
'pusher' => ' Pushed by',
];
8 changes: 4 additions & 4 deletions lang/de/events/gitlab/wiki_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'title' => [
'create' => '📒 <b>Wiki Page Created</b> - 🦊:repo by :user',
'update' => '📝 <b>Wiki Page Updated</b> - 🦊:repo by :user',
'delete' => '🗑 <b>Wiki Page Deleted</b> - 🦊:repo by :user',
'create' => '<b>Wiki Page Created</b> - :repo by :user',
'update' => '<b>Wiki Page Updated</b> - :repo by :user',
'delete' => '<b>Wiki Page Deleted</b> - :repo by :user',
],
'name' => '📝 Page Name: <b>:name</b>',
'name' => 'Page Name',
];
2 changes: 1 addition & 1 deletion lang/de/events/shared/gitlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'_body' => [
'title' => '📖 <b>Content:</b>',
'title' => 'Content',
],
'_assignee' => [
'title' => '🙋 Assignee: ',
Expand Down
2 changes: 1 addition & 1 deletion lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
return [
'by' => 'by',
'unknown_callback' => 'Unknown Callback. Something went wrong!',
'invalid_request' => '🤨 Invalid Request!',
'invalid_request' => 'Invalid Request!',
];
6 changes: 3 additions & 3 deletions lang/en/events/gitlab/tag_push.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'title' => '⚙️ <b>A new tag has been pushed to the project</b> 🦊:repo',
'name' => '🔖 <b>Tag Name</b>: :tag_name',
'pusher' => '👤 Pushed by: <b>:pusher</b>',
'title' => '<b>A new tag has been pushed to the project</b> :repo',
'name' => '<b>Tag Name</b>: :tag_name',
'pusher' => ' Pushed by',
];
8 changes: 4 additions & 4 deletions lang/en/events/gitlab/wiki_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'title' => [
'create' => '📒 <b>Wiki Page Created</b> - 🦊:repo by :user',
'update' => '📝 <b>Wiki Page Updated</b> - 🦊:repo by :user',
'delete' => '🗑 <b>Wiki Page Deleted</b> - 🦊:repo by :user',
'create' => '<b>Wiki Page Created</b> - :repo by :user',
'update' => '<b>Wiki Page Updated</b> - :repo by :user',
'delete' => '<b>Wiki Page Deleted</b> - :repo by :user',
],
'name' => '📝 Page Name: <b>:name</b>',
'name' => 'Page Name',
];
2 changes: 1 addition & 1 deletion lang/en/events/shared/gitlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'_body' => [
'title' => '📖 <b>Content:</b>',
'title' => 'Content',
],
'_assignee' => [
'title' => '🙋 Assignee: ',
Expand Down
2 changes: 1 addition & 1 deletion lang/ja/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
return [
'by' => 'by',
'unknown_callback' => 'Unknown Callback. Something went wrong!',
'invalid_request' => '🤨 Invalid Request!',
'invalid_request' => 'Invalid Request!',
];
6 changes: 3 additions & 3 deletions lang/ja/events/gitlab/tag_push.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'title' => '⚙️ <b>A new tag has been pushed to the project</b> 🦊:repo',
'name' => '🔖 <b>Tag Name</b>: :tag_name',
'pusher' => '👤 Pushed by: <b>:pusher</b>',
'title' => '<b>A new tag has been pushed to the project</b> :repo',
'name' => '<b>Tag Name</b>: :tag_name',
'pusher' => ' Pushed by',
];
8 changes: 4 additions & 4 deletions lang/ja/events/gitlab/wiki_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'title' => [
'create' => '📒 <b>Wiki Page Created</b> - 🦊:repo by :user',
'update' => '📝 <b>Wiki Page Updated</b> - 🦊:repo by :user',
'delete' => '🗑 <b>Wiki Page Deleted</b> - 🦊:repo by :user',
'create' => '<b>Wiki Page Created</b> - :repo by :user',
'update' => '<b>Wiki Page Updated</b> - :repo by :user',
'delete' => '<b>Wiki Page Deleted</b> - :repo by :user',
],
'name' => '📝 Page Name: <b>:name</b>',
'name' => 'Page Name',
];
2 changes: 1 addition & 1 deletion lang/ja/events/shared/gitlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'_body' => [
'title' => '📖 <b>Content:</b>',
'title' => 'Content',
],
'_assignee' => [
'title' => '🙋 Assignee: ',
Expand Down
2 changes: 1 addition & 1 deletion lang/vi/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
return [
'by' => 'bởi',
'unknown_callback' => 'Callback không xác định. Đã xảy ra lỗi!',
'invalid_request' => '🤨 Yêu cầu không hợp lệ!',
'invalid_request' => 'Yêu cầu không hợp lệ!',
];
6 changes: 3 additions & 3 deletions lang/vi/events/gitlab/tag_push.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'title' => '⚙️ <b>A new tag has been pushed to the project</b> 🦊:repo',
'name' => '🔖 <b>Tag Name</b>: :tag_name',
'pusher' => '👤 Pushed by: <b>:pusher</b>',
'title' => '<b>A new tag has been pushed to the project</b> :repo',
'name' => '<b>Tag Name</b>: :tag_name',
'pusher' => ' Pushed by',
];
8 changes: 4 additions & 4 deletions lang/vi/events/gitlab/wiki_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'title' => [
'create' => '📒 <b>Wiki Page Created</b> - 🦊:repo by :user',
'update' => '📝 <b>Wiki Page Updated</b> - 🦊:repo by :user',
'delete' => '🗑 <b>Wiki Page Deleted</b> - 🦊:repo by :user',
'create' => '<b>Wiki Page Created</b> - :repo by :user',
'update' => '<b>Wiki Page Updated</b> - :repo by :user',
'delete' => '<b>Wiki Page Deleted</b> - :repo by :user',
],
'name' => '📝 Page Name: <b>:name</b>',
'name' => 'Page Name',
];
4 changes: 2 additions & 2 deletions lang/vi/events/shared/gitlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'_body' => [
'title' => '📖 <b>Nội dung:</b>',
'title' => 'Content',
],
'_assignee' => [
'title' => '🙋 Người được giao: ',
'title' => '🙋 Assignee: ',
],
];
13 changes: 4 additions & 9 deletions resources/views/events/gitlab/tag_push/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
$tagUrl = $payload->project->web_url.'/tags/'.$tag;
?>

{!! __('tg-notifier::events/gitlab/tag_push.title', [
'repo' => "<a href='{$payload->project->web_url}'>{$payload->project->path_with_namespace}</a>",
⚙️ {!! __('tg-notifier::events/gitlab/tag_push.title', [
'repo' => "🦊<a href='{$payload->project->web_url}'>{$payload->project->path_with_namespace}</a>",
]) !!}

{!! __('tg-notifier::events/gitlab/tag_push.name', [
'tag_name' => "<a href='{$tagUrl}'>{$tag}</a>",
]) !!}

{!! __('tg-notifier::events/gitlab/tag_push.pusher', [
'pusher' => "<b>{$payload->user_name}</b>",
]) !!}
🔖 <b>{!! __('tg-notifier::events/gitlab/tag_push.name') !!}</b>: <a href='{{ $tagUrl }}'>{{ $tag }}</a>
👤 {!! __('tg-notifier::events/gitlab/tag_push.pusher') !!}: <code>{{ $payload->user_name }}</code>
10 changes: 4 additions & 6 deletions resources/views/events/gitlab/wiki_page/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
*/

?>
{!! __('tg-notifier::events/gitlab/wiki_page.title.create', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<b>{$payload->user->name}</b>"
📒 {!! __('tg-notifier::events/gitlab/wiki_page.title.create', [
'repo' => "🦊<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<code>{$payload->user->name}</code>"
]) !!}

{!! __('tg-notifier::events/gitlab/wiki_page.name', [
'name' => "<b>{$payload->object_attributes->title}</b>"
]) !!}
📝 {!! __('tg-notifier::events/gitlab/wiki_page.name') !!}: <code>{{ $payload->object_attributes->title }}</code>

@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
10 changes: 4 additions & 6 deletions resources/views/events/gitlab/wiki_page/delete.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
*/

?>
{!! __('tg-notifier::events/gitlab/wiki_page.title.delete', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<b>{$payload->user->name}</b>"
🗑 {!! __('tg-notifier::events/gitlab/wiki_page.title.delete', [
'repo' => "🦊<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<code>{$payload->user->name}</code>"
]) !!}

{!! __('tg-notifier::events/gitlab/wiki_page.name', [
'name' => "<b>{$payload->object_attributes->title}</b>"
]) !!}
📝 {!! __('tg-notifier::events/gitlab/wiki_page.name') !!}: <code>{{ $payload->object_attributes->title }}</code>

@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
10 changes: 4 additions & 6 deletions resources/views/events/gitlab/wiki_page/update.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
*/

?>
{!! __('tg-notifier::events/gitlab/wiki_page.title.update', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<b>{$payload->user->name}</b>"
📝 {!! __('tg-notifier::events/gitlab/wiki_page.title.update', [
'repo' => "🦊<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->slug}</a>",
'user' => "<code>{$payload->user->name}</code>"
]) !!}

{!! __('tg-notifier::events/gitlab/wiki_page.name', [
'name' => "<b>{$payload->object_attributes->title}</b>"
]) !!}
📝 {!! __('tg-notifier::events/gitlab/wiki_page.name') !!}: <code>{{ $payload->object_attributes->title }}</code>

@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
14 changes: 8 additions & 6 deletions resources/views/events/shared/partials/gitlab/_body.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
} else {
return '';
}
if (strlen($body) > 50) {
$body = substr($body, 0, 50) . '...';
if (strlen($body) > 100) {
$body = substr($body, 0, 100) . '...';
}

$html = __('tg-notifier::events/shared/gitlab._body.title', ['body' => $body])
."\n"
.htmlentities($body);
$html = htmlentities($body);
}
?>
{!! $html !!}
@if(!empty($html))
📖 <b>{!! __('tg-notifier::events/shared/gitlab._body.title') !!}:</b>
<pre>{!! $html !!}</pre>
@endif

2 changes: 1 addition & 1 deletion src/Services/CommandService.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function handle(): void

break;
default:
$this->bot->sendMessage(__('tg-notifier::app.invalid_request'));
$this->bot->sendMessage('🤨 '.__('tg-notifier::app.invalid_request'));
}
}

Expand Down