Get ci_commit in MR controller

This commit is contained in:
Douwe Maan 2015-12-08 13:02:13 +01:00
parent 35fd7112bf
commit 9907a7e6ed
3 changed files with 7 additions and 6 deletions

View file

@ -264,6 +264,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff = @merge_request.merge_request_diff
@ci_commit = @merge_request.ci_commit
if @merge_request.locked_long_ago?
@merge_request.unlock_mr
@merge_request.close

View file

@ -1,13 +1,12 @@
- ci_commit = @merge_request.ci_commit
- if ci_commit
- status = ci_commit.status
- if @ci_commit
- status = @ci_commit.status
.mr-widget-heading
.ci_widget{class: "ci-#{status}"}
= ci_status_icon(ci_commit)
= ci_status_icon(@ci_commit)
%span CI build #{status}
for #{@merge_request.last_commit_short_sha}.
%span.ci-coverage
= link_to "View build details", ci_status_path(ci_commit)
= link_to "View build details", ci_status_path(@ci_commit)
- elsif @merge_request.has_ci?
- # Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX

View file

@ -1,4 +1,4 @@
- status_class = @merge_request.ci_commit ? " ci-#{@merge_request.ci_commit.status}" : nil
- status_class = @ci_commit ? " ci-#{@ci_commit.status}" : nil
= form_for [:merge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post, html: { class: 'accept-mr-form js-requires-input' } do |f|
= hidden_field_tag :authenticity_token, form_authenticity_token