Add Discord allowed mentions configuration
This commit is contained in:
@@ -106,6 +106,44 @@ class DeliverNotificationActionTest extends TestCase
|
||||
$this->assertNotNull($deliveryLog->delivered_at);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure Discord deliveries include configured allowed mention parse values.
|
||||
*/
|
||||
public function test_discord_delivery_includes_configured_allowed_mentions(): void
|
||||
{
|
||||
Http::preventStrayRequests();
|
||||
Http::fake([
|
||||
'https://discord.com/api/webhooks/123456/discord-alerts' => Http::response('', 204),
|
||||
]);
|
||||
|
||||
$notificationAction = NotificationAction::factory()->discord()->create([
|
||||
'delivery_url' => 'https://discord.com/api/webhooks/123456/discord-alerts',
|
||||
'channel_configuration' => [
|
||||
'allowed_mentions' => ['users', 'roles', 'users', 'EVERYONE', 'invalid'],
|
||||
],
|
||||
'message_template' => '$ticket_key moved to $status_to',
|
||||
]);
|
||||
$deliveryLog = $this->createPendingDeliveryLog($notificationAction);
|
||||
|
||||
(new DeliverNotificationAction(
|
||||
notificationActionId: $notificationAction->id,
|
||||
payload: $this->payload(),
|
||||
notificationDeliveryLogId: $deliveryLog->id,
|
||||
))->handle();
|
||||
|
||||
Http::assertSentCount(1);
|
||||
Http::assertSent(function (Request $request): bool {
|
||||
return $request->method() === 'POST'
|
||||
&& $request->url() === 'https://discord.com/api/webhooks/123456/discord-alerts'
|
||||
&& $request->data() === [
|
||||
'content' => 'CORE-42 moved to Doing',
|
||||
'allowed_mentions' => [
|
||||
'parse' => ['users', 'roles', 'everyone'],
|
||||
],
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure retryable webhook responses release the job and update the delivery log.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user