From 60079a1b9e93a73b4562584a8fd4f3bad0e69bf4 Mon Sep 17 00:00:00 2001 From: Kilo-Oracle Date: Mon, 27 Apr 2026 15:12:09 +0000 Subject: [PATCH] fix(captain): evita erro ao adicionar FAQ com pergunta longa --- .../pageComponents/response/ResponseForm.vue | 11 +++++++++-- .../components/MessageContextMenu.vue | 9 ++++++++- .../app/models/captain/assistant_response.rb | 2 +- .../assistant_responses_controller_spec.rb | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/components-next/captain/pageComponents/response/ResponseForm.vue b/app/javascript/dashboard/components-next/captain/pageComponents/response/ResponseForm.vue index ce6370e98..985dc0620 100644 --- a/app/javascript/dashboard/components-next/captain/pageComponents/response/ResponseForm.vue +++ b/app/javascript/dashboard/components-next/captain/pageComponents/response/ResponseForm.vue @@ -2,7 +2,7 @@ import { reactive, computed, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useVuelidate } from '@vuelidate/core'; -import { required, minLength } from '@vuelidate/validators'; +import { required, minLength, maxLength } from '@vuelidate/validators'; import { useMapGetter } from 'dashboard/composables/store'; import Input from 'dashboard/components-next/input/Input.vue'; @@ -39,11 +39,17 @@ const initialState = { assistant_id: '', }; +const QUESTION_MAX_LENGTH = 255; + const state = reactive({ ...initialState }); const validationRules = computed(() => { const rules = { - question: { required, minLength: minLength(1) }, + question: { + required, + minLength: minLength(1), + maxLength: maxLength(QUESTION_MAX_LENGTH), + }, answer: { required, minLength: minLength(1) }, }; @@ -123,6 +129,7 @@ watch( :placeholder="t('CAPTAIN.RESPONSES.FORM.QUESTION.PLACEHOLDER')" :message="formErrors.question" :message-type="formErrors.question ? 'error' : 'info'" + :maxlength="QUESTION_MAX_LENGTH" />