Merge main into notification filters
linter / quality (pull_request) Successful in 3m31s
tests / ci (8.4) (pull_request) Successful in 2m0s

This commit is contained in:
2026-04-29 10:41:51 +00:00
28 changed files with 700 additions and 192 deletions
@@ -36,6 +36,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
'value' => 'Doing',
],
],
'channel_configuration' => [
'allowed_mentions' => ['users', 'roles'],
],
]);
$this->syncProjectPermissions($project, $user, ['edit']);
@@ -48,6 +51,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)
@@ -58,6 +63,8 @@ class ProjectNotificationSettingsControllerTest extends TestCase
->where('channelOptions.0.value', NotificationChannel::Discord->value)
->where('eventTypeOptions.0.value', NotificationEventType::TicketStatusChanged->value)
->where('eventTypeOptions.1.value', NotificationEventType::TicketCreate->value)
->where('discordAllowedMentionOptions.0.value', 'everyone')
->where('discordAllowedMentionOptions.2.value', 'users')
->where('filterAttributeOptions.0.value', 'project.id')
->where('filterOperatorOptions.0.value', 'equals')
->where('templateVariables.0.value', '$url')
@@ -96,6 +103,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',
'filters' => json_encode([
@@ -115,6 +125,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',
@@ -151,6 +165,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' => '',
'filters' => json_encode([
@@ -179,6 +196,17 @@ class ProjectNotificationSettingsControllerTest extends TestCase
'value' => ['CORE-1', 'CORE-2'],
],
], $notificationAction->filters);
$this->assertSame(
['allowed_mentions' => ['users', 'everyone']],
$notificationAction->channel_configuration,
);
$this->assertSame([
[
'attribute' => 'ticket.key',
'operator' => 'in',
'value' => ['CORE-1', 'CORE-2'],
],
], $notificationAction->filters);
$this->assertSame('$ticket_key moved to $status_to: $url', $notificationAction->message_template);
}
@@ -305,6 +333,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
'value' => [],
],
], JSON_THROW_ON_ERROR),
'channel_configuration' => [
'allowed_mentions' => ['not-valid'],
],
'message_template' => '',
])
->assertRedirect(route('projects.settings.notifications', $project))
@@ -314,6 +345,9 @@ class ProjectNotificationSettingsControllerTest extends TestCase
'enabled',
'delivery_url',
'filters.0.value',
'channel_configuration.allowed_mentions.0',
'channel_configuration.allowed_mentions.0',
'filters.0.value',
'message_template',
]);
}