From 5009c583ea10bebaef0e01c1c55e3ad958f6fa2b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 4 Oct 2021 15:44:05 +0200 Subject: [PATCH] Add notice when merging account --- app/controllers/manager/users_controller.rb | 2 ++ spec/controllers/manager/users_controller_spec.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/app/controllers/manager/users_controller.rb b/app/controllers/manager/users_controller.rb index 7c1b9643a..d107ca5c2 100644 --- a/app/controllers/manager/users_controller.rb +++ b/app/controllers/manager/users_controller.rb @@ -28,6 +28,8 @@ module Manager else preexisting_user.expert.merge(user.expert) end + + flash[:notice] = "Le compte « #{targeted_email} » a absorbé le compte « #{user.email} »." end redirect_to edit_manager_user_path(user) diff --git a/spec/controllers/manager/users_controller_spec.rb b/spec/controllers/manager/users_controller_spec.rb index beb043ac3..896cbc21b 100644 --- a/spec/controllers/manager/users_controller_spec.rb +++ b/spec/controllers/manager/users_controller_spec.rb @@ -68,6 +68,7 @@ describe Manager::UsersController, type: :controller do expect(preexisting_user.instructeur).to match(instructeur) expect(preexisting_user.expert).to match(expert) + expect(flash[:notice]).to match("Le compte « email.existant@domaine.fr » a absorbé le compte « ancien.email@domaine.fr ».") end context 'and the preexisting account owns an instructeur and expert as well' do