2
0

(editor) Allow empty group titles

This commit is contained in:
Baptiste Arnaud
2023-03-13 09:29:56 +01:00
parent 186328132f
commit f9aef907e3
11 changed files with 42 additions and 21 deletions

View File

@@ -2,7 +2,7 @@ import { authenticateUser } from '@/features/auth/api'
import prisma from '@/lib/prisma'
import { Group, WebhookBlock } from 'models'
import { NextApiRequest, NextApiResponse } from 'next'
import { byId, isWebhookBlock } from 'utils'
import { byId, isWebhookBlock, parseGroupTitle } from 'utils'
import { methodNotAllowed } from 'utils/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
@@ -27,7 +27,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
...emptyWebhookBlocks,
...blocks.map((b) => ({
blockId: b.id,
name: `${group.title} > ${b.id}`,
name: `${parseGroupTitle(group.title)} > ${b.id}`,
url: typebot?.webhooks.find(byId(b.webhookId))?.url ?? undefined,
})),
]

View File

@@ -2,7 +2,7 @@ import { authenticateUser } from '@/features/auth/api'
import prisma from '@/lib/prisma'
import { Group, WebhookBlock } from 'models'
import { NextApiRequest, NextApiResponse } from 'next'
import { byId, isNotDefined, isWebhookBlock } from 'utils'
import { byId, isNotDefined, isWebhookBlock, parseGroupTitle } from 'utils'
import { methodNotAllowed } from 'utils/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
@@ -32,7 +32,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
...blocks.map((s) => ({
id: s.id,
groupId: s.groupId,
name: `${group.title} > ${s.id}`,
name: `${parseGroupTitle(group.title)} > ${s.id}`,
})),
]
}, [])