diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-11 18:45:12 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-11 18:45:12 +0200 |
commit | 946b4ceda37fdb475b4176f466ef32470e6aeb1e (patch) | |
tree | 8ac05f1399cdc2ec6575729c591264bb93679234 /app/controllers/projects/merge_requests_controller.rb | |
parent | 8893ac4ba407fdbacd85fa1b94d393b150ba5874 (diff) | |
download | gitlab-ce-946b4ceda37fdb475b4176f466ef32470e6aeb1e.tar.gz |
Improve variables in mr widget
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects/merge_requests_controller.rb')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 3bb16f1b9fd..14069bafe71 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -139,14 +139,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.check_if_can_be_merged end - @allowed_to_merge = allowed_to_merge? closes_issues render partial: "projects/merge_requests/widget/show.html.haml", layout: false end def automerge - return access_denied! unless allowed_to_merge? + return access_denied! unless @merge_request.can_be_merged_by?(current_user) if @merge_request.automergeable? AutoMergeWorker.perform_async(@merge_request.id, current_user.id, params) @@ -255,8 +254,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController @commits = @merge_request.commits @merge_request_diff = @merge_request.merge_request_diff - @allowed_to_merge = allowed_to_merge? - @show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge @source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name) if @merge_request.locked_long_ago? @@ -265,19 +262,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController end end - def allowed_to_merge? - allowed_to_push_code?(project, @merge_request.target_branch) - end - def invalid_mr # Render special view for MR with removed source or target branch render 'invalid' end - def allowed_to_push_code?(project, branch) - ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch) - end - def merge_request_params params.require(:merge_request).permit( :title, :assignee_id, :source_project_id, :source_branch, |