Merge branch 'merge-button-color-fix' into 'master'

Fixed issue with button color when no CI enabled

## What does this MR do?

Fixes an issue with the color of the merge button when no CI is setup.

## What are the relevant issue numbers?

Closes #17844

## Screenshots

![Screen_Shot_2016-05-25_at_09.58.44](/uploads/87aac74c5e2f8bfd2831e99c5915856d/Screen_Shot_2016-05-25_at_09.58.44.png)

See merge request !4287
This commit is contained in:
Jacob Schatz 2016-05-25 14:28:42 +00:00
commit f68f837d87
2 changed files with 4 additions and 3 deletions

View file

@ -106,6 +106,7 @@ class @MergeRequestWidget
@firstCICheck = false
showCIStatus: (state) ->
return if not state?
$('.ci_widget').hide()
allowed_states = ["failed", "canceled", "running", "pending", "success", "skipped", "not_found"]
if state in allowed_states
@ -126,6 +127,6 @@ class @MergeRequestWidget
$('.ci_widget:visible .ci-coverage').text(text)
setMergeButtonClass: (css_class) ->
$('.js-merge-button')
$('.js-merge-button,.accept-action .dropdown-toggle')
.removeClass('btn-danger btn-warning btn-create')
.addClass(css_class)

View file

@ -229,6 +229,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if ci_commit
status = ci_commit.status
coverage = ci_commit.try(:coverage)
status ||= "preparing"
else
ci_service = @merge_request.source_project.ci_service
status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch) if ci_service
@ -238,8 +240,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
status = "preparing" if status.nil?
response = {
title: merge_request.title,
sha: merge_request.last_commit_short_sha,