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 ...@@ -12,7 +12,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def index def index
respond_to do |format| respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') } format.html { redirect_to_repository }
format.json do format.json do
render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json
end end
...@@ -20,7 +20,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -20,7 +20,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end end
def new def new
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') redirect_to_repository
end end
def create def create
...@@ -30,7 +30,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -30,7 +30,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
flash[:alert] = @key.errors.full_messages.join(', ').html_safe flash[:alert] = @key.errors.full_messages.join(', ').html_safe
end end
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') redirect_to_repository
end end
def edit def edit
...@@ -39,7 +39,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -39,7 +39,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def update def update
if deploy_key.update(update_params) if deploy_key.update(update_params)
flash[:notice] = _('Deploy key was successfully updated.') flash[:notice] = _('Deploy key was successfully updated.')
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') redirect_to_repository
else else
render 'edit' render 'edit'
end end
...@@ -51,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -51,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless key return render_404 unless key
respond_to do |format| 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 } format.json { head :ok }
end end
end end
...@@ -62,7 +62,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -62,7 +62,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless deploy_key_project return render_404 unless deploy_key_project
respond_to do |format| 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 } format.json { head :ok }
end end
end end
...@@ -97,4 +97,10 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -97,4 +97,10 @@ class Projects::DeployKeysController < Projects::ApplicationController
access_denied! access_denied!
end end
end end
private
def redirect_to_repository
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
end
end end
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
title: Move deploy keys section back to repository settings title: Move deploy keys section back to repository settings
merge_request: 29184 merge_request: 29184
author: 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