Merge branch 'main' into koda/ticket-create-notification-action
# Conflicts: # resources/js/pages/projects/settings/Notifications.vue
This commit is contained in:
@@ -29,6 +29,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
->for($project)
|
||||
->create([
|
||||
'name' => 'Discord alerts',
|
||||
'channel_configuration' => [
|
||||
'allowed_mentions' => ['users', 'roles'],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->syncProjectPermissions($project, $user, ['edit']);
|
||||
@@ -41,6 +44,8 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
->where('project.id', $project->id)
|
||||
->where('notificationActions.0.name', 'Discord alerts')
|
||||
->where('notificationActions.0.channel', NotificationChannel::Discord->value)
|
||||
->where('notificationActions.0.channel_configuration.allowed_mentions.0', 'users')
|
||||
->where('notificationActions.0.channel_configuration.allowed_mentions.1', 'roles')
|
||||
->where('notificationActions.0.event_type', NotificationEventType::TicketStatusChanged->value)
|
||||
->where('notificationActions.0.enabled', true)
|
||||
->where('notificationActions.0.has_delivery_url', true)
|
||||
@@ -84,6 +89,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
'name' => 'Discord alerts',
|
||||
'event_type' => NotificationEventType::TicketStatusChanged->value,
|
||||
'channel' => NotificationChannel::Discord->value,
|
||||
'channel_configuration' => [
|
||||
'allowed_mentions' => ['users', 'roles'],
|
||||
],
|
||||
'enabled' => '1',
|
||||
'delivery_url' => 'https://discord.com/api/webhooks/123456/discord-alerts',
|
||||
'message_template' => '$ticket_key moved from $status_from to $status_to by $actor_name: $url',
|
||||
@@ -96,6 +104,10 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
$this->assertSame($project->id, $notificationAction->project_id);
|
||||
$this->assertSame(NotificationChannel::Discord, $notificationAction->channel);
|
||||
$this->assertSame(NotificationEventType::TicketStatusChanged, $notificationAction->event_type);
|
||||
$this->assertSame(
|
||||
['allowed_mentions' => ['users', 'roles']],
|
||||
$notificationAction->channel_configuration,
|
||||
);
|
||||
$this->assertTrue($notificationAction->enabled);
|
||||
$this->assertSame(
|
||||
'https://discord.com/api/webhooks/123456/discord-alerts',
|
||||
@@ -125,6 +137,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
'name' => 'Ops escalation alerts',
|
||||
'event_type' => NotificationEventType::TicketStatusChanged->value,
|
||||
'channel' => NotificationChannel::Discord->value,
|
||||
'channel_configuration' => [
|
||||
'allowed_mentions' => ['users', 'everyone'],
|
||||
],
|
||||
'enabled' => '1',
|
||||
'delivery_url' => '',
|
||||
'message_template' => '$ticket_key moved to $status_to: $url',
|
||||
@@ -139,6 +154,10 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
'https://discord.com/api/webhooks/123456/original-secret',
|
||||
$notificationAction->delivery_url,
|
||||
);
|
||||
$this->assertSame(
|
||||
['allowed_mentions' => ['users', 'everyone']],
|
||||
$notificationAction->channel_configuration,
|
||||
);
|
||||
$this->assertSame('$ticket_key moved to $status_to: $url', $notificationAction->message_template);
|
||||
}
|
||||
|
||||
@@ -258,6 +277,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
'channel' => NotificationChannel::Discord->value,
|
||||
'enabled' => 'definitely-not-a-boolean',
|
||||
'delivery_url' => 'not-a-url',
|
||||
'channel_configuration' => [
|
||||
'allowed_mentions' => ['not-valid'],
|
||||
],
|
||||
'message_template' => '',
|
||||
])
|
||||
->assertRedirect(route('projects.settings.notifications', $project))
|
||||
@@ -266,6 +288,7 @@ class ProjectNotificationSettingsControllerTest extends TestCase
|
||||
'event_type',
|
||||
'enabled',
|
||||
'delivery_url',
|
||||
'channel_configuration.allowed_mentions.0',
|
||||
'message_template',
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user