Merge main into notification filters
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Enums\DiscordAllowedMentionType;
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Enums\NotificationEventType;
|
||||
use App\Http\Requests\Concerns\InteractsWithNotificationFilters;
|
||||
@@ -29,10 +30,17 @@ class StoreProjectNotificationActionRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$messageTemplateRules = $this->input('channel') === NotificationChannel::Discord->value
|
||||
? ['required', 'string', 'max:2000']
|
||||
: ['nullable', 'string', 'max:2000'];
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'event_type' => ['required', 'string', Rule::in($this->eventTypes())],
|
||||
'channel' => ['required', 'string', Rule::in($this->channels())],
|
||||
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
||||
'channel' => ['required', 'string', Rule::in(NotificationChannel::values())],
|
||||
'channel_configuration' => ['nullable', 'array'],
|
||||
'channel_configuration.allowed_mentions' => ['nullable', 'array'],
|
||||
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
||||
'enabled' => ['required', 'boolean'],
|
||||
'delivery_url' => ['required', 'string', 'max:2048', 'url'],
|
||||
'message_template' => $this->messageTemplateRules(),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Enums\DiscordAllowedMentionType;
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Enums\NotificationEventType;
|
||||
use App\Http\Requests\Concerns\InteractsWithNotificationFilters;
|
||||
@@ -29,10 +30,17 @@ class UpdateProjectNotificationActionRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$messageTemplateRules = $this->input('channel') === NotificationChannel::Discord->value
|
||||
? ['required', 'string', 'max:2000']
|
||||
: ['nullable', 'string', 'max:2000'];
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'event_type' => ['required', 'string', Rule::in($this->eventTypes())],
|
||||
'channel' => ['required', 'string', Rule::in($this->channels())],
|
||||
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
||||
'channel' => ['required', 'string', Rule::in(NotificationChannel::values())],
|
||||
'channel_configuration' => ['nullable', 'array'],
|
||||
'channel_configuration.allowed_mentions' => ['nullable', 'array'],
|
||||
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
||||
'enabled' => ['required', 'boolean'],
|
||||
'delivery_url' => ['nullable', 'string', 'max:2048', 'url'],
|
||||
'message_template' => $this->messageTemplateRules(),
|
||||
|
||||
Reference in New Issue
Block a user