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
This commit is contained in:
Rémy Coutable 2016-04-15 08:19:01 +00:00
commit ddec8e777f
4 changed files with 18 additions and 2 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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