Add Discord allowed mentions configuration
This commit is contained in:
@@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user