diff --git a/src/components/Poll/PollActions/AddCommentForm.tsx b/src/components/Poll/PollActions/AddCommentForm.tsx index b2cf392f7..2f6a0afc2 100644 --- a/src/components/Poll/PollActions/AddCommentForm.tsx +++ b/src/components/Poll/PollActions/AddCommentForm.tsx @@ -34,6 +34,14 @@ export const AddCommentForm = ({ close, messageId }: AddCommentFormProps) => { type: 'text', value: ownAnswer?.answer_text ?? '', }, + validator: (value) => { + const valueString = typeof value !== 'undefined' ? value.toString() : value; + const trimmedValue = valueString?.trim(); + if (!trimmedValue) { + return new Error(t('This field cannot be empty or contain only spaces')); + } + return; + }, }, }} onSubmit={async (value) => { diff --git a/src/components/Poll/PollActions/SuggestPollOptionForm.tsx b/src/components/Poll/PollActions/SuggestPollOptionForm.tsx index 971416aa8..ac50228a2 100644 --- a/src/components/Poll/PollActions/SuggestPollOptionForm.tsx +++ b/src/components/Poll/PollActions/SuggestPollOptionForm.tsx @@ -38,10 +38,12 @@ export const SuggestPollOptionForm = ({ value: '', }, validator: (value) => { - if (!value) return; - const existingOption = options.find( - (option) => option.text === (value as string).trim(), - ); + const valueString = typeof value !== 'undefined' ? value.toString() : value; + const trimmedValue = valueString?.trim(); + if (!trimmedValue) { + return new Error(t('This field cannot be empty or contain only spaces')); + } + const existingOption = options.find((option) => option.text === trimmedValue); if (existingOption) { return new Error(t('Option already exists')); } diff --git a/src/i18n/de.json b/src/i18n/de.json index fefa5103b..e1d639203 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -127,6 +127,7 @@ "Submit": "Absenden", "Suggest an option": "Eine Option vorschlagen", "Thinking...": "Denken...", + "This field cannot be empty or contain only spaces": "Dieses Feld darf nicht leer sein oder nur Leerzeichen enthalten", "This message did not meet our content guidelines": "Diese Nachricht entsprach nicht unseren Inhaltsrichtlinien", "This message was deleted...": "Diese Nachricht wurde gelöscht...", "Thread": "Thread", diff --git a/src/i18n/en.json b/src/i18n/en.json index cf7f7bfe1..ef0333a47 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -127,6 +127,7 @@ "Submit": "Submit", "Suggest an option": "Suggest an option", "Thinking...": "Thinking...", + "This field cannot be empty or contain only spaces": "This field cannot be empty or contain only spaces", "This message did not meet our content guidelines": "This message did not meet our content guidelines", "This message was deleted...": "This message was deleted...", "Thread": "Thread", diff --git a/src/i18n/es.json b/src/i18n/es.json index 1a537145b..3661729ef 100644 --- a/src/i18n/es.json +++ b/src/i18n/es.json @@ -129,6 +129,7 @@ "Submit": "Enviar", "Suggest an option": "Sugerir una opción", "Thinking...": "Pensando...", + "This field cannot be empty or contain only spaces": "Este campo no puede estar vacío o contener solo espacios", "This message did not meet our content guidelines": "Este mensaje no cumple con nuestras directrices de contenido", "This message was deleted...": "Este mensaje fue eliminado...", "Thread": "Hilo", diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 17044a2c4..231c652b0 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -129,6 +129,7 @@ "Submit": "Envoyer", "Suggest an option": "Suggérer une option", "Thinking...": "Réflexion...", + "This field cannot be empty or contain only spaces": "Ce champ ne peut pas être vide ou contenir uniquement des espaces", "This message did not meet our content guidelines": "Ce message ne respecte pas nos directives de contenu", "This message was deleted...": "Ce message a été supprimé...", "Thread": "Fil de discussion", diff --git a/src/i18n/hi.json b/src/i18n/hi.json index a8fa99eff..43ae84148 100644 --- a/src/i18n/hi.json +++ b/src/i18n/hi.json @@ -128,6 +128,7 @@ "Submit": "जमा करें", "Suggest an option": "एक विकल्प सुझाव दें", "Thinking...": "सोच रहा है...", + "This field cannot be empty or contain only spaces": "यह फ़ील्ड खाली नहीं हो सकता या केवल रिक्त स्थान नहीं रख सकता", "This message did not meet our content guidelines": "यह संदेश हमारे सामग्री दिशानिर्देशों के अनुरूप नहीं था", "This message was deleted...": "मैसेज हटा दिया गया", "Thread": "रिप्लाई थ्रेड", diff --git a/src/i18n/it.json b/src/i18n/it.json index bbceaa95f..347267faf 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -129,6 +129,7 @@ "Submit": "Invia", "Suggest an option": "Suggerisci un'opzione", "Thinking...": "Pensando...", + "This field cannot be empty or contain only spaces": "Questo campo non può essere vuoto o contenere solo spazi", "This message did not meet our content guidelines": "Questo messaggio non soddisfa le nostre linee guida sui contenuti", "This message was deleted...": "Questo messaggio è stato cancellato...", "Thread": "Discussione", diff --git a/src/i18n/ja.json b/src/i18n/ja.json index 88cace1c1..f104cb5ea 100644 --- a/src/i18n/ja.json +++ b/src/i18n/ja.json @@ -125,6 +125,7 @@ "Submit": "送信", "Suggest an option": "オプションを提案", "Thinking...": "考え中...", + "This field cannot be empty or contain only spaces": "このフィールドは空にすることはできません。また、空白文字のみを含むこともできません", "This message did not meet our content guidelines": "このメッセージはコンテンツガイドラインに適合していません", "This message was deleted...": "このメッセージは削除されました...", "Thread": "スレッド", diff --git a/src/i18n/ko.json b/src/i18n/ko.json index 93a6a8105..bee0124ec 100644 --- a/src/i18n/ko.json +++ b/src/i18n/ko.json @@ -125,6 +125,7 @@ "Submit": "제출", "Suggest an option": "옵션 제안", "Thinking...": "생각 중...", + "This field cannot be empty or contain only spaces": "이 필드는 비워둘 수 없으며 공백만 포함할 수도 없습니다", "This message did not meet our content guidelines": "이 메시지는 콘텐츠 가이드라인을 충족하지 않습니다.", "This message was deleted...": "이 메시지는 삭제되었습니다...", "Thread": "스레드", diff --git a/src/i18n/nl.json b/src/i18n/nl.json index c38445be6..1b500486e 100644 --- a/src/i18n/nl.json +++ b/src/i18n/nl.json @@ -127,6 +127,7 @@ "Submit": "Versturen", "Suggest an option": "Stel een optie voor", "Thinking...": "Denken...", + "This field cannot be empty or contain only spaces": "Dit veld mag niet leeg zijn of alleen spaties bevatten", "This message did not meet our content guidelines": "Dit bericht voldeed niet aan onze inhoudsrichtlijnen", "This message was deleted...": "Dit bericht was verwijderd", "Thread": "Draadje", diff --git a/src/i18n/pt.json b/src/i18n/pt.json index 0c7e002b5..e382ce1c0 100644 --- a/src/i18n/pt.json +++ b/src/i18n/pt.json @@ -129,6 +129,7 @@ "Submit": "Enviar", "Suggest an option": "Sugerir uma opção", "Thinking...": "Pensando...", + "This field cannot be empty or contain only spaces": "Este campo não pode estar vazio ou conter apenas espaços", "This message did not meet our content guidelines": "Esta mensagem não corresponde às nossas diretrizes de conteúdo", "This message was deleted...": "Esta mensagem foi excluída...", "Thread": "Fio", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 1281dcd43..ba3ce3e6f 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -131,6 +131,7 @@ "Submit": "Отправить", "Suggest an option": "Предложить вариант", "Thinking...": "Думаю...", + "This field cannot be empty or contain only spaces": "Это поле не может быть пустым или содержать только пробелы", "This message did not meet our content guidelines": "Сообщение не соответствует правилам", "This message was deleted...": "Сообщение было удалено...", "Thread": "Ветка", diff --git a/src/i18n/tr.json b/src/i18n/tr.json index b61f2274b..d943f6458 100644 --- a/src/i18n/tr.json +++ b/src/i18n/tr.json @@ -127,6 +127,7 @@ "Submit": "Gönder", "Suggest an option": "Bir seçenek önerin", "Thinking...": "Düşünüyor...", + "This field cannot be empty or contain only spaces": "Bu alan boş olamaz veya sadece boşluk içeremez", "This message did not meet our content guidelines": "Bu mesaj içerik yönergelerimize uygun değil", "This message was deleted...": "Bu mesaj silindi...", "Thread": "Konu",