diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-15 08:19:01 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-15 08:19:01 +0000 |
commit | ddec8e777f31d747d8c5c6599acf6b84afeea92d (patch) | |
tree | 6b8f5a574f3c48b0af783bd74c63eb8b53b30bcf | |
parent | 4e2f068c5fd7505be0674546ac977977152d3800 (diff) | |
parent | a434ffd3b3a895bd75daed76000def23f4002f5a (diff) | |
download | gitlab-ce-ddec8e777f31d747d8c5c6599acf6b84afeea92d.tar.gz |
Merge branch 'fix-redirect-profile-keys-new-to-profile-keys' into 'master'
Make /profile/keys/new redirects to /profile/keys for back-compat
This addresses https://github.com/gitlabhq/gitlabhq/issues/10138.
See merge request !3717
-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 5c34a8c579d..69b464bdc6b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,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 redirect to /profile/keys for back-compat. !3717 - 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 408132f4217..46a25262844 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -328,7 +328,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 |