Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-05 20:59:46 +0300
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-06 12:56:21 +0300
commitf16377e7dc762462817dd0b34e36811c55988b10 (patch)
tree0c2848cee6743f0648e2c3d9361d201aca7fbf1a /app/controllers/projects/protected_refs_controller.rb
parent18506d4b8b8bc780b3b1e4c61339af38b5c49bb2 (diff)
Protected Tags backend review changes
Added changelog
Diffstat (limited to 'app/controllers/projects/protected_refs_controller.rb')
-rw-r--r--app/controllers/projects/protected_refs_controller.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/app/controllers/projects/protected_refs_controller.rb b/app/controllers/projects/protected_refs_controller.rb
index 63f005124a9..083a70968e5 100644
--- a/app/controllers/projects/protected_refs_controller.rb
+++ b/app/controllers/projects/protected_refs_controller.rb
@@ -1,5 +1,6 @@
class Projects::ProtectedRefsController < Projects::ApplicationController
include RepositorySettingsRedirect
+
# Authorize
before_action :require_non_empty_project
before_action :authorize_admin_project!
@@ -12,33 +13,31 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
end
def create
- self.protected_ref = create_service.new(@project, current_user, protected_ref_params).execute
+ protected_ref = create_service_class.new(@project, current_user, protected_ref_params).execute
+
unless protected_ref.persisted?
flash[:alert] = protected_ref.errors.full_messages.join(', ').html_safe
end
+
redirect_to_repository_settings(@project)
end
def show
- self.matching_refs = protected_ref.matching(project_refs)
+ @matching_refs = @protected_ref.matching(project_refs)
end
def update
- self.protected_ref = update_service.new(@project, current_user, protected_ref_params).execute(protected_ref)
+ @protected_ref = update_service_class.new(@project, current_user, protected_ref_params).execute(@protected_ref)
- if protected_ref.valid?
- respond_to do |format|
- format.json { render json: protected_ref, status: :ok }
- end
+ if @protected_ref.valid?
+ render json: @protected_ref, status: :ok
else
- respond_to do |format|
- format.json { render json: protected_ref.errors, status: :unprocessable_entity }
- end
+ render json: @protected_ref.errors, status: :unprocessable_entity
end
end
def destroy
- protected_ref.destroy
+ @protected_ref.destroy
respond_to do |format|
format.html { redirect_to_repository_settings(@project) }