From a047ee356bcf256c8bd7b6b6d8bc84d5d3f08d07 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 11 Jul 2019 13:55:36 +0000 Subject: [PATCH 1/9] procedure: remove `expects_multiple_submissions` column --- app/models/procedure.rb | 2 +- ...401_remove_expects_multiple_submissions_from_procedure.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb diff --git a/app/models/procedure.rb b/app/models/procedure.rb index cad0028c2..16f1486bd 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -3,7 +3,7 @@ require Rails.root.join('lib', 'percentile') class Procedure < ApplicationRecord MAX_DUREE_CONSERVATION = 36 - self.ignored_columns = [:individual_with_siret, :expects_multiple_submissions] + self.ignored_columns = [:individual_with_siret] has_many :types_de_piece_justificative, -> { ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy diff --git a/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb b/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb new file mode 100644 index 000000000..9327f6eec --- /dev/null +++ b/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb @@ -0,0 +1,5 @@ +class RemoveExpectsMultipleSubmissionsFromProcedure < ActiveRecord::Migration[5.2] + def change + remove_column :procedures, :expects_multiple_submissions, :boolean, default: false, null: false + end +end From 619f663e1afa6c9e0ec3a1d178dd5700906d49b4 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 11 Jul 2019 15:56:58 +0200 Subject: [PATCH 2/9] procedure: remove `individual_with_siret` column --- app/models/procedure.rb | 2 -- ...0711135457_remove_individual_with_siret_from_procedure.rb | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 16f1486bd..dcddab930 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -3,8 +3,6 @@ require Rails.root.join('lib', 'percentile') class Procedure < ApplicationRecord MAX_DUREE_CONSERVATION = 36 - self.ignored_columns = [:individual_with_siret] - has_many :types_de_piece_justificative, -> { ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', inverse_of: :procedure, dependent: :destroy diff --git a/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb b/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb new file mode 100644 index 000000000..cf6ab32e7 --- /dev/null +++ b/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb @@ -0,0 +1,5 @@ +class RemoveIndividualWithSiretFromProcedure < ActiveRecord::Migration[5.2] + def change + remove_column :procedures, :individual_with_siret, :boolean, default: false + end +end From 2c8d953bb9c187223a42612f6a0c986d925b32f9 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 11 Jul 2019 16:45:32 +0200 Subject: [PATCH 3/9] db: fix missing update to schema.rb --- db/schema.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index e2a264bc4..70076f057 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_07_04_144304) do +ActiveRecord::Schema.define(version: 2019_07_11_135457) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -481,7 +481,6 @@ ActiveRecord::Schema.define(version: 2019_07_04_144304) do t.string "lien_site_web" t.string "lien_notice" t.boolean "for_individual", default: false - t.boolean "individual_with_siret", default: false t.date "auto_archive_on" t.datetime "published_at" t.datetime "hidden_at" @@ -500,7 +499,6 @@ ActiveRecord::Schema.define(version: 2019_07_04_144304) do t.boolean "juridique_required", default: true t.boolean "durees_conservation_required", default: true t.string "path" - t.boolean "expects_multiple_submissions", default: false, null: false t.string "declarative_with_state" t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state" t.index ["hidden_at"], name: "index_procedures_on_hidden_at" From d5f360c85fa0b7980d2d5a29716c77421e56cdb3 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 15 Jul 2019 10:01:16 +0200 Subject: [PATCH 4/9] manager: fix the deletion email not being sent When deleting a dossier from the manager, the deletion notification email was not being sent. This is because the returned object from `Dossier#hide!` was invalid. --- app/controllers/manager/dossiers_controller.rb | 3 +-- app/models/dossier.rb | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/manager/dossiers_controller.rb b/app/controllers/manager/dossiers_controller.rb index 74170f17f..31867443f 100644 --- a/app/controllers/manager/dossiers_controller.rb +++ b/app/controllers/manager/dossiers_controller.rb @@ -22,9 +22,8 @@ module Manager def hide dossier = Dossier.find(params[:id]) - deleted_dossier = dossier.hide!(current_administration) + dossier.hide!(current_administration) - DossierMailer.notify_deletion_to_user(deleted_dossier, dossier.user.email).deliver_later logger.info("Le dossier #{dossier.id} est supprimé par #{current_administration.email}") flash[:notice] = "Le dossier #{dossier.id} est supprimé" diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 28f4dbee4..81c426824 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -412,7 +412,8 @@ class Dossier < ApplicationRecord def hide!(administration) update(hidden_at: Time.zone.now) - DeletedDossier.create_from_dossier(self) + deleted_dossier = DeletedDossier.create_from_dossier(self) + DossierMailer.notify_deletion_to_user(deleted_dossier, user.email).deliver_later log_dossier_operation(administration, :supprimer, self) end From 535d032b73eb92b4b05e30f81e809c4d14376d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Mon, 8 Jul 2019 17:50:02 +0200 Subject: [PATCH 5/9] Send URL page view to Crisp to trigger contextual help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #4052 Signed-off-by: Chaïb Martinez --- app/javascript/shared/track/crisp.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/javascript/shared/track/crisp.js b/app/javascript/shared/track/crisp.js index a016a1ab2..08aeda15b 100644 --- a/app/javascript/shared/track/crisp.js +++ b/app/javascript/shared/track/crisp.js @@ -29,4 +29,9 @@ if (enabled) { ] ] ]); + window.$crisp.push([ + 'set', + 'session:event', + [[['PAGE_VIEW', { URL: window.location.pathname }]]] + ]); } From 04e204c74091c92ee1066914bc8089feecaf1abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 11 Jul 2019 14:47:27 +0200 Subject: [PATCH 6/9] Minor text fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/_navbar.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml index 6d4fa787f..1bf5272eb 100644 --- a/app/views/layouts/_navbar.html.haml +++ b/app/views/layouts/_navbar.html.haml @@ -10,7 +10,7 @@ #navbar-body .row %div{ style: "vertical-align: middle;float:left;position:absolute;line-height: 60px;z-index:2;" } - 👉 Besoin d'aide? Contactez-nous par chat, email ou prenez rendez-vous avec nous. + 👉Besoin d'aide? Contactez-nous par chat, email ou prenez RDV -# BEST WTF EVER -# this begin rescue hides potentials bugs by displaying another navbar - begin From d968e7e6bdc8f4a8bad17783b627059096732ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 11 Jul 2019 16:05:41 +0200 Subject: [PATCH 7/9] Add some admin usage info for contextual help with crisp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #4052 Signed-off-by: Chaïb Martinez --- app/controllers/application_controller.rb | 6 +++++- app/javascript/shared/track/crisp.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index df168b7c1..fa3287d7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -250,7 +250,11 @@ class ApplicationController < ActionController::Base email: current_administrateur&.email, DS_SIGN_IN_COUNT: current_administrateur&.sign_in_count, DS_CREATED_AT: current_administrateur&.created_at, - DS_ID: current_administrateur&.id + DS_ID: current_administrateur&.id, + DS_NB_DEMARCHES_BROUILLONS: current_administrateur.procedures.brouillons.count, + DS_NB_DEMARCHES_ACTIVES: current_administrateur.procedures.publiees.count, + DS_NB_DEMARCHES_ARCHIVES: current_administrateur.procedures.archivees.count + } } end diff --git a/app/javascript/shared/track/crisp.js b/app/javascript/shared/track/crisp.js index 08aeda15b..55819e034 100644 --- a/app/javascript/shared/track/crisp.js +++ b/app/javascript/shared/track/crisp.js @@ -21,6 +21,12 @@ if (enabled) { [ ['DS_ID', administrateur.email], ['DS_SIGN_IN_COUNT', administrateur.DS_SIGN_IN_COUNT], + [ + 'DS_NB_DEMARCHES_BROUILLONS', + administrateur.DS_NB_DEMARCHES_BROUILLONS + ], + ['DS_NB_DEMARCHES_ACTIVES', administrateur.DS_NB_DEMARCHES_ACTIVES], + ['DS_NB_DEMARCHES_ARCHIVES', administrateur.DS_NB_DEMARCHES_ARCHIVES], [ 'URL_MANAGER', 'https://www.demarches-simplifiees.fr/manager/administrateurs/' + From 3f9f67eb784c759e5ff4e7b3df191fd1ef75882b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 11 Jul 2019 16:57:17 +0200 Subject: [PATCH 8/9] admin: fix the "Valider" button being hidden by Crisp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #4021 Signed-off-by: Chaïb Martinez --- app/views/admin/procedures/new.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/procedures/new.html.haml b/app/views/admin/procedures/new.html.haml index ccfde2a2f..a61ff161f 100644 --- a/app/views/admin/procedures/new.html.haml +++ b/app/views/admin/procedures/new.html.haml @@ -5,5 +5,5 @@ #procedure_new.section.section-label = form_for @procedure, url: { controller: 'admin/procedures', action: :create }, multipart: true do |f| = render partial: 'informations', locals: { f: f } - .text-right - = f.button 'Valider', class: 'btn btn-info', id: 'save-procedure' + .text-center + = f.button 'Valider', class: 'btn btn-info btn-lg btn-block', id: 'save-procedure' From 5cb6ba2f3baf996f7886d9257ff54db7ba344813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 11 Jul 2019 17:12:11 +0200 Subject: [PATCH 9/9] Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/controllers/application_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fa3287d7c..9b58e571d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -251,9 +251,9 @@ class ApplicationController < ActionController::Base DS_SIGN_IN_COUNT: current_administrateur&.sign_in_count, DS_CREATED_AT: current_administrateur&.created_at, DS_ID: current_administrateur&.id, - DS_NB_DEMARCHES_BROUILLONS: current_administrateur.procedures.brouillons.count, - DS_NB_DEMARCHES_ACTIVES: current_administrateur.procedures.publiees.count, - DS_NB_DEMARCHES_ARCHIVES: current_administrateur.procedures.archivees.count + DS_NB_DEMARCHES_BROUILLONS: current_administrateur&.procedures&.brouillons&.count, + DS_NB_DEMARCHES_ACTIVES: current_administrateur&.procedures&.publiees&.count, + DS_NB_DEMARCHES_ARCHIVES: current_administrateur&.procedures&.archivees&.count } }