diff --git a/frontend/src/scenes/surveys/QuestionBranchingInput.tsx b/frontend/src/scenes/surveys/QuestionBranchingInput.tsx index be078d80f050fe..5e681eb2366586 100644 --- a/frontend/src/scenes/surveys/QuestionBranchingInput.tsx +++ b/frontend/src/scenes/surveys/QuestionBranchingInput.tsx @@ -54,8 +54,8 @@ export function QuestionBranchingInput({ ] : []), { - label: 'Confirmation message', - value: SurveyQuestionBranchingType.ConfirmationMessage, + label: survey.appearance.displayThankYouMessage ? 'Confirmation message' : 'End', + value: SurveyQuestionBranchingType.End, }, ...(hasResponseBasedBranching ? [ @@ -162,7 +162,7 @@ function QuestionResponseBasedBranchingInput({ : []), { label: 'Confirmation message', - value: SurveyQuestionBranchingType.ConfirmationMessage, + value: SurveyQuestionBranchingType.End, }, ...availableNextQuestions.map((question) => ({ label: truncate(`${question.questionIndex + 1}. ${question.question}`, 20), diff --git a/frontend/src/scenes/surveys/surveyLogic.test.ts b/frontend/src/scenes/surveys/surveyLogic.test.ts index efd4de827bde5c..38223aa0c0fdc2 100644 --- a/frontend/src/scenes/surveys/surveyLogic.test.ts +++ b/frontend/src/scenes/surveys/surveyLogic.test.ts @@ -802,7 +802,7 @@ describe('set response-based survey branching', () => { logic.actions.setResponseBasedBranchingForQuestion( questionIndex, 0, - SurveyQuestionBranchingType.ConfirmationMessage, + SurveyQuestionBranchingType.End, undefined ) logic.actions.setResponseBasedBranchingForQuestion( @@ -824,7 +824,7 @@ describe('set response-based survey branching', () => { ...SURVEY.questions[0], branching: { type: SurveyQuestionBranchingType.ResponseBased, - responseValues: { 0: SurveyQuestionBranchingType.ConfirmationMessage }, // Branching out to "Next question" is implicit + responseValues: { 0: SurveyQuestionBranchingType.End }, // Branching out to "Next question" is implicit }, }, { ...SURVEY.questions[1] }, @@ -1179,7 +1179,7 @@ describe('set response-based survey branching', () => { upperBoundLabel: 'Very likely', branching: { type: SurveyQuestionBranchingType.ResponseBased, - responseValues: { 2: 1, 5: SurveyQuestionBranchingType.ConfirmationMessage }, + responseValues: { 2: 1, 5: SurveyQuestionBranchingType.End }, }, }, { @@ -1192,7 +1192,7 @@ describe('set response-based survey branching', () => { upperBoundLabel: 'Very likely', branching: { type: SurveyQuestionBranchingType.ResponseBased, - responseValues: { 3: SurveyQuestionBranchingType.ConfirmationMessage }, + responseValues: { 3: SurveyQuestionBranchingType.End }, }, }, ] @@ -1257,7 +1257,7 @@ describe('set response-based survey branching', () => { scale: 5, lowerBoundLabel: 'Unlikely', upperBoundLabel: 'Very likely', - branching: { type: SurveyQuestionBranchingType.ConfirmationMessage }, + branching: { type: SurveyQuestionBranchingType.End }, }, { type: SurveyQuestionType.Rating, @@ -1314,7 +1314,7 @@ describe('set response-based survey branching', () => { question: '3', description: '', branching: { - type: SurveyQuestionBranchingType.ConfirmationMessage, + type: SurveyQuestionBranchingType.End, }, }, { diff --git a/frontend/src/scenes/surveys/surveyLogic.tsx b/frontend/src/scenes/surveys/surveyLogic.tsx index 2c7f48fd12ea96..f6eb637521ad84 100644 --- a/frontend/src/scenes/surveys/surveyLogic.tsx +++ b/frontend/src/scenes/surveys/surveyLogic.tsx @@ -680,9 +680,9 @@ export const surveyLogic = kea([ if (type === SurveyQuestionBranchingType.NextQuestion) { delete question.branching - } else if (type === SurveyQuestionBranchingType.ConfirmationMessage) { + } else if (type === SurveyQuestionBranchingType.End) { question.branching = { - type: SurveyQuestionBranchingType.ConfirmationMessage, + type: SurveyQuestionBranchingType.End, } } else if (type === SurveyQuestionBranchingType.ResponseBased) { if ( @@ -736,9 +736,8 @@ export const surveyLogic = kea([ if ('responseValues' in question.branching) { if (nextStep === SurveyQuestionBranchingType.NextQuestion) { delete question.branching.responseValues[responseValue] - } else if (nextStep === SurveyQuestionBranchingType.ConfirmationMessage) { - question.branching.responseValues[responseValue] = - SurveyQuestionBranchingType.ConfirmationMessage + } else if (nextStep === SurveyQuestionBranchingType.End) { + question.branching.responseValues[responseValue] = SurveyQuestionBranchingType.End } else if (nextStep === SurveyQuestionBranchingType.SpecificQuestion) { question.branching.responseValues[responseValue] = specificQuestionIndex } @@ -1022,7 +1021,7 @@ export const surveyLogic = kea([ return SurveyQuestionBranchingType.NextQuestion } - return SurveyQuestionBranchingType.ConfirmationMessage + return SurveyQuestionBranchingType.End }, ], getResponseBasedBranchingDropdownValue: [ @@ -1048,7 +1047,7 @@ export const surveyLogic = kea([ return SurveyQuestionBranchingType.NextQuestion } - return SurveyQuestionBranchingType.ConfirmationMessage + return SurveyQuestionBranchingType.End }, ], hasCycle: [ @@ -1060,7 +1059,7 @@ export const surveyLogic = kea([ graph.set(fromIndex, new Set()) } - if (question.branching?.type === SurveyQuestionBranchingType.ConfirmationMessage) { + if (question.branching?.type === SurveyQuestionBranchingType.End) { return } else if ( question.branching?.type === SurveyQuestionBranchingType.SpecificQuestion && diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 0d0888297d166a..afb1c56f1b7dab 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -2720,7 +2720,7 @@ export enum SurveyQuestionType { export enum SurveyQuestionBranchingType { NextQuestion = 'next_question', - ConfirmationMessage = 'confirmation_message', + End = 'end', ResponseBased = 'response_based', SpecificQuestion = 'specific_question', } @@ -2730,7 +2730,7 @@ interface NextQuestionBranching { } interface ConfirmationMessageBranching { - type: SurveyQuestionBranchingType.ConfirmationMessage + type: SurveyQuestionBranchingType.End } interface ResponseBasedBranching {