Add Discord allowed mentions configuration

This commit is contained in:
2026-04-24 17:01:34 +00:00
parent 9958db10b9
commit 55db0ac642
6 changed files with 300 additions and 1 deletions
@@ -10,6 +10,11 @@ use Illuminate\Validation\Rule;
class UpdateProjectNotificationActionRequest extends FormRequest
{
/**
* @var list<string>
*/
private const array DISCORD_ALLOWED_MENTION_TYPES = ['everyone', 'roles', 'users'];
/**
* Determine if the user is authorized to make this request.
*/
@@ -29,6 +34,9 @@ class UpdateProjectNotificationActionRequest extends FormRequest
'name' => ['required', 'string', 'max:255'],
'event_type' => ['required', 'string', Rule::in($this->eventTypes())],
'channel' => ['required', 'string', Rule::in($this->channels())],
'channel_configuration' => ['nullable', 'array'],
'channel_configuration.allowed_mentions' => ['nullable', 'array'],
'channel_configuration.allowed_mentions.*' => $this->allowedMentionRules(),
'enabled' => ['required', 'boolean'],
'delivery_url' => ['nullable', 'string', 'max:2048', 'url'],
'message_template' => $this->messageTemplateRules(),
@@ -68,4 +76,16 @@ class UpdateProjectNotificationActionRequest extends FormRequest
return ['nullable', 'string', 'max:2000'];
}
/**
* @return array<int, ValidationRule|string>
*/
private function allowedMentionRules(): array
{
return [
'nullable',
'string',
Rule::in(self::DISCORD_ALLOWED_MENTION_TYPES),
];
}
}