diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-21 22:23:22 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-21 22:23:22 +0300 |
commit | 7a5e653fde62cfcd0e05be7954bbf14de0cb6d8c (patch) | |
tree | f7307706ea732f779b2cf4884b95bfbc1251a172 /app/controllers/projects | |
parent | 06cf647c9b1936f55553b88f71c04cb593dfa7ae (diff) | |
parent | 35615bc33179a88c580cc28aca74c70754d21120 (diff) |
Merge branch 'hide-empty-merge-request-diffs' into 'master'
Fix errors happening when source branch of merge request is removed and then restored
See merge request !7568
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index b343ba0b744..dbbd2ad849e 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -82,12 +82,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request_diff = if params[:diff_id] - @merge_request.merge_request_diffs.find(params[:diff_id]) + @merge_request.merge_request_diffs.viewable.find(params[:diff_id]) else @merge_request.merge_request_diff end - @merge_request_diffs = @merge_request.merge_request_diffs.select_without_diff + @merge_request_diffs = @merge_request.merge_request_diffs.viewable.select_without_diff @comparable_diffs = @merge_request_diffs.select { |diff| diff.id < @merge_request_diff.id } if params[:start_sha].present? @@ -417,7 +417,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController response = { title: merge_request.title, - sha: merge_request.diff_head_commit.short_id, + sha: (merge_request.diff_head_commit.short_id if merge_request.diff_head_sha), status: status, coverage: coverage } @@ -564,7 +564,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController def define_pipelines_vars @pipelines = @merge_request.all_pipelines - if @pipelines.present? + if @pipelines.present? && @merge_request.commits.present? @pipeline = @pipelines.first @statuses = @pipeline.statuses.relevant end |