Skip to content

Commit fd3fedb

Browse files
authored
fix: fixes follow up UI when email is hidden in the contact info question (formbricks#6388)
1 parent 88b1e63 commit fd3fedb

10 files changed

Lines changed: 23 additions & 74 deletions

File tree

apps/web/locales/de-DE.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Versteckt",
215215
"hidden_field": "Verstecktes Feld",
216216
"hidden_fields": "Versteckte Felder",
217-
"hide": "Verstecken",
218217
"hide_column": "Spalte ausblenden",
219218
"image": "Bild",
220219
"images": "Bilder",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Nicht berechtigt",
274273
"not_connected": "Nicht verbunden",
275274
"note": "Notiz",
276-
"notes": "Notizen",
277275
"notifications": "Benachrichtigungen",
278276
"number": "Nummer",
279277
"off": "Aus",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Ausgewählte Fragen",
351349
"selection": "Auswahl",
352350
"selections": "Auswahlen",
353-
"send": "Senden",
354351
"send_test_email": "Test-E-Mail senden",
355352
"session_not_found": "Sitzung nicht gefunden",
356353
"settings": "Einstellungen",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Adresszeile 1",
16391636
"address_line_2": "Adresszeile 2",
1640-
"an_error_occurred_creating_a_new_note": "Beim Erstellen einer neuen Notiz ist ein Fehler aufgetreten",
16411637
"an_error_occurred_deleting_the_tag": "Beim Löschen des Tags ist ein Fehler aufgetreten",
1642-
"an_error_occurred_resolving_a_note": "Beim Auflösen einer Notiz ist ein Fehler aufgetreten",
1643-
"an_error_occurred_updating_a_note": "Beim Aktualisieren einer Notiz ist ein Fehler aufgetreten",
16441638
"browser": "Browser",
16451639
"city": "Stadt",
16461640
"company": "Firma",
@@ -1658,7 +1652,6 @@
16581652
"os": "Betriebssystem",
16591653
"person_attributes": "Personenattribute",
16601654
"phone": "Telefon",
1661-
"resolve": "Lösen",
16621655
"respondent_skipped_questions": "Der Befragte hat diese Fragen übersprungen.",
16631656
"response_deleted_successfully": "Antwort erfolgreich gelöscht.",
16641657
"single_use_id": "Einmalige ID",

apps/web/locales/en-US.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Hidden",
215215
"hidden_field": "Hidden field",
216216
"hidden_fields": "Hidden fields",
217-
"hide": "Hide",
218217
"hide_column": "Hide column",
219218
"image": "Image",
220219
"images": "Images",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Not authorized",
274273
"not_connected": "Not Connected",
275274
"note": "Note",
276-
"notes": "Notes",
277275
"notifications": "Notifications",
278276
"number": "Number",
279277
"off": "Off",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Selected questions",
351349
"selection": "Selection",
352350
"selections": "Selections",
353-
"send": "Send",
354351
"send_test_email": "Send test email",
355352
"session_not_found": "Session not found",
356353
"settings": "Settings",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Address Line 1",
16391636
"address_line_2": "Address Line 2",
1640-
"an_error_occurred_creating_a_new_note": "An error occurred creating a new note",
16411637
"an_error_occurred_deleting_the_tag": "An error occurred deleting the tag",
1642-
"an_error_occurred_resolving_a_note": "An error occurred resolving a note",
1643-
"an_error_occurred_updating_a_note": "An error occurred updating a note",
16441638
"browser": "Browser",
16451639
"city": "City",
16461640
"company": "Company",
@@ -1658,7 +1652,6 @@
16581652
"os": "OS",
16591653
"person_attributes": "Person attributes",
16601654
"phone": "Phone",
1661-
"resolve": "Resolve",
16621655
"respondent_skipped_questions": "Respondent skipped these questions.",
16631656
"response_deleted_successfully": "Response deleted successfully.",
16641657
"single_use_id": "SingleUse ID",

apps/web/locales/fr-FR.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Caché",
215215
"hidden_field": "Champ caché",
216216
"hidden_fields": "Champs cachés",
217-
"hide": "Cacher",
218217
"hide_column": "Cacher la colonne",
219218
"image": "Image",
220219
"images": "Images",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Non autorisé",
274273
"not_connected": "Non connecté",
275274
"note": "Remarque",
276-
"notes": "Notes",
277275
"notifications": "Notifications",
278276
"number": "Numéro",
279277
"off": "Éteint",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Questions sélectionnées",
351349
"selection": "Sélection",
352350
"selections": "Sélections",
353-
"send": "Envoyer",
354351
"send_test_email": "Envoyer un e-mail de test",
355352
"session_not_found": "Session non trouvée",
356353
"settings": "Paramètres",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Ligne d'adresse 1",
16391636
"address_line_2": "Ligne d'adresse 2",
1640-
"an_error_occurred_creating_a_new_note": "Une erreur est survenue lors de la création d'une nouvelle note.",
16411637
"an_error_occurred_deleting_the_tag": "Une erreur est survenue lors de la suppression de l'étiquette.",
1642-
"an_error_occurred_resolving_a_note": "Une erreur est survenue lors de la résolution d'une note.",
1643-
"an_error_occurred_updating_a_note": "Une erreur est survenue lors de la mise à jour d'une note.",
16441638
"browser": "Navigateur",
16451639
"city": "Ville",
16461640
"company": "Société",
@@ -1658,7 +1652,6 @@
16581652
"os": "Système d'exploitation",
16591653
"person_attributes": "Attributs de la personne",
16601654
"phone": "Téléphone",
1661-
"resolve": "Résoudre",
16621655
"respondent_skipped_questions": "Le répondant a sauté ces questions.",
16631656
"response_deleted_successfully": "Réponse supprimée avec succès.",
16641657
"single_use_id": "Identifiant à usage unique",

apps/web/locales/pt-BR.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Escondido",
215215
"hidden_field": "Campo oculto",
216216
"hidden_fields": "Campos ocultos",
217-
"hide": "esconder",
218217
"hide_column": "Ocultar coluna",
219218
"image": "imagem",
220219
"images": "Imagens",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Não autorizado",
274273
"not_connected": "Desconectado",
275274
"note": "Nota",
276-
"notes": "Anotações",
277275
"notifications": "Notificações",
278276
"number": "Número",
279277
"off": "desligado",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Perguntas selecionadas",
351349
"selection": "seleção",
352350
"selections": "seleções",
353-
"send": "Enviar",
354351
"send_test_email": "Enviar e-mail de teste",
355352
"session_not_found": "Sessão não encontrada",
356353
"settings": "Configurações",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Endereço Linha 1",
16391636
"address_line_2": "Complemento",
1640-
"an_error_occurred_creating_a_new_note": "Deu erro ao criar uma nova nota",
16411637
"an_error_occurred_deleting_the_tag": "Ocorreu um erro ao deletar a tag",
1642-
"an_error_occurred_resolving_a_note": "Ocorreu um erro ao resolver uma nota",
1643-
"an_error_occurred_updating_a_note": "Ocorreu um erro ao atualizar uma nota",
16441638
"browser": "navegador",
16451639
"city": "Cidade",
16461640
"company": "empresa",
@@ -1658,7 +1652,6 @@
16581652
"os": "sistema operacional",
16591653
"person_attributes": "Atributos da pessoa",
16601654
"phone": "Celular",
1661-
"resolve": "resolver",
16621655
"respondent_skipped_questions": "Respondente pulou essas perguntas.",
16631656
"response_deleted_successfully": "Resposta deletada com sucesso.",
16641657
"single_use_id": "ID de Uso Único",

apps/web/locales/pt-PT.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Oculto",
215215
"hidden_field": "Campo oculto",
216216
"hidden_fields": "Campos ocultos",
217-
"hide": "Esconder",
218217
"hide_column": "Ocultar coluna",
219218
"image": "Imagem",
220219
"images": "Imagens",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Não autorizado",
274273
"not_connected": "Não Conectado",
275274
"note": "Nota",
276-
"notes": "Notas",
277275
"notifications": "Notificações",
278276
"number": "Número",
279277
"off": "Desligado",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Perguntas selecionadas",
351349
"selection": "Seleção",
352350
"selections": "Seleções",
353-
"send": "Enviar",
354351
"send_test_email": "Enviar email de teste",
355352
"session_not_found": "Sessão não encontrada",
356353
"settings": "Configurações",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Endereço Linha 1",
16391636
"address_line_2": "Endereço Linha 2",
1640-
"an_error_occurred_creating_a_new_note": "Ocorreu um erro ao criar uma nova nota",
16411637
"an_error_occurred_deleting_the_tag": "Ocorreu um erro ao eliminar a etiqueta",
1642-
"an_error_occurred_resolving_a_note": "Ocorreu um erro ao resolver uma nota",
1643-
"an_error_occurred_updating_a_note": "Ocorreu um erro ao atualizar uma nota",
16441638
"browser": "Navegador",
16451639
"city": "Cidade",
16461640
"company": "Empresa",
@@ -1658,7 +1652,6 @@
16581652
"os": "SO",
16591653
"person_attributes": "Atributos da pessoa",
16601654
"phone": "Telefone",
1661-
"resolve": "Resolver",
16621655
"respondent_skipped_questions": "O respondente saltou estas perguntas.",
16631656
"response_deleted_successfully": "Resposta eliminada com sucesso.",
16641657
"single_use_id": "ID de Uso Único",

apps/web/locales/ro-RO.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "Ascuns",
215215
"hidden_field": "Câmp ascuns",
216216
"hidden_fields": "Câmpuri ascunse",
217-
"hide": "Ascunde",
218217
"hide_column": "Ascunde coloana",
219218
"image": "Imagine",
220219
"images": "Imagini",
@@ -273,7 +272,6 @@
273272
"not_authorized": "Neautorizat",
274273
"not_connected": "Neconectat",
275274
"note": "Notă",
276-
"notes": "Notele",
277275
"notifications": "Notificări",
278276
"number": "Număr",
279277
"off": "Oprit",
@@ -350,7 +348,6 @@
350348
"selected_questions": "Întrebări selectate",
351349
"selection": "Selecție",
352350
"selections": "Selecții",
353-
"send": "Trimite",
354351
"send_test_email": "Trimite email de test",
355352
"session_not_found": "Sesiune inexistentă",
356353
"settings": "Setări",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "Adresă Linie 1",
16391636
"address_line_2": "Adresă Linie 2",
1640-
"an_error_occurred_creating_a_new_note": "A apărut o eroare la crearea unei noi note",
16411637
"an_error_occurred_deleting_the_tag": "A apărut o eroare la ștergerea etichetei",
1642-
"an_error_occurred_resolving_a_note": "A apărut o eroare la rezolvarea unei note",
1643-
"an_error_occurred_updating_a_note": "A apărut o eroare la actualizarea unei note",
16441638
"browser": "Browser",
16451639
"city": "Oraș",
16461640
"company": "Companie",
@@ -1658,7 +1652,6 @@
16581652
"os": "SO",
16591653
"person_attributes": "Atribute persoană",
16601654
"phone": "Telefon",
1661-
"resolve": "Rezolvă",
16621655
"respondent_skipped_questions": "Respondenții au sărit peste aceste întrebări.",
16631656
"response_deleted_successfully": "Răspuns șters cu succes.",
16641657
"single_use_id": "IdentificatorUnicFolositOdată",

apps/web/locales/zh-Hant-TW.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"hidden": "隱藏",
215215
"hidden_field": "隱藏欄位",
216216
"hidden_fields": "隱藏欄位",
217-
"hide": "隱藏",
218217
"hide_column": "隱藏欄位",
219218
"image": "圖片",
220219
"images": "圖片",
@@ -273,7 +272,6 @@
273272
"not_authorized": "未授權",
274273
"not_connected": "未連線",
275274
"note": "筆記",
276-
"notes": "筆記",
277275
"notifications": "通知",
278276
"number": "數字",
279277
"off": "關閉",
@@ -350,7 +348,6 @@
350348
"selected_questions": "選取的問題",
351349
"selection": "選取",
352350
"selections": "選取",
353-
"send": "發送",
354351
"send_test_email": "發送測試電子郵件",
355352
"session_not_found": "找不到工作階段",
356353
"settings": "設定",
@@ -1637,10 +1634,7 @@
16371634
"responses": {
16381635
"address_line_1": "地址 1",
16391636
"address_line_2": "地址 2",
1640-
"an_error_occurred_creating_a_new_note": "建立新筆記時發生錯誤",
16411637
"an_error_occurred_deleting_the_tag": "刪除標籤時發生錯誤",
1642-
"an_error_occurred_resolving_a_note": "解決筆記時發生錯誤",
1643-
"an_error_occurred_updating_a_note": "更新筆記時發生錯誤",
16441638
"browser": "瀏覽器",
16451639
"city": "城市",
16461640
"company": "公司",
@@ -1658,7 +1652,6 @@
16581652
"os": "作業系統",
16591653
"person_attributes": "人員屬性",
16601654
"phone": "電話",
1661-
"resolve": "解決",
16621655
"respondent_skipped_questions": "回應者跳過這些問題。",
16631656
"response_deleted_successfully": "回應已成功刪除。",
16641657
"single_use_id": "單次使用 ID",

apps/web/modules/survey/follow-ups/components/follow-up-item.tsx

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,25 @@ export const FollowUpItem = ({
4444

4545
if (!to) return true;
4646

47-
const matchedQuestion = localSurvey.questions.find((question) => question.id === to);
48-
const matchedHiddenField = (localSurvey.hiddenFields?.fieldIds ?? []).find((fieldId) => fieldId === to);
47+
const matchedQuestion = localSurvey.questions.find((question) => {
48+
if (question.id !== to) {
49+
return false;
50+
}
51+
52+
if (question.type === TSurveyQuestionTypeEnum.OpenText) {
53+
return question.inputType === "email";
54+
}
55+
56+
if (question.type === TSurveyQuestionTypeEnum.ContactInfo) {
57+
return question.email.show;
58+
}
59+
60+
return false;
61+
});
62+
63+
const matchedHiddenField = localSurvey.hiddenFields?.enabled
64+
? (localSurvey.hiddenFields.fieldIds ?? []).find((fieldId) => fieldId === to)
65+
: undefined;
4966

5067
const updatedTeamMemberDetails = teamMemberDetails.map((teamMemberDetail) => {
5168
if (teamMemberDetail.email === userEmail) {
@@ -65,26 +82,7 @@ export const FollowUpItem = ({
6582

6683
const matchedEmail = updatedTeamMembers.find((detail) => detail.email === to);
6784

68-
if (!matchedQuestion && !matchedHiddenField && !matchedEmail) return true;
69-
70-
if (matchedQuestion) {
71-
if (
72-
![TSurveyQuestionTypeEnum.OpenText, TSurveyQuestionTypeEnum.ContactInfo].includes(
73-
matchedQuestion.type
74-
)
75-
) {
76-
return true;
77-
}
78-
79-
if (
80-
matchedQuestion.type === TSurveyQuestionTypeEnum.OpenText &&
81-
matchedQuestion.inputType !== "email"
82-
) {
83-
return true;
84-
}
85-
}
86-
87-
return false;
85+
return !matchedQuestion && !matchedHiddenField && !matchedEmail;
8886
}, [
8987
followUp.action.properties,
9088
localSurvey.hiddenFields?.fieldIds,

apps/web/modules/survey/follow-ups/components/follow-up-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const FollowUpModal = ({
104104

105105
const openTextAndContactQuestions = questions.filter((question) => {
106106
if (question.type === TSurveyQuestionTypeEnum.ContactInfo) {
107-
return true;
107+
return question.email.show;
108108
}
109109

110110
if (question.type === TSurveyQuestionTypeEnum.OpenText) {

packages/types/surveys/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,13 +1343,13 @@ export const ZSurvey = z
13431343
}
13441344

13451345
if (q.type === TSurveyQuestionTypeEnum.ContactInfo) {
1346-
return true;
1346+
return q.email.show;
13471347
}
13481348

13491349
return false;
13501350
})
13511351
.map((q) => q.id),
1352-
...(survey.hiddenFields.fieldIds ?? []),
1352+
...(survey.hiddenFields.enabled ? (survey.hiddenFields.fieldIds ?? []) : []),
13531353
];
13541354

13551355
if (validOptions.findIndex((option) => option === followUp.action.properties.to) === -1) {

0 commit comments

Comments
 (0)