From d3caf30bf34852c5a62f96001757b83affe645e6 Mon Sep 17 00:00:00 2001 From: Fabrice Gangler Date: Fri, 20 Nov 2020 21:01:59 +0100 Subject: [PATCH 1/3] allow CGU URL and Legal Notice URL to be configured in .env file Refs: #5754 --- config/env.example.optional | 4 ++++ config/initializers/urls.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/env.example.optional b/config/env.example.optional index fd59171fa..fc246b840 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -9,6 +9,10 @@ APPLICATION_BASE_URL="https://www.demarches-simplifiees.fr" # Utilisation de France Connect # FRANCE_CONNECT_ENABLED="disabled" # "enabled" par défaut +# Personnalisation d'instance - URLs des CGU et des mentions légales +# CGU_URL="" +# MENTIONS_LEGALES_URL="" + # Personnalisation d'instance - Adresses Email de l'application et téléphone # CONTACT_EMAIL="" # EQUIPE_EMAIL="" diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 268174f5f..82ff12802 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -22,8 +22,8 @@ ADMINISTRATEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-administrateur"]. INSTRUCTEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-accompagnateur"].join("/") CADRE_JURIDIQUE_URL = [DOC_URL, "tutoriels/video-le-cadre-juridique"].join("/") LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/") -CGU_URL = [DOC_URL, "cgu"].join("/") -MENTIONS_LEGALES_URL = [DOC_URL, "mentions-legales"].join("/") +CGU_URL = ENV.fetch("CGU_URL", [DOC_URL, "cgu"].join("/")) +MENTIONS_LEGALES_URL = ENV.fetch("MENTIONS_LEGALES_URL", [DOC_URL, "mentions-legales"].join("/")) API_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "api"].join("/") WEBHOOK_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "webhook"].join("/") ARCHIVAGE_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "archivage-longue-duree-des-demarches"].join("/") From 00ef56db10e7b68d2f272432513bb2e5c191df71 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 25 Nov 2020 10:46:20 +0100 Subject: [PATCH 2/3] [GraphQL] fix attachment upload - `identify` will return `true` sometime --- app/graphql/mutations/base_mutation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb index 5113603d0..ec677ef18 100644 --- a/app/graphql/mutations/base_mutation.rb +++ b/app/graphql/mutations/base_mutation.rb @@ -5,6 +5,7 @@ module Mutations begin blob = ActiveStorage::Blob.find_signed(blob_id) blob.identify + nil rescue ActiveStorage::FileNotFoundError return { errors: ['Le fichier n’a pas été correctement téléversé sur le serveur de stockage'] } rescue ActiveSupport::MessageVerifier::InvalidSignature From cac981cf42dc76013411156f6acbacf45c31fe9e Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 25 Nov 2020 10:46:34 +0100 Subject: [PATCH 3/3] fix warning with ruby 2.7 --- spec/controllers/api/v2/graphql_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/api/v2/graphql_controller_spec.rb b/spec/controllers/api/v2/graphql_controller_spec.rb index 1a9c36c48..d30329d22 100644 --- a/spec/controllers/api/v2/graphql_controller_spec.rb +++ b/spec/controllers/api/v2/graphql_controller_spec.rb @@ -37,7 +37,7 @@ describe API::V2::GraphqlController do } end let(:blob) do - blob = ActiveStorage::Blob.create_before_direct_upload!(blob_info) + blob = ActiveStorage::Blob.create_before_direct_upload!(**blob_info) blob.upload(file) blob end