diff options
Diffstat (limited to 'app/controllers/projects/commit_controller.rb')
-rw-r--r-- | app/controllers/projects/commit_controller.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 2e7344b1cad..effb484ef0f 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -12,7 +12,7 @@ class Projects::CommitController < Projects::ApplicationController before_action :authorize_download_code! before_action :authorize_read_pipeline!, only: [:pipelines] before_action :commit - before_action :define_commit_vars, only: [:show, :diff_for_path, :pipelines] + before_action :define_commit_vars, only: [:show, :diff_for_path, :pipelines, :merge_requests] before_action :define_note_vars, only: [:show, :diff_for_path] before_action :authorize_edit_tree!, only: [:revert, :cherry_pick] @@ -52,6 +52,18 @@ class Projects::CommitController < Projects::ApplicationController end end + def merge_requests + @merge_requests = @commit.merge_requests.map do |mr| + { iid: mr.iid, path: merge_request_path(mr), title: mr.title } + end + + respond_to do |format| + format.json do + render json: @merge_requests.to_json + end + end + end + def branches # branch_names_contains/tag_names_contains can take a long time when there are thousands of # branches/tags - each `git branch --contains xxx` request can consume a cpu core. |