Commit 3da7cc51 authored by Etienne Baqué's avatar Etienne Baqué

Updated controller based on review comments

parent 0ecdf4fe
......@@ -12,7 +12,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def index
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_repository }
format.json do
render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json
end
......@@ -20,7 +20,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end
def new
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_repository
end
def create
......@@ -30,7 +30,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
flash[:alert] = @key.errors.full_messages.join(', ').html_safe
end
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_repository
end
def edit
......@@ -39,7 +39,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def update
if deploy_key.update(update_params)
flash[:notice] = _('Deploy key was successfully updated.')
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_repository
else
render 'edit'
end
......@@ -51,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless key
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_repository }
format.json { head :ok }
end
end
......@@ -62,7 +62,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless deploy_key_project
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_repository }
format.json { head :ok }
end
end
......@@ -97,4 +97,10 @@ class Projects::DeployKeysController < Projects::ApplicationController
access_denied!
end
end
private
def redirect_to_repository
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
end
end
......@@ -2,4 +2,4 @@
title: Move deploy keys section back to repository settings
merge_request: 29184
author:
type: removed
type: changed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment