mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-22 21:06:40 +08:00
🐛 Use published typebot for result transcript instead of dev typebot
This commit is contained in:
parent
d8bb1f7c40
commit
33b36d76fc
@ -53,12 +53,15 @@ export const getResultTranscript = authenticatedProcedure
|
||||
id: input.typebotId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
version: true,
|
||||
groups: true,
|
||||
edges: true,
|
||||
variables: true,
|
||||
events: true,
|
||||
publishedTypebot: {
|
||||
select: {
|
||||
version: true,
|
||||
groups: true,
|
||||
edges: true,
|
||||
variables: true,
|
||||
events: true,
|
||||
},
|
||||
},
|
||||
workspace: {
|
||||
select: {
|
||||
isSuspended: true,
|
||||
@ -79,14 +82,17 @@ export const getResultTranscript = authenticatedProcedure
|
||||
},
|
||||
});
|
||||
|
||||
if (!typebot || (await isReadTypebotForbidden(typebot, user)))
|
||||
if (
|
||||
!typebot?.publishedTypebot ||
|
||||
(await isReadTypebotForbidden(typebot, user))
|
||||
)
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: "Typebot not found" });
|
||||
|
||||
// Fetch result data
|
||||
const result = await prisma.result.findUnique({
|
||||
where: {
|
||||
id: input.resultId,
|
||||
typebotId: typebot.id,
|
||||
typebotId: input.typebotId,
|
||||
},
|
||||
select: {
|
||||
answers: {
|
||||
@ -148,7 +154,10 @@ export const getResultTranscript = authenticatedProcedure
|
||||
}));
|
||||
|
||||
const transcript = computeResultTranscript({
|
||||
typebot: typebotInSessionStateSchema.parse(typebot),
|
||||
typebot: typebotInSessionStateSchema.parse({
|
||||
...typebot.publishedTypebot,
|
||||
id: input.typebotId,
|
||||
}),
|
||||
answers,
|
||||
setVariableHistory,
|
||||
visitedEdges,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user