diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-14 12:20:16 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-14 12:21:41 +0200 |
commit | b8c331b14b90366948f99d5a135e26e171009e3a (patch) | |
tree | 352808400189a089f88d9312eddd443c1f848e67 | |
parent | 595aba54afce01a7903990f6630ae03de1c4d61e (diff) | |
download | gitlab-ce-fix-redirect-profile-keys-new-to-profile-keys.tar.gz |
Make /profile/keys/new redirects to /profile/keys for back-compatfix-redirect-profile-keys-new-to-profile-keys
Report: https://github.com/gitlabhq/gitlabhq/issues/10138
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/controllers/profiles/keys_controller.rb | 5 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rw-r--r-- | spec/controllers/profiles/keys_controller_spec.rb | 12 |
4 files changed, 18 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index e5c8620bebf..df7bd44cb50 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,7 @@ v 8.7.0 (unreleased) - Don't attempt to look up an avatar in repo if repo directory does not exist (Stan Hu) - API: Ability to subscribe and unsubscribe from issues and merge requests (Robert Schilling) - Expose project badges in project settings + - Make /profile/keys/new redirects to /profile/keys for back-compat (Rémy Coutable) - Preserve time notes/comments have been updated at when moving issue - Make HTTP(s) label consistent on clone bar (Stan Hu) - Expose label description in API (Mariusz Jachimowicz) diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index b88c080352b..a12549d6bcb 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -10,6 +10,11 @@ class Profiles::KeysController < Profiles::ApplicationController @key = current_user.keys.find(params[:id]) end + # Back-compat: We need to support this URL since git-annex webapp points to it + def new + redirect_to profile_keys_path + end + def create @key = current_user.keys.new(key_params) diff --git a/config/routes.rb b/config/routes.rb index 688b83d2c95..f32f7ea8557 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -326,7 +326,7 @@ Rails.application.routes.draw do end end resource :preferences, only: [:show, :update] - resources :keys, except: [:new] + resources :keys resources :emails, only: [:index, :create, :destroy] resource :avatar, only: [:destroy] resource :two_factor_auth, only: [:new, :create, :destroy] do diff --git a/spec/controllers/profiles/keys_controller_spec.rb b/spec/controllers/profiles/keys_controller_spec.rb index b6573f105dc..3a82083717f 100644 --- a/spec/controllers/profiles/keys_controller_spec.rb +++ b/spec/controllers/profiles/keys_controller_spec.rb @@ -1,7 +1,17 @@ require 'spec_helper' describe Profiles::KeysController do - let(:user) { create(:user) } + let(:user) { create(:user) } + + describe '#new' do + before { sign_in(user) } + + it 'redirect to #index' do + get :new + + expect(response).to redirect_to(profile_keys_path) + end + end describe "#get_keys" do describe "non existant user" do |