summaryrefslogtreecommitdiff
path: root/app/controllers/projects/commit_controller.rb
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2018-01-16 23:29:13 +1100
committerSimon Knox <psimyn@gmail.com>2018-01-16 23:29:13 +1100
commit5816a42ed20829968cf64b08fc2bd9c2c4768079 (patch)
tree825fd95ad2dad2ea304ab7154564cd0b919f85be /app/controllers/projects/commit_controller.rb
parent81660bc35010307d472ea4283d6046661e22a1ca (diff)
parentbe353219d1eec05a7b04e9c2e94f61573889549d (diff)
downloadgitlab-ce-41874-closed-todo.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into 41874-closed-todo41874-closed-todo
Diffstat (limited to 'app/controllers/projects/commit_controller.rb')
-rw-r--r--app/controllers/projects/commit_controller.rb14
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.