Add notification filters
This commit is contained in:
@@ -34,6 +34,13 @@ class ProjectNotificationActionManagementTest extends TestCase
|
||||
'event_type' => NotificationEventType::TicketStatusChanged,
|
||||
'channel' => NotificationChannel::Discord,
|
||||
'channel_configuration' => ['mentions' => ['ops']],
|
||||
'filters' => [
|
||||
[
|
||||
'attribute' => 'status.to.label',
|
||||
'operator' => 'equals',
|
||||
'value' => 'Doing',
|
||||
],
|
||||
],
|
||||
'message_template' => '$ticket_key changed to $status_to',
|
||||
'delivery_url' => 'https://discord.com/api/webhooks/123456/discord-alerts',
|
||||
]);
|
||||
@@ -58,6 +65,13 @@ class ProjectNotificationActionManagementTest extends TestCase
|
||||
$this->assertCount(2, $listedActions);
|
||||
$this->assertSame(['Discord alerts', 'Webhook alerts'], $listedActions->pluck('name')->all());
|
||||
$this->assertSame(['mentions' => ['ops']], $listedActions->first()->channel_configuration);
|
||||
$this->assertSame([
|
||||
[
|
||||
'attribute' => 'status.to.label',
|
||||
'operator' => 'equals',
|
||||
'value' => 'Doing',
|
||||
],
|
||||
], $listedActions->first()->filters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +88,13 @@ class ProjectNotificationActionManagementTest extends TestCase
|
||||
|
||||
$updatedAction = $updateAction->handle($project, $notificationAction, [
|
||||
'enabled' => false,
|
||||
'filters' => [
|
||||
[
|
||||
'attribute' => 'ticket.key',
|
||||
'operator' => 'in',
|
||||
'value' => 'CORE-1, CORE-2',
|
||||
],
|
||||
],
|
||||
'message_template' => '$ticket_key moved from $status_from to $status_to',
|
||||
'channel_configuration' => ['mentions' => ['support']],
|
||||
'delivery_url' => '',
|
||||
@@ -85,6 +106,13 @@ class ProjectNotificationActionManagementTest extends TestCase
|
||||
$updatedAction->message_template,
|
||||
);
|
||||
$this->assertSame(['mentions' => ['support']], $updatedAction->channel_configuration);
|
||||
$this->assertSame([
|
||||
[
|
||||
'attribute' => 'ticket.key',
|
||||
'operator' => 'in',
|
||||
'value' => ['CORE-1', 'CORE-2'],
|
||||
],
|
||||
], $updatedAction->filters);
|
||||
$this->assertSame(
|
||||
'https://discord.com/api/webhooks/123456/original-secret',
|
||||
$updatedAction->delivery_url,
|
||||
|
||||
Reference in New Issue
Block a user