diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-04 11:12:19 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-05-05 12:12:50 -0700 |
commit | e4bcc90d95fa3b78544cb9ddd6019a5f914c1628 (patch) | |
tree | 68bf9769e348e45ff786a083e336f32409181d35 | |
parent | 0c866f4a575d8127efbf3eafda83d8ccfbd97817 (diff) | |
download | gitlab-ce-e4bcc90d95fa3b78544cb9ddd6019a5f914c1628.tar.gz |
Add “project moved” flash message on redirect
-rw-r--r-- | app/controllers/concerns/routable_actions.rb | 1 | ||||
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/users_controller_spec.rb | 4 |
4 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index 6f16377a156..1714bc25e52 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -5,6 +5,7 @@ module RoutableActions return unless request.get? if routable.full_path != requested_path + flash[:notice] = 'This project has moved to this location. Please update your links and bookmarks.' redirect_to request.original_url.sub(requested_path, routable.full_path) end end diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index d86bf1a3d0e..b5fd611747a 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -65,6 +65,7 @@ describe GroupsController do get :issues, id: redirect_route.path expect(response).to redirect_to(issues_group_path(group.to_param)) + expect(controller).to set_flash[:notice].to(/moved/) end end end @@ -108,6 +109,7 @@ describe GroupsController do get :merge_requests, id: redirect_route.path expect(response).to redirect_to(merge_requests_group_path(group.to_param)) + expect(controller).to set_flash[:notice].to(/moved/) end end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 1b0dd7c6369..5e3e943c124 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -226,6 +226,7 @@ describe ProjectsController do get :show, namespace_id: 'foo', id: 'bar' expect(response).to redirect_to(public_project) + expect(controller).to set_flash[:notice].to(/moved/) end end end @@ -471,6 +472,7 @@ describe ProjectsController do get :refs, namespace_id: 'foo', id: 'bar' expect(response).to redirect_to(refs_namespace_project_path(namespace_id: public_project.namespace, id: public_project)) + expect(controller).to set_flash[:notice].to(/moved/) end end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 73f448d69ed..5e8caa89cb7 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -82,6 +82,7 @@ describe UsersController do get :show, username: redirect_route.path expect(response).to redirect_to(user) + expect(controller).to set_flash[:notice].to(/moved/) end end @@ -159,6 +160,7 @@ describe UsersController do get :calendar, username: redirect_route.path expect(response).to redirect_to(user_calendar_path(user)) + expect(controller).to set_flash[:notice].to(/moved/) end end end @@ -211,6 +213,7 @@ describe UsersController do get :calendar_activities, username: redirect_route.path expect(response).to redirect_to(user_calendar_activities_path(user)) + expect(controller).to set_flash[:notice].to(/moved/) end end end @@ -263,6 +266,7 @@ describe UsersController do get :snippets, username: redirect_route.path expect(response).to redirect_to(user_snippets_path(user)) + expect(controller).to set_flash[:notice].to(/moved/) end end end |