diff --git a/lang/en/app.php b/lang/en/app.php index bdbfe1f..c255c52 100644 --- a/lang/en/app.php +++ b/lang/en/app.php @@ -7,4 +7,6 @@ 'branch' => 'Branch', 'commit' => 'Commit', 'title' => 'Title', + 'state' => 'State', + 'confidential' => 'Confidential', ]; diff --git a/lang/en/events/gitlab/issues.php b/lang/en/events/gitlab/issues.php index 85c6248..1f578e0 100644 --- a/lang/en/events/gitlab/issues.php +++ b/lang/en/events/gitlab/issues.php @@ -2,6 +2,8 @@ return [ 'issue_title' => '📢', + 'default' => 'Default issue to :issue by :user', + 'confidential_issue' => '🔒 <b>Confidential Issue</b> to :issue by :user', 'closed' => [ 'title' => '<b>Issue Closed </b> to :issue by :user', ], diff --git a/lang/en/events/gitlab/merge_request.php b/lang/en/events/gitlab/merge_request.php index 6fa76ac..0680404 100644 --- a/lang/en/events/gitlab/merge_request.php +++ b/lang/en/events/gitlab/merge_request.php @@ -29,4 +29,5 @@ 'update' => [ 'title' => '<b>Merge Request Updated</b> - :repo by :user', ], + 'default' => 'Here is the default message for merge request', ]; diff --git a/lang/vi/app.php b/lang/vi/app.php index 3307d01..bb91a54 100644 --- a/lang/vi/app.php +++ b/lang/vi/app.php @@ -7,4 +7,6 @@ 'branch' => 'Tên nhánh', 'commit' => 'Commit', 'title' => 'Tiêu đề', + 'state' => 'Trạng thái', + 'confidential' => 'Bí mật', ]; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index dba5a52..5da8159 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,4 +9,3 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/resources/views/events/github/branch_protection_rule/created.blade.php b/resources/views/events/github/branch_protection_rule/created.blade.php index 7ed5129..97fd655 100644 --- a/resources/views/events/github/branch_protection_rule/created.blade.php +++ b/resources/views/events/github/branch_protection_rule/created.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $repository = $payload->repository; diff --git a/resources/views/events/github/branch_protection_rule/deleted.blade.php b/resources/views/events/github/branch_protection_rule/deleted.blade.php index 46ae97d..edb068f 100644 --- a/resources/views/events/github/branch_protection_rule/deleted.blade.php +++ b/resources/views/events/github/branch_protection_rule/deleted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $repository = $payload->repository; diff --git a/resources/views/events/github/branch_protection_rule/edited.blade.php b/resources/views/events/github/branch_protection_rule/edited.blade.php index 5d4a602..227797b 100644 --- a/resources/views/events/github/branch_protection_rule/edited.blade.php +++ b/resources/views/events/github/branch_protection_rule/edited.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $repository = $payload->repository; diff --git a/resources/views/events/github/deploy_key/created.blade.php b/resources/views/events/github/deploy_key/created.blade.php index 2add379..cccd021 100644 --- a/resources/views/events/github/deploy_key/created.blade.php +++ b/resources/views/events/github/deploy_key/created.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/deploy_key/deleted.blade.php b/resources/views/events/github/deploy_key/deleted.blade.php index eac89fe..a0879e5 100644 --- a/resources/views/events/github/deploy_key/deleted.blade.php +++ b/resources/views/events/github/deploy_key/deleted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/issue_comment/created.blade.php b/resources/views/events/github/issue_comment/created.blade.php index 3306b82..f1a6e14 100644 --- a/resources/views/events/github/issue_comment/created.blade.php +++ b/resources/views/events/github/issue_comment/created.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issue_comment/deleted.blade.php b/resources/views/events/github/issue_comment/deleted.blade.php index 123e388..ad9d27e 100644 --- a/resources/views/events/github/issue_comment/deleted.blade.php +++ b/resources/views/events/github/issue_comment/deleted.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issue_comment/edited.blade.php b/resources/views/events/github/issue_comment/edited.blade.php index 6776398..8a3ff44 100644 --- a/resources/views/events/github/issue_comment/edited.blade.php +++ b/resources/views/events/github/issue_comment/edited.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/closed.blade.php b/resources/views/events/github/issues/closed.blade.php index 25add21..888f9b5 100644 --- a/resources/views/events/github/issues/closed.blade.php +++ b/resources/views/events/github/issues/closed.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/deleted.blade.php b/resources/views/events/github/issues/deleted.blade.php index 632d916..395f39e 100644 --- a/resources/views/events/github/issues/deleted.blade.php +++ b/resources/views/events/github/issues/deleted.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/edited.blade.php b/resources/views/events/github/issues/edited.blade.php index b0e994d..ca4dfff 100644 --- a/resources/views/events/github/issues/edited.blade.php +++ b/resources/views/events/github/issues/edited.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/locked.blade.php b/resources/views/events/github/issues/locked.blade.php index ca857a0..5283bbf 100644 --- a/resources/views/events/github/issues/locked.blade.php +++ b/resources/views/events/github/issues/locked.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/opened.blade.php b/resources/views/events/github/issues/opened.blade.php index a38aa54..2a035cc 100644 --- a/resources/views/events/github/issues/opened.blade.php +++ b/resources/views/events/github/issues/opened.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/pinned.blade.php b/resources/views/events/github/issues/pinned.blade.php index 9744f3c..89e38b1 100644 --- a/resources/views/events/github/issues/pinned.blade.php +++ b/resources/views/events/github/issues/pinned.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/reopened.blade.php b/resources/views/events/github/issues/reopened.blade.php index a5ae9f0..ae00ef3 100644 --- a/resources/views/events/github/issues/reopened.blade.php +++ b/resources/views/events/github/issues/reopened.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/unlocked.blade.php b/resources/views/events/github/issues/unlocked.blade.php index 306c62e..67ec34c 100644 --- a/resources/views/events/github/issues/unlocked.blade.php +++ b/resources/views/events/github/issues/unlocked.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/issues/unpinned.blade.php b/resources/views/events/github/issues/unpinned.blade.php index 250b12c..32515c3 100644 --- a/resources/views/events/github/issues/unpinned.blade.php +++ b/resources/views/events/github/issues/unpinned.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $issue = $payload->issue; diff --git a/resources/views/events/github/label/created.blade.php b/resources/views/events/github/label/created.blade.php index 680a703..33eb97f 100644 --- a/resources/views/events/github/label/created.blade.php +++ b/resources/views/events/github/label/created.blade.php @@ -1,10 +1,9 @@ <?php /** - * @var $payload object + * @var object $payload */ $label = $payload->label; -$description = strlen($label->description) < 100 ? $label->description : substr($label->description, 0, 100).'...'; ?> ✒ {!! __('tg-notifier::events/github/label.created.title', [ @@ -14,4 +13,4 @@ ) !!} 🔖 <b>{{ $payload->label->name }}</b> -<b>{!! __('tg-notifier::events/shared/github._description.title') !!}:</b> {{ $description }} +<b>{!! __('tg-notifier::events/shared/github._description.title') !!}:</b> {{ \Illuminate\Support\Str::limit($label->description) }} diff --git a/resources/views/events/github/label/deleted.blade.php b/resources/views/events/github/label/deleted.blade.php index cecc509..45ba4b0 100644 --- a/resources/views/events/github/label/deleted.blade.php +++ b/resources/views/events/github/label/deleted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/label/edited.blade.php b/resources/views/events/github/label/edited.blade.php index 35317bc..58bbd1f 100644 --- a/resources/views/events/github/label/edited.blade.php +++ b/resources/views/events/github/label/edited.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $changes = $payload->changes; diff --git a/resources/views/events/github/meta/deleted.blade.php b/resources/views/events/github/meta/deleted.blade.php index e4c71a6..e11a758 100644 --- a/resources/views/events/github/meta/deleted.blade.php +++ b/resources/views/events/github/meta/deleted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/ping/default.blade.php b/resources/views/events/github/ping/default.blade.php index f173a03..bc9dc59 100644 --- a/resources/views/events/github/ping/default.blade.php +++ b/resources/views/events/github/ping/default.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -16,4 +16,4 @@ @endif @if(isset($payload->sender)) 👤 {!! __('tg-notifier::events/github/ping.sender') !!}: <code>{{ $payload->sender->login }}</code> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/pull_request/assigned.blade.php b/resources/views/events/github/pull_request/assigned.blade.php index e41f577..0c4f1f6 100644 --- a/resources/views/events/github/pull_request/assigned.blade.php +++ b/resources/views/events/github/pull_request/assigned.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/closed.blade.php b/resources/views/events/github/pull_request/closed.blade.php index 69bb93b..6611edb 100644 --- a/resources/views/events/github/pull_request/closed.blade.php +++ b/resources/views/events/github/pull_request/closed.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/labeled.blade.php b/resources/views/events/github/pull_request/labeled.blade.php index 9ee3abc..3646c4f 100644 --- a/resources/views/events/github/pull_request/labeled.blade.php +++ b/resources/views/events/github/pull_request/labeled.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/locked.blade.php b/resources/views/events/github/pull_request/locked.blade.php index 75ee805..1a28e16 100644 --- a/resources/views/events/github/pull_request/locked.blade.php +++ b/resources/views/events/github/pull_request/locked.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/opened.blade.php b/resources/views/events/github/pull_request/opened.blade.php index 49f9b1c..8ee99cf 100644 --- a/resources/views/events/github/pull_request/opened.blade.php +++ b/resources/views/events/github/pull_request/opened.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/partials/_reviewers.blade.php b/resources/views/events/github/pull_request/partials/_reviewers.blade.php index ccca5fc..02c7d47 100644 --- a/resources/views/events/github/pull_request/partials/_reviewers.blade.php +++ b/resources/views/events/github/pull_request/partials/_reviewers.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $textReviewers = ''; diff --git a/resources/views/events/github/pull_request/reopened.blade.php b/resources/views/events/github/pull_request/reopened.blade.php index d36869a..e667183 100644 --- a/resources/views/events/github/pull_request/reopened.blade.php +++ b/resources/views/events/github/pull_request/reopened.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/unassigned.blade.php b/resources/views/events/github/pull_request/unassigned.blade.php index 67e84ca..474ac25 100644 --- a/resources/views/events/github/pull_request/unassigned.blade.php +++ b/resources/views/events/github/pull_request/unassigned.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/unlabeled.blade.php b/resources/views/events/github/pull_request/unlabeled.blade.php index f2132ef..6183952 100644 --- a/resources/views/events/github/pull_request/unlabeled.blade.php +++ b/resources/views/events/github/pull_request/unlabeled.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request/unlocked.blade.php b/resources/views/events/github/pull_request/unlocked.blade.php index 9ae336e..951af7f 100644 --- a/resources/views/events/github/pull_request/unlocked.blade.php +++ b/resources/views/events/github/pull_request/unlocked.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request_review/dismissed.blade.php b/resources/views/events/github/pull_request_review/dismissed.blade.php index f1666ea..186f17a 100644 --- a/resources/views/events/github/pull_request_review/dismissed.blade.php +++ b/resources/views/events/github/pull_request_review/dismissed.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/pull_request_review/submitted.blade.php b/resources/views/events/github/pull_request_review/submitted.blade.php index d9bd994..1c93f5d 100644 --- a/resources/views/events/github/pull_request_review/submitted.blade.php +++ b/resources/views/events/github/pull_request_review/submitted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $pull_request = $payload->pull_request; diff --git a/resources/views/events/github/push/default.blade.php b/resources/views/events/github/push/default.blade.php index dd31dd6..fa50e5a 100644 --- a/resources/views/events/github/push/default.blade.php +++ b/resources/views/events/github/push/default.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $count = count($payload->commits); diff --git a/resources/views/events/github/star/created.blade.php b/resources/views/events/github/star/created.blade.php index f2c9856..05b94dd 100644 --- a/resources/views/events/github/star/created.blade.php +++ b/resources/views/events/github/star/created.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/star/deleted.blade.php b/resources/views/events/github/star/deleted.blade.php index 269452c..1b757d4 100644 --- a/resources/views/events/github/star/deleted.blade.php +++ b/resources/views/events/github/star/deleted.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/team/added_to_repository.blade.php b/resources/views/events/github/team/added_to_repository.blade.php index 2a0fa4c..d69a356 100644 --- a/resources/views/events/github/team/added_to_repository.blade.php +++ b/resources/views/events/github/team/added_to_repository.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -20,4 +20,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team.added_to_repository.team') !!}: <a href='{{ $payload->team->html_url }}'><b>{{ $payload->team->name }}</b></a> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/team/created.blade.php b/resources/views/events/github/team/created.blade.php index 97e6d95..94676d2 100644 --- a/resources/views/events/github/team/created.blade.php +++ b/resources/views/events/github/team/created.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -16,4 +16,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team.created.team') !!}: <a href='{{ $payload->team->html_url }}'><b>{{ $payload->team->name }}</b></a> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/team/deleted.blade.php b/resources/views/events/github/team/deleted.blade.php index 1a51de5..5d5e3b7 100644 --- a/resources/views/events/github/team/deleted.blade.php +++ b/resources/views/events/github/team/deleted.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -16,4 +16,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team.deleted.team') !!}: <b>{{ $payload->team->name }}</b> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/team/edited.blade.php b/resources/views/events/github/team/edited.blade.php index afd5f8d..43de8e0 100644 --- a/resources/views/events/github/team/edited.blade.php +++ b/resources/views/events/github/team/edited.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -16,4 +16,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team.edited.team') !!}: <a href='{{ $payload->team->html_url }}'><b>{{ $payload->team->name }}</b></a> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/team/removed_from_repository.blade.php b/resources/views/events/github/team/removed_from_repository.blade.php index 1cfbf0c..1072ead 100644 --- a/resources/views/events/github/team/removed_from_repository.blade.php +++ b/resources/views/events/github/team/removed_from_repository.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -19,4 +19,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team.removed_from_repository.team') !!}: <a href='{{ $payload->team->html_url }}'><b>{{ $payload->team->name }}</b></a> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/team_add/default.blade.php b/resources/views/events/github/team_add/default.blade.php index 763516f..04e25dc 100644 --- a/resources/views/events/github/team_add/default.blade.php +++ b/resources/views/events/github/team_add/default.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> @@ -16,4 +16,4 @@ @endif @if(isset($payload->team)) 👥 {!! __('tg-notifier::events/github/team_add.team') !!}: <code>{{ $payload->team->name }}</code> -@endif \ No newline at end of file +@endif diff --git a/resources/views/events/github/watch/started.blade.php b/resources/views/events/github/watch/started.blade.php index 3001438..f868623 100644 --- a/resources/views/events/github/watch/started.blade.php +++ b/resources/views/events/github/watch/started.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/workflow_job/completed.blade.php b/resources/views/events/github/workflow_job/completed.blade.php index adca6e6..7dd7298 100644 --- a/resources/views/events/github/workflow_job/completed.blade.php +++ b/resources/views/events/github/workflow_job/completed.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ if ($payload->workflow_job->conclusion === 'success') { diff --git a/resources/views/events/github/workflow_job/in_progress.blade.php b/resources/views/events/github/workflow_job/in_progress.blade.php index 4d500aa..d523eee 100644 --- a/resources/views/events/github/workflow_job/in_progress.blade.php +++ b/resources/views/events/github/workflow_job/in_progress.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/workflow_job/queued.blade.php b/resources/views/events/github/workflow_job/queued.blade.php index 6e85cb0..803695d 100644 --- a/resources/views/events/github/workflow_job/queued.blade.php +++ b/resources/views/events/github/workflow_job/queued.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/github/workflow_run/completed.blade.php b/resources/views/events/github/workflow_run/completed.blade.php index 11469df..83fa283 100644 --- a/resources/views/events/github/workflow_run/completed.blade.php +++ b/resources/views/events/github/workflow_run/completed.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ match ($payload->workflow_run->conclusion) { diff --git a/resources/views/events/github/workflow_run/requested.blade.php b/resources/views/events/github/workflow_run/requested.blade.php index ae14132..c109197 100644 --- a/resources/views/events/github/workflow_run/requested.blade.php +++ b/resources/views/events/github/workflow_run/requested.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/gitlab/confidential_issue/default.blade.php b/resources/views/events/gitlab/confidential_issue/default.blade.php new file mode 100644 index 0000000..c614763 --- /dev/null +++ b/resources/views/events/gitlab/confidential_issue/default.blade.php @@ -0,0 +1,18 @@ +<?php +/** + * @var object $payload + * @var string $event + */ + +?> +🔥 {!! __('tg-notifier::events/gitlab/issues.confidential_issue', [ + 'issue' => "🦊<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->id}</a>", + 'user' => "<b>{$payload->user->name}</b>" + ] +) !!} + +📢 {{ __('tg-notifier::app.title') }}: <code>{{ $payload->object_attributes->title }}</code> +📡 {{ __('tg-notifier::app.state') }}: <code>{{ $payload->object_attributes->state }}</code> +🔒 {{ __('tg-notifier::app.confidential') }}: <code>{{ $payload->object_attributes->confidential }}</code> +@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event')) +@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event')) diff --git a/resources/views/events/gitlab/feature_flag/default.blade.php b/resources/views/events/gitlab/feature_flag/default.blade.php index e0666a9..deabaef 100644 --- a/resources/views/events/gitlab/feature_flag/default.blade.php +++ b/resources/views/events/gitlab/feature_flag/default.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $flagUrl = $payload->project->web_url."/-/feature_flags/".$payload->object_attributes->id; diff --git a/resources/views/events/gitlab/issue/close.blade.php b/resources/views/events/gitlab/issue/close.blade.php index fedd216..6ea28e9 100644 --- a/resources/views/events/gitlab/issue/close.blade.php +++ b/resources/views/events/gitlab/issue/close.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/issue/default.blade.php b/resources/views/events/gitlab/issue/default.blade.php new file mode 100644 index 0000000..ee7e872 --- /dev/null +++ b/resources/views/events/gitlab/issue/default.blade.php @@ -0,0 +1,17 @@ +<?php +/** + * @var object $payload + * @var string $event + */ + +?> +🔥 {!! __('tg-notifier::events/gitlab/issues.default', [ + 'issue' => "🦊<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->id}</a>", + 'user' => "<b>{$payload->user->name}</b>" + ] +) !!} + +📢 {{ __('tg-notifier::app.title') }}: <code>{{ $payload->object_attributes->title }}</code> +📡 {{ __('tg-notifier::app.state') }}: <code>{{ $payload->object_attributes->state }}</code> +@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event')) +@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event')) diff --git a/resources/views/events/gitlab/issue/open.blade.php b/resources/views/events/gitlab/issue/open.blade.php index b7d7374..6791ba0 100644 --- a/resources/views/events/gitlab/issue/open.blade.php +++ b/resources/views/events/gitlab/issue/open.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/issue/reopen.blade.php b/resources/views/events/gitlab/issue/reopen.blade.php index 5af5c5c..d1b52d4 100644 --- a/resources/views/events/gitlab/issue/reopen.blade.php +++ b/resources/views/events/gitlab/issue/reopen.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/issue/update.blade.php b/resources/views/events/gitlab/issue/update.blade.php index 89852d3..6e41d1c 100644 --- a/resources/views/events/gitlab/issue/update.blade.php +++ b/resources/views/events/gitlab/issue/update.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/approval.blade.php b/resources/views/events/gitlab/merge_request/approval.blade.php index f49983e..8e55cff 100644 --- a/resources/views/events/gitlab/merge_request/approval.blade.php +++ b/resources/views/events/gitlab/merge_request/approval.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/approved.blade.php b/resources/views/events/gitlab/merge_request/approved.blade.php index b3e1eb0..db954d3 100644 --- a/resources/views/events/gitlab/merge_request/approved.blade.php +++ b/resources/views/events/gitlab/merge_request/approved.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/close.blade.php b/resources/views/events/gitlab/merge_request/close.blade.php index d42814e..a5e5645 100644 --- a/resources/views/events/gitlab/merge_request/close.blade.php +++ b/resources/views/events/gitlab/merge_request/close.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/default.blade.php b/resources/views/events/gitlab/merge_request/default.blade.php new file mode 100644 index 0000000..c4db8dd --- /dev/null +++ b/resources/views/events/gitlab/merge_request/default.blade.php @@ -0,0 +1,14 @@ +<?php +/** + * @var object $payload + * @var string $event + */ + +?> +🔥 {{ __('tg-notifier::events/gitlab/merge_request.default') }} + +🛠 <b>{{ $payload->object_attributes->title }}</b> +🌳 {{ __('tg-notifier::app.branch') }}: {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯 +@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event')) +@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload')) +@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event')) diff --git a/resources/views/events/gitlab/merge_request/merge.blade.php b/resources/views/events/gitlab/merge_request/merge.blade.php index 0380d43..2cf697e 100644 --- a/resources/views/events/gitlab/merge_request/merge.blade.php +++ b/resources/views/events/gitlab/merge_request/merge.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/open.blade.php b/resources/views/events/gitlab/merge_request/open.blade.php index 71fb930..78802bf 100644 --- a/resources/views/events/gitlab/merge_request/open.blade.php +++ b/resources/views/events/gitlab/merge_request/open.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/partials/_reviewers.blade.php b/resources/views/events/gitlab/merge_request/partials/_reviewers.blade.php index 18fc6e3..ca39aae 100644 --- a/resources/views/events/gitlab/merge_request/partials/_reviewers.blade.php +++ b/resources/views/events/gitlab/merge_request/partials/_reviewers.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $textReviewers = ''; diff --git a/resources/views/events/gitlab/merge_request/reopen.blade.php b/resources/views/events/gitlab/merge_request/reopen.blade.php index a1ad540..6977d1b 100644 --- a/resources/views/events/gitlab/merge_request/reopen.blade.php +++ b/resources/views/events/gitlab/merge_request/reopen.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/unapproval.blade.php b/resources/views/events/gitlab/merge_request/unapproval.blade.php index d44ded1..43d72f2 100644 --- a/resources/views/events/gitlab/merge_request/unapproval.blade.php +++ b/resources/views/events/gitlab/merge_request/unapproval.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/unapproved.blade.php b/resources/views/events/gitlab/merge_request/unapproved.blade.php index 6414df5..e427a97 100644 --- a/resources/views/events/gitlab/merge_request/unapproved.blade.php +++ b/resources/views/events/gitlab/merge_request/unapproved.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/merge_request/update.blade.php b/resources/views/events/gitlab/merge_request/update.blade.php index d736703..01dfe43 100644 --- a/resources/views/events/gitlab/merge_request/update.blade.php +++ b/resources/views/events/gitlab/merge_request/update.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/note/commit.blade.php b/resources/views/events/gitlab/note/commit.blade.php index 37dfbc9..83b2262 100644 --- a/resources/views/events/gitlab/note/commit.blade.php +++ b/resources/views/events/gitlab/note/commit.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/note/issue.blade.php b/resources/views/events/gitlab/note/issue.blade.php index 19775da..ee382e0 100644 --- a/resources/views/events/gitlab/note/issue.blade.php +++ b/resources/views/events/gitlab/note/issue.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ ?> diff --git a/resources/views/events/gitlab/note/merge_request.blade.php b/resources/views/events/gitlab/note/merge_request.blade.php index 2f20866..409cd95 100644 --- a/resources/views/events/gitlab/note/merge_request.blade.php +++ b/resources/views/events/gitlab/note/merge_request.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/note/snippet.blade.php b/resources/views/events/gitlab/note/snippet.blade.php index f2ec2f2..61db544 100644 --- a/resources/views/events/gitlab/note/snippet.blade.php +++ b/resources/views/events/gitlab/note/snippet.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/push/default.blade.php b/resources/views/events/gitlab/push/default.blade.php index 822740c..1124747 100644 --- a/resources/views/events/gitlab/push/default.blade.php +++ b/resources/views/events/gitlab/push/default.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $count = count($payload->commits); diff --git a/resources/views/events/gitlab/release/create.blade.php b/resources/views/events/gitlab/release/create.blade.php index 056be8e..e525642 100644 --- a/resources/views/events/gitlab/release/create.blade.php +++ b/resources/views/events/gitlab/release/create.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/release/delete.blade.php b/resources/views/events/gitlab/release/delete.blade.php index 1206b33..57a2f0b 100644 --- a/resources/views/events/gitlab/release/delete.blade.php +++ b/resources/views/events/gitlab/release/delete.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/release/update.blade.php b/resources/views/events/gitlab/release/update.blade.php index 96d1a3c..60e601b 100644 --- a/resources/views/events/gitlab/release/update.blade.php +++ b/resources/views/events/gitlab/release/update.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/tag_push/default.blade.php b/resources/views/events/gitlab/tag_push/default.blade.php index 5e784e5..90d5b6c 100644 --- a/resources/views/events/gitlab/tag_push/default.blade.php +++ b/resources/views/events/gitlab/tag_push/default.blade.php @@ -1,6 +1,6 @@ <?php /** - * @var $payload object + * @var object $payload */ $ref = explode('/', $payload->ref); diff --git a/resources/views/events/gitlab/wiki_page/create.blade.php b/resources/views/events/gitlab/wiki_page/create.blade.php index 31bad74..aaf692f 100644 --- a/resources/views/events/gitlab/wiki_page/create.blade.php +++ b/resources/views/events/gitlab/wiki_page/create.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/wiki_page/delete.blade.php b/resources/views/events/gitlab/wiki_page/delete.blade.php index e797664..51ee18d 100644 --- a/resources/views/events/gitlab/wiki_page/delete.blade.php +++ b/resources/views/events/gitlab/wiki_page/delete.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/gitlab/wiki_page/update.blade.php b/resources/views/events/gitlab/wiki_page/update.blade.php index e03935e..b2a96f5 100644 --- a/resources/views/events/gitlab/wiki_page/update.blade.php +++ b/resources/views/events/gitlab/wiki_page/update.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ ?> diff --git a/resources/views/events/shared/partials/github/_assignees.blade.php b/resources/views/events/shared/partials/github/_assignees.blade.php index d8d4ae4..de757ea 100644 --- a/resources/views/events/shared/partials/github/_assignees.blade.php +++ b/resources/views/events/shared/partials/github/_assignees.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ $assigneeText = ''; diff --git a/resources/views/events/shared/partials/github/_body.blade.php b/resources/views/events/shared/partials/github/_body.blade.php index c9a6c5f..84fe99f 100644 --- a/resources/views/events/shared/partials/github/_body.blade.php +++ b/resources/views/events/shared/partials/github/_body.blade.php @@ -1,17 +1,14 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ +use Illuminate\Support\Str; + $html = ''; if (isset($event) && isset($payload) && !empty($payload->{$event}->body)) { - $body = $payload->{$event}->body; - if (strlen($body) > 100) { - $body = substr($body, 0, 100).'...'; - } - - $html = htmlentities($body); + $html = htmlentities(Str::limit($payload->{$event}->body)); } ?> @if(!empty($html)) diff --git a/resources/views/events/shared/partials/gitlab/_assignees.blade.php b/resources/views/events/shared/partials/gitlab/_assignees.blade.php index 58dd3da..079b393 100644 --- a/resources/views/events/shared/partials/gitlab/_assignees.blade.php +++ b/resources/views/events/shared/partials/gitlab/_assignees.blade.php @@ -1,7 +1,7 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ if (isset($event) && isset($payload) && !empty($payload->assignees)) { diff --git a/resources/views/events/shared/partials/gitlab/_body.blade.php b/resources/views/events/shared/partials/gitlab/_body.blade.php index ffb0937..d4eee62 100644 --- a/resources/views/events/shared/partials/gitlab/_body.blade.php +++ b/resources/views/events/shared/partials/gitlab/_body.blade.php @@ -1,9 +1,11 @@ <?php /** - * @var $payload object - * @var $event string + * @var object $payload + * @var string $event */ +use Illuminate\Support\Str; + $html = ''; if (isset($event) && isset($payload)) { if (!empty($payload->object_attributes->description)) { @@ -19,11 +21,7 @@ } else { return ''; } - if (strlen($body) > 100) { - $body = substr($body, 0, 100) . '...'; - } - - $html = htmlentities($body); + $html = htmlentities(Str::limit($body)); } ?> @if(!empty($html)) diff --git a/src/Commands/ChangeOwnerConfigJson.php b/src/Commands/ChangeOwnerConfigJson.php index 5f82f9a..5a89a7d 100644 --- a/src/Commands/ChangeOwnerConfigJson.php +++ b/src/Commands/ChangeOwnerConfigJson.php @@ -35,18 +35,47 @@ public function handle(): void return; } - $user = $this->argument('user') ?? ''; - $group = $this->argument('group') ?? $user; + $user = $this->argument('user') ?: $this->getDefaultUserGroup(); + $group = $this->argument('group') ?: $this->getDefaultUserGroup(); - if (empty($user) || empty($group)) { - $group = $user = exec('ps aux | egrep "(apache|httpd|nginx)" | grep -v "root" | head -n1 | cut -d\ -f1'); + if (!is_string($user) || !is_string($group)) { + $this->error('Failed to retrieve default user and group'); + + return; } + $this->changeOwner($user, $group); + } + + /** + * @param string $user + * @param string $group + * @return void + */ + private function changeOwner(string $user, string $group): void + { $jsonsPath = config('telegram-git-notifier.data_file.storage_folder'); if (is_string($jsonsPath) && file_exists($jsonsPath)) { - shell_exec("chown -R $user:$group $jsonsPath"); + shell_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg($jsonsPath)); } else { $this->error('The path to the jsons folder is not valid'); } } + + /** + * Get the default user and group for the chown command. + * + * @return string + */ + private function getDefaultUserGroup(): string + { + $defaultUserGroup = exec('ps aux | egrep "(apache|httpd|nginx)" | grep -v "root" | head -n1 | cut -d\ -f1'); + if ($defaultUserGroup === false) { + $this->error('Failed to retrieve default user and group'); + + return ''; + } + + return $defaultUserGroup; + } } diff --git a/src/Providers/TelegramGitNotifierServiceProvider.php b/src/Providers/TelegramGitNotifierServiceProvider.php index 34bd936..426d4e6 100644 --- a/src/Providers/TelegramGitNotifierServiceProvider.php +++ b/src/Providers/TelegramGitNotifierServiceProvider.php @@ -46,7 +46,7 @@ public function register(): void /** * Get the services provided by the provider. * - * @return array|null + * @return array<string>|null */ public function provides(): ?array { diff --git a/src/Services/CommandService.php b/src/Services/CommandService.php index efaa7ae..8f5208e 100644 --- a/src/Services/CommandService.php +++ b/src/Services/CommandService.php @@ -82,7 +82,7 @@ public function handle(): void } /** - * @return array[] + * @return array<string[]> */ public static function menuCommands(): array { diff --git a/src/Services/NotificationService.php b/src/Services/NotificationService.php index 283f147..2519c9f 100644 --- a/src/Services/NotificationService.php +++ b/src/Services/NotificationService.php @@ -14,6 +14,9 @@ class NotificationService { protected Request $request; + /** + * @var array<int|string> + */ protected array $chatIds = []; protected Notifier $notifier; @@ -73,6 +76,7 @@ private function sendNotification(string $event): void continue; } + /** @var array<int|string> $thread */ foreach ($thread as $threadId) { $this->notifier->sendNotify(null, [ 'chat_id' => $chatId, 'message_thread_id' => $threadId, diff --git a/src/Traits/Markup.php b/src/Traits/Markup.php index e7e40d0..8f302e8 100644 --- a/src/Traits/Markup.php +++ b/src/Traits/Markup.php @@ -9,7 +9,8 @@ trait Markup /** * Generate menu markup. * - * @return array[] + * @param Telegram $telegram + * @return array<string[]> */ public function menuMarkup(Telegram $telegram): array {