From 72db9084a8835170264419b4453719e9240be1d1 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 24 Oct 2018 13:16:50 +0200 Subject: [PATCH 01/21] Fix old carto exception when no selection is passed --- app/controllers/users/carte_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users/carte_controller.rb b/app/controllers/users/carte_controller.rb index 855a7dd52..9c952d513 100644 --- a/app/controllers/users/carte_controller.rb +++ b/app/controllers/users/carte_controller.rb @@ -32,7 +32,7 @@ class Users::CarteController < UsersController @dossier = current_user_dossier @data = {} - geo_json = JSON.parse(params.required(:selection)) + geo_json = JSON.parse(params.fetch(:selection, '[]')) if geo_json.first == ["error", "TooManyPolygons"] @error = true From 916dd17873470f6cfb8f50d2d55b146d6f0148c5 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 16:00:07 +0200 Subject: [PATCH 02/21] =?UTF-8?q?domains=5Ffrom=5Fenv=20=E2=86=92=20domain?= =?UTF-8?q?s=5Ffor=5Fstage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/deploy.rake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index 749c22d74..06fa84348 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -1,16 +1,16 @@ -def domains_from_env(env) - case env +def domains_for_stage(stage) + case stage when 'dev' ['web1.dev', 'web2.dev'] when 'prod' ['web1', 'web2'] else - raise "STAGE #{env} is unknown. It must be either dev or prod" + raise "STAGE #{stage} is unknown. It must be either dev or prod." end end task :deploy do - domains = domains_from_env(ENV.fetch('STAGE')) + domains = domains_for_stage(ENV.fetch('STAGE')) branch = ENV.fetch('BRANCH') domains.each do |domain| @@ -19,7 +19,7 @@ task :deploy do end task :setup do - domains = domains_from_env(ENV['STAGE']) + domains = domains_for_stage(ENV.fetch('STAGE')) domains.each do |domain| sh "mina setup domain=#{domain} force_asset_precompile=true" From eb6132b5cbb0dba5e88c40ff718616dbe840ef71 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:15:36 +0200 Subject: [PATCH 03/21] Move the setup task before the deploy task --- lib/tasks/deploy.rake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index 06fa84348..2bcc57a37 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -9,6 +9,14 @@ def domains_for_stage(stage) end end +task :setup do + domains = domains_for_stage(ENV.fetch('STAGE')) + + domains.each do |domain| + sh "mina setup domain=#{domain} force_asset_precompile=true" + end +end + task :deploy do domains = domains_for_stage(ENV.fetch('STAGE')) branch = ENV.fetch('BRANCH') @@ -17,11 +25,3 @@ task :deploy do sh "mina deploy domain=#{domain} branch=#{branch} force_asset_precompile=true" end end - -task :setup do - domains = domains_for_stage(ENV.fetch('STAGE')) - - domains.each do |domain| - sh "mina setup domain=#{domain} force_asset_precompile=true" - end -end From db540471d4bb518a2c27c6e77eed8dd667fdd06d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:02:37 +0200 Subject: [PATCH 04/21] Remove a duplicated comment --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 8e1dcedbe..dffb08808 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -30,7 +30,7 @@ set :shared_dirs, [ ] set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" -set :forward_agent, true # SSH forward_agent. +set :forward_agent, true puts "Deploy to #{ENV.fetch('domain')}, branch: #{ENV.fetch('branch')}" From 883c981165d0e46ba39ffbb2ad9d06d432413884 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:03:06 +0200 Subject: [PATCH 05/21] Group single-line parameter definitions --- config/deploy.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index dffb08808..363ab7ee4 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -19,6 +19,8 @@ deploy_to = '/var/www/ds' set :deploy_to, deploy_to set :user, 'ds' set :branch, ENV.fetch('branch') +set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" +set :forward_agent, true # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. # They will be linked in the 'deploy:link_shared_paths' step. @@ -29,9 +31,6 @@ set :shared_dirs, [ 'tmp/cache' ] -set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" -set :forward_agent, true - puts "Deploy to #{ENV.fetch('domain')}, branch: #{ENV.fetch('branch')}" # This task is the environment that is loaded for most commands, such as From fda1218a5f125578208dae4f5256933f18c00f55 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:03:57 +0200 Subject: [PATCH 06/21] Keep the same order between shared_dirs and setup --- config/deploy.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 363ab7ee4..a64cb2ef3 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -39,14 +39,14 @@ task :setup do command %[mkdir -p "#{deploy_to}/shared/log"] command %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"] + command %[mkdir -p "#{deploy_to}/shared/sockets"] + command %[chmod g+rx,u+rwx "#{deploy_to}/shared/sockets"] + command %[mkdir -p "#{deploy_to}/shared/tmp/pids"] command %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/pids"] command %[mkdir -p "#{deploy_to}/shared/tmp/cache"] command %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/cache"] - - command %[mkdir -p "#{deploy_to}/shared/sockets"] - command %[chmod g+rx,u+rwx "#{deploy_to}/shared/sockets"] end namespace :yarn do From b9c91cbab431de5a820895bfa21860b20318c2e4 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:06:18 +0200 Subject: [PATCH 07/21] Factorize some code --- config/deploy.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index a64cb2ef3..62f2c117d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -24,29 +24,23 @@ set :forward_agent, true # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. # They will be linked in the 'deploy:link_shared_paths' step. -set :shared_dirs, [ +shared_dirs = [ 'log', 'sockets', 'tmp/pids', 'tmp/cache' ] +set :shared_dirs, shared_dirs puts "Deploy to #{ENV.fetch('domain')}, branch: #{ENV.fetch('branch')}" # This task is the environment that is loaded for most commands, such as # `mina deploy` or `mina rake`. task :setup do - command %[mkdir -p "#{deploy_to}/shared/log"] - command %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"] - - command %[mkdir -p "#{deploy_to}/shared/sockets"] - command %[chmod g+rx,u+rwx "#{deploy_to}/shared/sockets"] - - command %[mkdir -p "#{deploy_to}/shared/tmp/pids"] - command %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/pids"] - - command %[mkdir -p "#{deploy_to}/shared/tmp/cache"] - command %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/cache"] + shared_dirs.each do |dir| + command %[mkdir -p "#{deploy_to}/shared/#{dir}"] + command %[chmod g+rx,u+rwx "#{deploy_to}/shared/#{dir}"] + end end namespace :yarn do From 70a3b9737cc3afcf397fab9078bde00b3cd5630d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:07:06 +0200 Subject: [PATCH 08/21] Improve a comment --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 62f2c117d..4fafb187c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -22,7 +22,7 @@ set :branch, ENV.fetch('branch') set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" set :forward_agent, true -# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. +# Manually create these paths in shared/ on your server. # They will be linked in the 'deploy:link_shared_paths' step. shared_dirs = [ 'log', From 755965306284914e42d1e9ad4696179241fe4dd5 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:20:38 +0200 Subject: [PATCH 09/21] Make the comments-code order match --- config/deploy.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 4fafb187c..1cf20f58d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -14,13 +14,13 @@ require 'mina/rbenv' # user - Username in the server to SSH to set :domain, ENV.fetch('domain') -set :repository, 'https://github.com/betagouv/tps.git' deploy_to = '/var/www/ds' set :deploy_to, deploy_to -set :user, 'ds' +set :repository, 'https://github.com/betagouv/tps.git' set :branch, ENV.fetch('branch') -set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" set :forward_agent, true +set :user, 'ds' +set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" # Manually create these paths in shared/ on your server. # They will be linked in the 'deploy:link_shared_paths' step. From 4026984852aa2e51cdeecffd2b67c0ce81f59a25 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:21:19 +0200 Subject: [PATCH 10/21] Move a comment in the comment block --- config/deploy.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 1cf20f58d..fdb30022c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -12,6 +12,8 @@ require 'mina/rbenv' # Advanced settings: # forward_agent - SSH forward_agent # user - Username in the server to SSH to +# shared_dirs - Manually create these paths in shared/ on your server. +# They will be linked in the 'deploy:link_shared_paths' step. set :domain, ENV.fetch('domain') deploy_to = '/var/www/ds' @@ -21,9 +23,6 @@ set :branch, ENV.fetch('branch') set :forward_agent, true set :user, 'ds' set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" - -# Manually create these paths in shared/ on your server. -# They will be linked in the 'deploy:link_shared_paths' step. shared_dirs = [ 'log', 'sockets', From 1c55a38e8146a89127b649ae739b896e3b3e7d51 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:21:45 +0200 Subject: [PATCH 11/21] Move variable definition to the top --- config/deploy.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index fdb30022c..cdd8be7c8 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -15,21 +15,22 @@ require 'mina/rbenv' # shared_dirs - Manually create these paths in shared/ on your server. # They will be linked in the 'deploy:link_shared_paths' step. -set :domain, ENV.fetch('domain') deploy_to = '/var/www/ds' -set :deploy_to, deploy_to -set :repository, 'https://github.com/betagouv/tps.git' -set :branch, ENV.fetch('branch') -set :forward_agent, true -set :user, 'ds' -set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" shared_dirs = [ 'log', 'sockets', 'tmp/pids', 'tmp/cache' ] + +set :domain, ENV.fetch('domain') +set :deploy_to, deploy_to +set :repository, 'https://github.com/betagouv/tps.git' +set :branch, ENV.fetch('branch') +set :forward_agent, true +set :user, 'ds' set :shared_dirs, shared_dirs +set :rbenv_path, "/home/ds/.rbenv/bin/rbenv" puts "Deploy to #{ENV.fetch('domain')}, branch: #{ENV.fetch('branch')}" From 21028bd97bfef0e9bbe84490329e31e696077be1 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:23:41 +0200 Subject: [PATCH 12/21] Extract a task to make things more atomic --- config/deploy.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index cdd8be7c8..0b4a91f29 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -69,6 +69,12 @@ namespace :service do command %{ echo "-----> Restarting puma service" #{echo_cmd %[sudo systemctl restart puma]} + } + end + + desc "Reload nginx" + task :reload_nginx do + command %{ echo "-----> Reloading nginx service" #{echo_cmd %[sudo systemctl reload nginx]} } @@ -101,6 +107,7 @@ task :deploy do on :launch do invoke :'service:restart_puma' + invoke :'service:reload_nginx' invoke :'service:restart_delayed_job' end end From f60ff023943deb9cbf0270fd1c71d206dee84a97 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:24:27 +0200 Subject: [PATCH 13/21] Improve readability --- config/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 0b4a91f29..0631cba0a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -93,11 +93,12 @@ desc "Deploys the current version to the server." task :deploy do command 'export PATH=$PATH:/home/ds/.rbenv/bin:/home/ds/.rbenv/shims' command 'source /home/ds/.profile' + deploy do # Put things that will set up an empty directory into a fully set-up # instance of your project. - invoke :'git:clone' + invoke :'git:clone' invoke :'deploy:link_shared_paths' invoke :'bundle:install' invoke :'yarn:install' From a90232e57b364b60fc7bfd122591474a90312daf Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:25:31 +0200 Subject: [PATCH 14/21] Order require statements by alphabetic order --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 0631cba0a..3ddd77da1 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,6 +1,6 @@ require 'mina/bundler' -require 'mina/rails' require 'mina/git' +require 'mina/rails' require 'mina/rbenv' # Basic settings: From 5b32638502507757ddb50bf4eeca88b63a591a5d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 24 Oct 2018 14:26:25 +0200 Subject: [PATCH 15/21] Order shared_dirs by alphabetic order --- config/deploy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 3ddd77da1..5a36ae2ac 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -19,8 +19,8 @@ deploy_to = '/var/www/ds' shared_dirs = [ 'log', 'sockets', - 'tmp/pids', - 'tmp/cache' + 'tmp/cache', + 'tmp/pids' ] set :domain, ENV.fetch('domain') From dfdcfc62e2b2c9754039a1fd7062c949b3eadfbd Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 23 Oct 2018 18:45:21 +0200 Subject: [PATCH 16/21] [#2675] Make dossiers_id_with_notifications self-contained --- app/models/gestionnaire.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/gestionnaire.rb b/app/models/gestionnaire.rb index ae9030646..7d3f8def9 100644 --- a/app/models/gestionnaire.rb +++ b/app/models/gestionnaire.rb @@ -126,7 +126,7 @@ class Gestionnaire < ApplicationRecord procedure.dossiers.not_archived else procedure.dossiers.en_cours - end.followed_by(self) + end dossiers_id_with_notifications(dossiers) end @@ -139,7 +139,7 @@ class Gestionnaire < ApplicationRecord Dossier.not_archived else Dossier.en_cours - end.followed_by(self) + end Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count end @@ -168,6 +168,8 @@ class Gestionnaire < ApplicationRecord end def dossiers_id_with_notifications(dossiers) + dossiers = dossiers.followed_by(self) + updated_demandes = dossiers .joins(:champs) .where('champs.updated_at > follows.demande_seen_at') From 02f4ef215aa47a74de75a1c315116b5f47f2a4be Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 23 Oct 2018 18:46:45 +0200 Subject: [PATCH 17/21] [#2675] Make dossiers_id_with_notifications public --- app/models/gestionnaire.rb | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/models/gestionnaire.rb b/app/models/gestionnaire.rb index 7d3f8def9..13978c827 100644 --- a/app/models/gestionnaire.rb +++ b/app/models/gestionnaire.rb @@ -144,29 +144,6 @@ class Gestionnaire < ApplicationRecord Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count end - def mark_tab_as_seen(dossier, tab) - attributes = {} - attributes["#{tab}_seen_at"] = DateTime.now - Follow.where(gestionnaire: self, dossier: dossier).update_all(attributes) - end - - def invite! - reset_password_token = set_reset_password_token - - GestionnaireMailer.invite_gestionnaire(self, reset_password_token).deliver_later - end - - private - - def annotations_hash(demande, annotations_privees, avis, messagerie) - { - demande: demande, - annotations_privees: annotations_privees, - avis: avis, - messagerie: messagerie - } - end - def dossiers_id_with_notifications(dossiers) dossiers = dossiers.followed_by(self) @@ -200,4 +177,27 @@ class Gestionnaire < ApplicationRecord updated_messagerie ].flat_map { |query| query.distinct.ids }.uniq end + + def mark_tab_as_seen(dossier, tab) + attributes = {} + attributes["#{tab}_seen_at"] = DateTime.now + Follow.where(gestionnaire: self, dossier: dossier).update_all(attributes) + end + + def invite! + reset_password_token = set_reset_password_token + + GestionnaireMailer.invite_gestionnaire(self, reset_password_token).deliver_later + end + + private + + def annotations_hash(demande, annotations_privees, avis, messagerie) + { + demande: demande, + annotations_privees: annotations_privees, + avis: avis, + messagerie: messagerie + } + end end From 64cb231b0126369e3abe0a1cbecc693391d44f92 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 23 Oct 2018 18:48:05 +0200 Subject: [PATCH 18/21] [#2675] Fix notification sort order --- app/models/procedure_presentation.rb | 2 +- spec/models/procedure_presentation_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 03b75eefe..34ddbdf42 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -78,7 +78,7 @@ class ProcedurePresentation < ApplicationRecord case table when 'notifications' - dossiers_id_with_notification = gestionnaire.notifications_for_procedure(procedure) + dossiers_id_with_notification = gestionnaire.dossiers_id_with_notifications(dossiers) if order == 'desc' return dossiers_id_with_notification + (dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification) diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index d4951f386..3881f7616 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -238,6 +238,7 @@ describe ProcedurePresentation do before do notified_dossier.champs.first.touch(time: DateTime.new(2018, 9, 20)) create(:follow, gestionnaire: gestionnaire, dossier: notified_dossier, demande_seen_at: DateTime.new(2018, 9, 10)) + notified_dossier.touch(time: DateTime.new(2018, 9, 20)) recent_dossier.touch(time: DateTime.new(2018, 9, 25)) older_dossier.touch(time: DateTime.new(2018, 5, 13)) end @@ -253,6 +254,13 @@ describe ProcedurePresentation do it { is_expected.to eq([notified_dossier, recent_dossier, older_dossier].map(&:id)) } end + + context 'with a dossier terminé' do + let!(:notified_dossier) { create(:dossier, :accepte, procedure: procedure) } + let(:order) { 'desc' } + + it { is_expected.to eq([notified_dossier, recent_dossier, older_dossier].map(&:id)) } + end end context 'for self table' do From cfc58000c611e94a43726585359c7755122c98bc Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 25 Oct 2018 13:07:14 +0200 Subject: [PATCH 19/21] Improve urls.rb --- config/initializers/urls.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index b8a298fe5..d8ecddb49 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -12,9 +12,9 @@ FOG_BASE_URL = "https://storage.apientreprise.fr" # External services URLs DOC_URL = "https://doc.demarches-simplifiees.fr" -ADMINISTRATEUR_TUTORIAL_URL = "https://doc.demarches-simplifiees.fr/tutoriels/tutoriel-administrateur" -INSTRUCTEUR_TUTORIAL_URL = "https://doc.demarches-simplifiees.fr/tutoriels/tutoriel-accompagnateur" -WEBINAIRE_URL = "https://doc.demarches-simplifiees.fr/pour-aller-plus-loin/webinaires" +ADMINISTRATEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-administrateur"].join("/") +INSTRUCTEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-accompagnateur"].join("/") +WEBINAIRE_URL = [DOC_URL, "pour-aller-plus-loin", "webinaires"].join("/") LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/") CGU_URL = [DOC_URL, "cgu"].join("/") MENTIONS_LEGALES_URL = [CGU_URL, "4-mentions-legales"].join("#") From 394524b3972b702185737b738b1d446f1ad37dfb Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 25 Oct 2018 13:11:54 +0200 Subject: [PATCH 20/21] Improve the webhook description --- app/views/admin/procedures/_informations.html.haml | 6 ++++-- config/initializers/urls.rb | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index 7baa9060b..ed77d6d9e 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -39,11 +39,13 @@ - if Flipflop.web_hook? .form-group - %h4 Lien de rappel HTTP + %h4 Lien de rappel HTTP (webhook) = f.text_field :web_hook_url, class: 'form-control', placeholder: 'https://callback.exemple.fr/' %p.help-block %i.fa.fa-info-circle - Un lien de rappel HTTP (aussi appelé webhook) est utilisé pour notifier un service tiers du changement de l'état d’un dossier sur demarches-simplifiees.fr. À chaque changement d’état d'un dossier, notre site va effectuer une requête sur le lien renseigné avec en paramètres : le nouvel état du dossier, l’identifiant de la démarche, l'identifiant dossier et la date du changement. Vous pourrez alors utiliser notre API pour récupérer les nouvelles informations du dossier concerné. + Vous pouvez définir un lien de rappel HTTP (aussi appelé webhook) pour notifier un service tiers du changement de l'état d’un dossier de cette démarche sur demarches-simplifiees.fr. + = link_to("Consulter la documentation du webhook", WEBHOOK_DOC_URL, target: "_blank") + \. .form-group %h4 Cadre juridique * diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index d8ecddb49..9c49ae9b6 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -19,4 +19,5 @@ LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/") CGU_URL = [DOC_URL, "cgu"].join("/") MENTIONS_LEGALES_URL = [CGU_URL, "4-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("/") FAQ_URL = "https://faq.demarches-simplifiees.fr" From fed1f05456d90d2053a24fc49f87b146807ce43c Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 25 Oct 2018 13:15:33 +0200 Subject: [PATCH 21/21] Add CADRE_JURIDIQUE_URL --- app/views/admin/procedures/_informations.html.haml | 4 +++- config/initializers/urls.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index ed77d6d9e..6650fa034 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -53,7 +53,9 @@ %ul %li Texte de loi (loi, décret, circulaire, arrêté,…) %li Texte juridique (statuts, délibération, décision du conseil d'administration…) - %li En savoir plus + %li + = link_to("En savoir plus", CADRE_JURIDIQUE_URL, target: "_blank") + %p.help-block %i.fa.fa-info-circle Vous pouvez saisir un lien vers ce texte ou importer celui-ci directement. diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 9c49ae9b6..b1fb77382 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -14,6 +14,7 @@ FOG_BASE_URL = "https://storage.apientreprise.fr" DOC_URL = "https://doc.demarches-simplifiees.fr" ADMINISTRATEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-administrateur"].join("/") INSTRUCTEUR_TUTORIAL_URL = [DOC_URL, "tutoriels", "tutoriel-accompagnateur"].join("/") +CADRE_JURIDIQUE_URL = [ADMINISTRATEUR_TUTORIAL_URL, "cadre-juridique"].join("#") WEBINAIRE_URL = [DOC_URL, "pour-aller-plus-loin", "webinaires"].join("/") LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/") CGU_URL = [DOC_URL, "cgu"].join("/")