diff --git a/config/telegram-git-notifier.php b/config/telegram-git-notifier.php index 2621b01..a47cb58 100644 --- a/config/telegram-git-notifier.php +++ b/config/telegram-git-notifier.php @@ -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( diff --git a/lang/de/events/github/label.php b/lang/de/events/github/label.php new file mode 100644 index 0000000..4ebc4ed --- /dev/null +++ b/lang/de/events/github/label.php @@ -0,0 +1,25 @@ + [ + 'title' => '💬 New Label ⚠️ - 🦑:repo by :user', + ], + 'deleted' => [ + 'title' => '🗑 Label Deleted - 🦑:repo by :user', + ], + 'edited' => [ + 'title' => '👷‍♂️🛠️ Label has been edited - 🦑:repo by :user', + 'changes' => [ + 'title' => [ + 'name' => '📖 Title has been changed', + 'from' => '📝 From: :title_from', + 'to' => '🏷 To: :title_to', + ], + 'description' => [ + 'name' => '📖 Description has been changed', + 'from' => '📝 From: :description_from', + 'to' => '🏷 To: :description_to', + ], + ], + ], +]; diff --git a/lang/de/events/github/pull_request.php b/lang/de/events/github/pull_request.php index 088ccb7..5c49522 100644 --- a/lang/de/events/github/pull_request.php +++ b/lang/de/events/github/pull_request.php @@ -2,15 +2,35 @@ return [ 'review' => '👥 Reviewers: ', + 'assigned' => [ + 'title' => '‍👷‍♂️🛠️ Assigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been assigned in the pull request :pullRequest', + ], 'closed' => [ 'title' => ':title - 🦑:repo by :user', 'title_merged' => '✅ Pull Request Merged', 'title_closed' => '🚫 Pull Request Closed', ], + 'labeled' => [ + 'title' => '‍👷‍♂️🛠️ Labeled Pull Request - 🦑:repo by :user', + ], + 'locked' => [ + 'title' => '‍👷‍♂️🛠️ Locked Pull Request - 🦑:repo by :user', + ], 'opened' => [ 'title' => '👷‍♂️🛠️ New Pull Request - 🦑:repo by :user', ], 'reopened' => [ 'title' => '👷‍♂️🛠️ Reopened Pull Request - 🦑:repo by :user', ], + 'unassigned' => [ + 'title' => '‍👷‍♂️🛠️ Unassigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been unassigned in the pull request :pullRequest', + ], + 'unlabeled' => [ + 'title' => '‍👷‍♂️🛠️ Unlabeled Pull Request - 🦑:repo by :user', + ], + 'unlocked' => [ + 'title' => '‍👷‍♂️🛠️ Unlocked Pull Request - 🦑:repo by :user', + ], ]; diff --git a/lang/en/events/github/label.php b/lang/en/events/github/label.php new file mode 100644 index 0000000..4ebc4ed --- /dev/null +++ b/lang/en/events/github/label.php @@ -0,0 +1,25 @@ + [ + 'title' => '💬 New Label ⚠️ - 🦑:repo by :user', + ], + 'deleted' => [ + 'title' => '🗑 Label Deleted - 🦑:repo by :user', + ], + 'edited' => [ + 'title' => '👷‍♂️🛠️ Label has been edited - 🦑:repo by :user', + 'changes' => [ + 'title' => [ + 'name' => '📖 Title has been changed', + 'from' => '📝 From: :title_from', + 'to' => '🏷 To: :title_to', + ], + 'description' => [ + 'name' => '📖 Description has been changed', + 'from' => '📝 From: :description_from', + 'to' => '🏷 To: :description_to', + ], + ], + ], +]; diff --git a/lang/en/events/github/pull_request.php b/lang/en/events/github/pull_request.php index 088ccb7..5c49522 100644 --- a/lang/en/events/github/pull_request.php +++ b/lang/en/events/github/pull_request.php @@ -2,15 +2,35 @@ return [ 'review' => '👥 Reviewers: ', + 'assigned' => [ + 'title' => '‍👷‍♂️🛠️ Assigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been assigned in the pull request :pullRequest', + ], 'closed' => [ 'title' => ':title - 🦑:repo by :user', 'title_merged' => '✅ Pull Request Merged', 'title_closed' => '🚫 Pull Request Closed', ], + 'labeled' => [ + 'title' => '‍👷‍♂️🛠️ Labeled Pull Request - 🦑:repo by :user', + ], + 'locked' => [ + 'title' => '‍👷‍♂️🛠️ Locked Pull Request - 🦑:repo by :user', + ], 'opened' => [ 'title' => '👷‍♂️🛠️ New Pull Request - 🦑:repo by :user', ], 'reopened' => [ 'title' => '👷‍♂️🛠️ Reopened Pull Request - 🦑:repo by :user', ], + 'unassigned' => [ + 'title' => '‍👷‍♂️🛠️ Unassigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been unassigned in the pull request :pullRequest', + ], + 'unlabeled' => [ + 'title' => '‍👷‍♂️🛠️ Unlabeled Pull Request - 🦑:repo by :user', + ], + 'unlocked' => [ + 'title' => '‍👷‍♂️🛠️ Unlocked Pull Request - 🦑:repo by :user', + ], ]; diff --git a/lang/ja/events/github/label.php b/lang/ja/events/github/label.php new file mode 100644 index 0000000..4ebc4ed --- /dev/null +++ b/lang/ja/events/github/label.php @@ -0,0 +1,25 @@ + [ + 'title' => '💬 New Label ⚠️ - 🦑:repo by :user', + ], + 'deleted' => [ + 'title' => '🗑 Label Deleted - 🦑:repo by :user', + ], + 'edited' => [ + 'title' => '👷‍♂️🛠️ Label has been edited - 🦑:repo by :user', + 'changes' => [ + 'title' => [ + 'name' => '📖 Title has been changed', + 'from' => '📝 From: :title_from', + 'to' => '🏷 To: :title_to', + ], + 'description' => [ + 'name' => '📖 Description has been changed', + 'from' => '📝 From: :description_from', + 'to' => '🏷 To: :description_to', + ], + ], + ], +]; diff --git a/lang/ja/events/github/pull_request.php b/lang/ja/events/github/pull_request.php index 088ccb7..5c49522 100644 --- a/lang/ja/events/github/pull_request.php +++ b/lang/ja/events/github/pull_request.php @@ -2,15 +2,35 @@ return [ 'review' => '👥 Reviewers: ', + 'assigned' => [ + 'title' => '‍👷‍♂️🛠️ Assigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been assigned in the pull request :pullRequest', + ], 'closed' => [ 'title' => ':title - 🦑:repo by :user', 'title_merged' => '✅ Pull Request Merged', 'title_closed' => '🚫 Pull Request Closed', ], + 'labeled' => [ + 'title' => '‍👷‍♂️🛠️ Labeled Pull Request - 🦑:repo by :user', + ], + 'locked' => [ + 'title' => '‍👷‍♂️🛠️ Locked Pull Request - 🦑:repo by :user', + ], 'opened' => [ 'title' => '👷‍♂️🛠️ New Pull Request - 🦑:repo by :user', ], 'reopened' => [ 'title' => '👷‍♂️🛠️ Reopened Pull Request - 🦑:repo by :user', ], + 'unassigned' => [ + 'title' => '‍👷‍♂️🛠️ Unassigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been unassigned in the pull request :pullRequest', + ], + 'unlabeled' => [ + 'title' => '‍👷‍♂️🛠️ Unlabeled Pull Request - 🦑:repo by :user', + ], + 'unlocked' => [ + 'title' => '‍👷‍♂️🛠️ Unlocked Pull Request - 🦑:repo by :user', + ], ]; diff --git a/lang/vi/events/github/label.php b/lang/vi/events/github/label.php new file mode 100644 index 0000000..4ebc4ed --- /dev/null +++ b/lang/vi/events/github/label.php @@ -0,0 +1,25 @@ + [ + 'title' => '💬 New Label ⚠️ - 🦑:repo by :user', + ], + 'deleted' => [ + 'title' => '🗑 Label Deleted - 🦑:repo by :user', + ], + 'edited' => [ + 'title' => '👷‍♂️🛠️ Label has been edited - 🦑:repo by :user', + 'changes' => [ + 'title' => [ + 'name' => '📖 Title has been changed', + 'from' => '📝 From: :title_from', + 'to' => '🏷 To: :title_to', + ], + 'description' => [ + 'name' => '📖 Description has been changed', + 'from' => '📝 From: :description_from', + 'to' => '🏷 To: :description_to', + ], + ], + ], +]; diff --git a/lang/vi/events/github/pull_request.php b/lang/vi/events/github/pull_request.php index 088ccb7..5c49522 100644 --- a/lang/vi/events/github/pull_request.php +++ b/lang/vi/events/github/pull_request.php @@ -2,15 +2,35 @@ return [ 'review' => '👥 Reviewers: ', + 'assigned' => [ + 'title' => '‍👷‍♂️🛠️ Assigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been assigned in the pull request :pullRequest', + ], 'closed' => [ 'title' => ':title - 🦑:repo by :user', 'title_merged' => '✅ Pull Request Merged', 'title_closed' => '🚫 Pull Request Closed', ], + 'labeled' => [ + 'title' => '‍👷‍♂️🛠️ Labeled Pull Request - 🦑:repo by :user', + ], + 'locked' => [ + 'title' => '‍👷‍♂️🛠️ Locked Pull Request - 🦑:repo by :user', + ], 'opened' => [ 'title' => '👷‍♂️🛠️ New Pull Request - 🦑:repo by :user', ], 'reopened' => [ 'title' => '👷‍♂️🛠️ Reopened Pull Request - 🦑:repo by :user', ], + 'unassigned' => [ + 'title' => '‍👷‍♂️🛠️ Unassigned Pull Request - 🦑:repo by :user', + 'body' => ':name has been unassigned in the pull request :pullRequest', + ], + 'unlabeled' => [ + 'title' => '‍👷‍♂️🛠️ Unlabeled Pull Request - 🦑:repo by :user', + ], + 'unlocked' => [ + 'title' => '‍👷‍♂️🛠️ Unlocked Pull Request - 🦑:repo by :user', + ], ]; diff --git a/resources/views/events/github/issue_comment/created.blade.php b/resources/views/events/github/issue_comment/created.blade.php index f030b37..e811b92 100644 --- a/resources/views/events/github/issue_comment/created.blade.php +++ b/resources/views/events/github/issue_comment/created.blade.php @@ -7,13 +7,17 @@ $issue = $payload->issue; ?> +@if(empty($issue->pull_request)) {!! __('tg-notifier::events/github/issue_comment.created.title', [ - 'issue' => "{$payload->repository->full_name}#$issue->number", - 'user' => "@{$issue->user->login}" - ] - ) !!} + 'issue' => "{$payload->repository->full_name}#$issue->number", + 'user' => "@{$issue->user->login}" + ] +) !!} 📢 {{ $issue->title }} @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 diff --git a/resources/views/events/github/issue_comment/deleted.blade.php b/resources/views/events/github/issue_comment/deleted.blade.php index 2b7610b..4534c34 100644 --- a/resources/views/events/github/issue_comment/deleted.blade.php +++ b/resources/views/events/github/issue_comment/deleted.blade.php @@ -7,6 +7,7 @@ $issue = $payload->issue; ?> +@if(empty($issue->pull_request)) {!! __('tg-notifier::events/github/issue_comment.deleted.title', [ 'issue' => "{$payload->repository->full_name}#$issue->number", 'user' => "@{$issue->user->login}" @@ -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 diff --git a/resources/views/events/github/issue_comment/edited.blade.php b/resources/views/events/github/issue_comment/edited.blade.php index bde55e1..8a7018a 100644 --- a/resources/views/events/github/issue_comment/edited.blade.php +++ b/resources/views/events/github/issue_comment/edited.blade.php @@ -7,6 +7,7 @@ $issue = $payload->issue; ?> +@if(empty($issue->pull_request)) {!! __('tg-notifier::events/github/issue_comment.edited.title', [ 'issue' => "{$payload->repository->full_name}#$issue->number", 'user' => "@{$issue->user->login}" @@ -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 diff --git a/resources/views/events/github/label/created.blade.php b/resources/views/events/github/label/created.blade.php new file mode 100644 index 0000000..efbf76f --- /dev/null +++ b/resources/views/events/github/label/created.blade.php @@ -0,0 +1,17 @@ +label; +$description = strlen($label->description) > 50 ? $label->description : substr($label->description, 0, 50).'...'; +?> + +{!! __('tg-notifier::events/github/label.created.title', [ + 'repo' => "{$payload->repository->full_name}", + 'user' => "@{$payload->sender->login}", + ] + ) !!} + +📢 {{ $payload->label->name }} +{{ $description }} diff --git a/resources/views/events/github/label/deleted.blade.php b/resources/views/events/github/label/deleted.blade.php new file mode 100644 index 0000000..8f40028 --- /dev/null +++ b/resources/views/events/github/label/deleted.blade.php @@ -0,0 +1,13 @@ + + +{!! __('tg-notifier::events/github/label.deleted.title', [ + 'repo' => "{$payload->repository->full_name}", + 'user' => "@{$payload->sender->login}", + ] + ) !!} + +📢 {{ $payload->label->name }} diff --git a/resources/views/events/github/label/edited.blade.php b/resources/views/events/github/label/edited.blade.php new file mode 100644 index 0000000..74cabce --- /dev/null +++ b/resources/views/events/github/label/edited.blade.php @@ -0,0 +1,34 @@ +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' => "{$payload->repository->full_name}", + 'user' => "@{$payload->sender->login}", + ] + ) !!} + +@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 +📢 {{ $label->name }} +@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 diff --git a/resources/views/events/github/pull_request/assigned.blade.php b/resources/views/events/github/pull_request/assigned.blade.php new file mode 100644 index 0000000..2fbe51d --- /dev/null +++ b/resources/views/events/github/pull_request/assigned.blade.php @@ -0,0 +1,19 @@ +pull_request; +?> + +{!! __('tg-notifier::events/github/pull_request.assigned.title', [ + 'repo' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}", + ] + ) !!} + +{!! __('tg-notifier::events/github/pull_request.assigned.body', [ + 'name' => "@{$payload->assignee->login}", + 'pullRequest' => "$pull_request->title", + ] + ) !!} diff --git a/resources/views/events/github/pull_request/labeled.blade.php b/resources/views/events/github/pull_request/labeled.blade.php new file mode 100644 index 0000000..c30116e --- /dev/null +++ b/resources/views/events/github/pull_request/labeled.blade.php @@ -0,0 +1,17 @@ +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' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}", + ] + ) !!} + +📢 {{ $payload->label->name }} +{{ $description }} diff --git a/resources/views/events/github/pull_request/locked.blade.php b/resources/views/events/github/pull_request/locked.blade.php new file mode 100644 index 0000000..d884d7d --- /dev/null +++ b/resources/views/events/github/pull_request/locked.blade.php @@ -0,0 +1,15 @@ +pull_request; +?> + +{!! __('tg-notifier::events/github/pull_request.locked.title', [ + 'repo' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}" + ] + ) !!} + +📢 {{ $pull_request->title }} diff --git a/resources/views/events/github/pull_request/unassigned.blade.php b/resources/views/events/github/pull_request/unassigned.blade.php new file mode 100644 index 0000000..70ae3a8 --- /dev/null +++ b/resources/views/events/github/pull_request/unassigned.blade.php @@ -0,0 +1,19 @@ +pull_request; +?> + +{!! __('tg-notifier::events/github/pull_request.unassigned.title', [ + 'repo' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}" + ] + ) !!} + +{!! __('tg-notifier::events/github/pull_request.unassigned.body', [ + 'name' => "@{$payload->assignee->login}", + 'pullRequest' => "$pull_request->title", + ] + ) !!} diff --git a/resources/views/events/github/pull_request/unlabeled.blade.php b/resources/views/events/github/pull_request/unlabeled.blade.php new file mode 100644 index 0000000..a2e185b --- /dev/null +++ b/resources/views/events/github/pull_request/unlabeled.blade.php @@ -0,0 +1,16 @@ +pull_request; +?> + +{!! __('tg-notifier::events/github/pull_request.unlabeled.title', [ + 'repo' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}", + ] + ) !!} + +📢 {{ $payload->label->name }} +{{ substr($payload->label->description, 0, 50).'...' }} diff --git a/resources/views/events/github/pull_request/unlocked.blade.php b/resources/views/events/github/pull_request/unlocked.blade.php new file mode 100644 index 0000000..2f90ce9 --- /dev/null +++ b/resources/views/events/github/pull_request/unlocked.blade.php @@ -0,0 +1,15 @@ +pull_request; +?> + +{!! __('tg-notifier::events/github/pull_request.unlocked.title', [ + 'repo' => "{$payload->repository->full_name}#$pull_request->number", + 'user' => "@{$pull_request->user->login}" + ] + ) !!} + +📢 {{ $pull_request->title }} diff --git a/resources/views/events/github/team/created.blade.php b/resources/views/events/github/team/created.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/events/github/team/deleted.blade.php b/resources/views/events/github/team/deleted.blade.php new file mode 100644 index 0000000..e69de29