Skip to content

Commit 81cebcf

Browse files
committed
fix: update merge request events for gitlab
1 parent 5e37b8e commit 81cebcf

File tree

11 files changed

+138
-90
lines changed

11 files changed

+138
-90
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
return [
4+
'review' => '👥 Reviewers: ',
5+
'closed' => [
6+
'title' => '❌ <b>Merge Request Closed</b> - 🦊:repo by :user',
7+
],
8+
'merged' => [
9+
'title' => '✅ <b>Merge Request Merged</b> - 🦊:repo by :user',
10+
],
11+
'opened' => [
12+
'title' => '👷‍♂️🛠️ <b>New Merge Request</b> - 🦊:issue by :user',
13+
],
14+
'reopened' => [
15+
'title' => '👷‍♂️🛠️ <b>Merge Request Reopened</b> - 🦊:issue by :user',
16+
],
17+
'approved' => [
18+
'title' => '👍 <b>Merge Request Approved</b> ✅ - 🦊:issue by :user',
19+
],
20+
'unapproved' => [
21+
'title' => '👎 <b>Merge Request Unapproved</b> ❌ - 🦊:issue by :user',
22+
],
23+
'approval' => [
24+
'title' => '👍 <b>Merge Request Approval</b> ✅ - 🦊:issue by :user',
25+
],
26+
'unapproval' => [
27+
'title' => '👎 <b>Merge Request Unapproval</b> ❌ - 🦊:issue by :user',
28+
],
29+
];
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @var $payload object
4+
* @var $event string
5+
*/
6+
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.approval.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
12+
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
14+
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "✅ <b>Merge Request Approved</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.approved.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "❌ <b>Close Merge Request</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.closed.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "✅🎉 <b>Merge Request Merged</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.merged.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "👷‍♂️🛠️ <b>Merge Request Opened</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.opened.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))

resources/views/events/gitlab/merge_request/partials/_reviewers.blade.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
}
1212
1313
$textReviewers .= "👥 Reviewers: " . implode(', ', $reviewers) . "\n";
14+
$textReviewers .= __('tg-notifier::events/gitlab/merge_request.review') . implode(', ', $reviewers);
1415
}
15-
16-
return $textReviewers;
16+
?>
17+
{!! $textReviewers !!}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "👷‍♂️🛠️ <b>Merge Request Reopened</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.opened.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "⛔‍🛠️ <b>Merge Request Unapproved</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.unapproval.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
33
* @var $payload object
4+
* @var $event string
45
*/
56
6-
$message = "❌ <b>Close Merge Request</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
7+
?>
8+
{!! __('tg-notifier::events/gitlab/merge_request.unapproved.title', [
9+
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
10+
'user' => "<b>{$payload->user->name}</b>"
11+
]) !!}
712

8-
$message .= "🛠 <b>{$payload->object_attributes->title}</b> \n\n";
13+
🛠 <b>{{ $payload->object_attributes->title }}</b>
914

10-
$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11-
12-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13-
14-
$message .= require __DIR__ . '/partials/_reviewers.php';
15-
16-
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17-
18-
echo $message;
15+
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
16+
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
17+
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
18+
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))

0 commit comments

Comments
 (0)