From bb4d4e5fb2cf76cdc8a7e651ff80a37b141a5438 Mon Sep 17 00:00:00 2001 From: nlachat-compassion Date: Mon, 18 Nov 2024 09:49:28 +0100 Subject: [PATCH] T1889 cannot send letter on mycompassion (#53) * Setup test infrastructure * Add warning if user tries to send/preview a letter with an empty text * Add translations for warning message * Simplify check * Remove useless tests * Fix pre-commit * Change alert warning->danger to be clearer to user * Update my_compassion/i18n/de.po Fix translation Sie -> Du Co-authored-by: ecino --------- Co-authored-by: ecino --- muskathlon/README.rst | 18 +++++++-------- my_compassion/README.rst | 6 ++--- my_compassion/i18n/de.po | 8 +++++++ my_compassion/i18n/fr_CH.po | 7 ++++++ my_compassion/i18n/it.po | 7 ++++++ my_compassion/static/src/js/write_a_letter.js | 6 +++++ .../templates/my_account_write_a_letter.xml | 7 ++++++ my_compassion_segmentation/README.rst | 2 +- website_child_protection/README.rst | 2 +- website_event_compassion/README.rst | 8 +++---- website_sale_donation/README.rst | 4 ++-- website_sponsorship/README.rst | 22 +++++++++---------- .../static/description/index.html | 4 ++-- 13 files changed, 68 insertions(+), 33 deletions(-) diff --git a/muskathlon/README.rst b/muskathlon/README.rst index 7c210db..3d88192 100644 --- a/muskathlon/README.rst +++ b/muskathlon/README.rst @@ -24,11 +24,11 @@ Muskathlon Adds a website portal for Muskathlon Events : -- list of events -- event page with participants -- donation -- registration -- runner portal +- list of events +- event page with participants +- donation +- registration +- runner portal Reports for sending information to 4M: - list with useful data about the muskathlon event - bar graph amount by ambassador - fields format for a @@ -60,10 +60,10 @@ Authors Contributors ------------ -- Sebastien Toth -- Nicolas Badoux -- Samuel Fringeli -- Emanuel Cino +- Sebastien Toth +- Nicolas Badoux +- Samuel Fringeli +- Emanuel Cino Maintainers ----------- diff --git a/my_compassion/README.rst b/my_compassion/README.rst index c7e1459..7f6f5df 100644 --- a/my_compassion/README.rst +++ b/my_compassion/README.rst @@ -50,9 +50,9 @@ Authors Contributors ------------ -- Sebastien Toth -- Christopher Meier -- Théo Nikles +- Sebastien Toth +- Christopher Meier +- Théo Nikles Maintainers ----------- diff --git a/my_compassion/i18n/de.po b/my_compassion/i18n/de.po index 5f130a9..1ce79ac 100644 --- a/my_compassion/i18n/de.po +++ b/my_compassion/i18n/de.po @@ -764,6 +764,14 @@ msgstr "" "Wenn der Fehler weiterhin besteht, kontaktiere uns auf info@compassion.ch, " "damit wir das Problem lösen können." +#. module: my_compassion +#: model_terms:ir.ui.view,arch_db:my_compassion.letter_actions +msgid "" +"The text of your letter is empty. Please add some text and try again." +msgstr "" +"Der Text Deines Briefes ist leer." +"Bitte füge Text hinzu und versuche es erneut." + #. module: my_compassion #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_letters #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_pictures diff --git a/my_compassion/i18n/fr_CH.po b/my_compassion/i18n/fr_CH.po index 71d9bd0..b4f017b 100644 --- a/my_compassion/i18n/fr_CH.po +++ b/my_compassion/i18n/fr_CH.po @@ -773,6 +773,13 @@ msgstr "" "Si l'erreur persiste, Merci de nous contacter à info@compassion.ch pour nous " "signaler le problème." +#. module: my_compassion +#: model_terms:ir.ui.view,arch_db:my_compassion.letter_actions +msgid "" +"The text of your letter is empty. Please add some text and try again." +msgstr "" +"Le texte de votre lettre est vide. Veuillez ajouter du texte et réessayer." + #. module: my_compassion #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_letters #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_pictures diff --git a/my_compassion/i18n/it.po b/my_compassion/i18n/it.po index cef72dd..5d8d40f 100644 --- a/my_compassion/i18n/it.po +++ b/my_compassion/i18n/it.po @@ -766,6 +766,13 @@ msgstr "" "perderlo e contattaci all'indirizzo info@compassion.ch per segnalare il " "problema." +#. module: my_compassion +#: model_terms:ir.ui.view,arch_db:my_compassion.letter_actions +msgid "" +"The text of your letter is empty. Please add some text and try again." +msgstr "" +"Il testo della tua lettera è vuoto. Si prega di aggiungere del testo e riprovare." + #. module: my_compassion #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_letters #: model_terms:ir.ui.view,arch_db:my_compassion.my_children_pictures diff --git a/my_compassion/static/src/js/write_a_letter.js b/my_compassion/static/src/js/write_a_letter.js index efd5f13..eed7f96 100644 --- a/my_compassion/static/src/js/write_a_letter.js +++ b/my_compassion/static/src/js/write_a_letter.js @@ -258,6 +258,12 @@ function startStopLoading(type) { * we can send a letter directly if the user pressed the corresponding button */ async function createLetter(mode = "preview") { + // Check if text is empty (and avoid sending the request if it is) + if (letter_content.value.length === 0) { + displayAlert("letter_text_empty_warning"); + return; + } + startStopLoading(mode); const params = new URLSearchParams(window.location.search); diff --git a/my_compassion/templates/my_account_write_a_letter.xml b/my_compassion/templates/my_account_write_a_letter.xml index 19d28a5..a6ae373 100644 --- a/my_compassion/templates/my_account_write_a_letter.xml +++ b/my_compassion/templates/my_account_write_a_letter.xml @@ -280,6 +280,13 @@ +