replaced allowed mentions with enum
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\Notifications;
|
||||
|
||||
use App\Enums\DiscordAllowedMentionType;
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Enums\NotificationEventType;
|
||||
use App\Http\Resources\NotificationActionResource;
|
||||
@@ -22,6 +23,7 @@ class BuildProjectNotificationSettingsPayload
|
||||
return [
|
||||
'channelOptions' => NotificationChannel::options(),
|
||||
'eventTypeOptions' => NotificationEventType::options(),
|
||||
'discordAllowedMentionOptions' => DiscordAllowedMentionType::options(),
|
||||
'notificationActions' => NotificationActionResource::collection(
|
||||
$this->listProjectNotificationActions->handle($project),
|
||||
)->resolve(),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\Notifications;
|
||||
|
||||
use App\Enums\DiscordAllowedMentionType;
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Enums\NotificationDeliveryStatus;
|
||||
use App\Models\NotificationAction;
|
||||
@@ -21,11 +22,6 @@ class DeliverNotificationAction implements ShouldQueue
|
||||
|
||||
private const int DISCORD_CONTENT_LIMIT = 2000;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private const array DISCORD_ALLOWED_MENTION_TYPES = ['everyone', 'roles', 'users'];
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public int $timeout = 15;
|
||||
@@ -318,7 +314,7 @@ class DeliverNotificationAction implements ShouldQueue
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! in_array($allowedMention, self::DISCORD_ALLOWED_MENTION_TYPES, true)) {
|
||||
if (! in_array($allowedMention, DiscordAllowedMentionType::values(), true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user