replaced allowed mentions with enum
This commit is contained in:
@@ -44,23 +44,6 @@ const timestampFormatter = new Intl.DateTimeFormat(undefined, {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
});
|
||||
const discordAllowedMentionOptions: Array<{
|
||||
value: string;
|
||||
label: string;
|
||||
}> = [
|
||||
{
|
||||
value: 'users',
|
||||
label: 'User mentions (@username)',
|
||||
},
|
||||
{
|
||||
value: 'roles',
|
||||
label: 'Role mentions (@role)',
|
||||
},
|
||||
{
|
||||
value: 'everyone',
|
||||
label: '@everyone and @here',
|
||||
},
|
||||
];
|
||||
|
||||
const breadcrumbs: BreadcrumbItem[] = [
|
||||
{
|
||||
@@ -203,8 +186,8 @@ const notificationActionTimestamp = (
|
||||
<CardHeader>
|
||||
<CardTitle>Create notification</CardTitle>
|
||||
<CardDescription>
|
||||
Add a project-scoped notification action for
|
||||
the supported ticket status change event.
|
||||
Add a project-scoped notification action for the
|
||||
supported ticket status change event.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
@@ -262,7 +245,9 @@ const notificationActionTimestamp = (
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="create-notification-channel">
|
||||
<Label
|
||||
for="create-notification-channel"
|
||||
>
|
||||
Channel
|
||||
</Label>
|
||||
<select
|
||||
@@ -284,7 +269,9 @@ const notificationActionTimestamp = (
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="create-notification-delivery-url">
|
||||
<Label
|
||||
for="create-notification-delivery-url"
|
||||
>
|
||||
Delivery URL
|
||||
</Label>
|
||||
<Input
|
||||
@@ -298,7 +285,9 @@ const notificationActionTimestamp = (
|
||||
never rendered back to the browser after
|
||||
save.
|
||||
</p>
|
||||
<InputError :message="errors.delivery_url" />
|
||||
<InputError
|
||||
:message="errors.delivery_url"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
@@ -491,7 +480,11 @@ const notificationActionTimestamp = (
|
||||
</Badge>
|
||||
</div>
|
||||
<CardDescription>
|
||||
{{ notificationActionTimestamp(notificationAction) }}
|
||||
{{
|
||||
notificationActionTimestamp(
|
||||
notificationAction,
|
||||
)
|
||||
}}
|
||||
</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
@@ -503,25 +496,19 @@ const notificationActionTimestamp = (
|
||||
[project.id, notificationAction.id],
|
||||
)
|
||||
"
|
||||
:error-bag="
|
||||
`updateNotificationAction-${notificationAction.id}`
|
||||
"
|
||||
:error-bag="`updateNotificationAction-${notificationAction.id}`"
|
||||
class="space-y-4"
|
||||
v-slot="{ errors, processing }"
|
||||
>
|
||||
<div class="grid gap-4 md:grid-cols-2">
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-name-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-name-${notificationAction.id}`"
|
||||
>
|
||||
Name
|
||||
</Label>
|
||||
<Input
|
||||
:id="
|
||||
`notification-name-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-name-${notificationAction.id}`"
|
||||
name="name"
|
||||
:default-value="
|
||||
notificationAction.name
|
||||
@@ -532,16 +519,12 @@ const notificationActionTimestamp = (
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-delivery-url-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-delivery-url-${notificationAction.id}`"
|
||||
>
|
||||
Delivery URL
|
||||
</Label>
|
||||
<Input
|
||||
:id="
|
||||
`notification-delivery-url-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-delivery-url-${notificationAction.id}`"
|
||||
name="delivery_url"
|
||||
type="url"
|
||||
:placeholder="
|
||||
@@ -566,16 +549,12 @@ const notificationActionTimestamp = (
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-event-type-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-event-type-${notificationAction.id}`"
|
||||
>
|
||||
Event type
|
||||
</Label>
|
||||
<select
|
||||
:id="
|
||||
`notification-event-type-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-event-type-${notificationAction.id}`"
|
||||
name="event_type"
|
||||
:default-value="
|
||||
notificationAction.event_type
|
||||
@@ -597,16 +576,12 @@ const notificationActionTimestamp = (
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-channel-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-channel-${notificationAction.id}`"
|
||||
>
|
||||
Channel
|
||||
</Label>
|
||||
<select
|
||||
:id="
|
||||
`notification-channel-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-channel-${notificationAction.id}`"
|
||||
name="channel"
|
||||
v-model="
|
||||
editChannelState[
|
||||
@@ -632,8 +607,9 @@ const notificationActionTimestamp = (
|
||||
<div
|
||||
:class="[
|
||||
'grid gap-2',
|
||||
selectedChannel(notificationAction) !==
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) !== 'discord'
|
||||
? 'hidden'
|
||||
: '',
|
||||
]"
|
||||
@@ -657,8 +633,9 @@ const notificationActionTimestamp = (
|
||||
)
|
||||
"
|
||||
:disabled="
|
||||
selectedChannel(notificationAction) !==
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) !== 'discord'
|
||||
"
|
||||
class="border-input text-primary focus:ring-ring size-4 rounded"
|
||||
/>
|
||||
@@ -669,8 +646,9 @@ const notificationActionTimestamp = (
|
||||
</div>
|
||||
<p class="text-muted-foreground text-sm">
|
||||
{{
|
||||
selectedChannel(notificationAction) ===
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) === 'discord'
|
||||
? 'Pick which Discord mention types are allowed. Leave all unchecked to keep mentions fully disabled.'
|
||||
: 'Allowed mentions are only used when the channel is Discord.'
|
||||
}}
|
||||
@@ -682,16 +660,12 @@ const notificationActionTimestamp = (
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-message-template-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-message-template-${notificationAction.id}`"
|
||||
>
|
||||
Discord message template
|
||||
</Label>
|
||||
<textarea
|
||||
:id="
|
||||
`notification-message-template-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-message-template-${notificationAction.id}`"
|
||||
name="message_template"
|
||||
rows="4"
|
||||
:value="
|
||||
@@ -699,13 +673,15 @@ const notificationActionTimestamp = (
|
||||
''
|
||||
"
|
||||
:disabled="
|
||||
selectedChannel(notificationAction) !==
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) !== 'discord'
|
||||
"
|
||||
:class="[
|
||||
'border-input bg-background shadow-xs focus-visible:border-ring focus-visible:ring-ring/50 min-h-28 rounded-md border px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px]',
|
||||
selectedChannel(notificationAction) !==
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) !== 'discord'
|
||||
? 'hidden'
|
||||
: 'block',
|
||||
]"
|
||||
@@ -713,8 +689,9 @@ const notificationActionTimestamp = (
|
||||
/>
|
||||
<p class="text-muted-foreground text-sm">
|
||||
{{
|
||||
selectedChannel(notificationAction) ===
|
||||
'discord'
|
||||
selectedChannel(
|
||||
notificationAction,
|
||||
) === 'discord'
|
||||
? 'Available for Discord actions only. Use the fixed variables listed in the sidebar.'
|
||||
: 'Discord message templates are only used when the channel is Discord.'
|
||||
}}
|
||||
@@ -729,9 +706,7 @@ const notificationActionTimestamp = (
|
||||
>
|
||||
<div class="grid gap-2">
|
||||
<Label
|
||||
:for="
|
||||
`notification-enabled-${notificationAction.id}`
|
||||
"
|
||||
:for="`notification-enabled-${notificationAction.id}`"
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<input
|
||||
@@ -740,9 +715,7 @@ const notificationActionTimestamp = (
|
||||
value="0"
|
||||
/>
|
||||
<input
|
||||
:id="
|
||||
`notification-enabled-${notificationAction.id}`
|
||||
"
|
||||
:id="`notification-enabled-${notificationAction.id}`"
|
||||
type="checkbox"
|
||||
name="enabled"
|
||||
value="1"
|
||||
|
||||
Reference in New Issue
Block a user