Commit f68f837d authored by Jacob Schatz's avatar Jacob Schatz

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
parents 9a10205a 1e45fb2f
......@@ -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)
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment