Commit 1e45fb2f authored by Phil Hughes's avatar Phil Hughes

Fixed issue with button color when no CI enabled

Closes #17844
parent 4618e538
...@@ -106,6 +106,7 @@ class @MergeRequestWidget ...@@ -106,6 +106,7 @@ class @MergeRequestWidget
@firstCICheck = false @firstCICheck = false
showCIStatus: (state) -> showCIStatus: (state) ->
return if not state?
$('.ci_widget').hide() $('.ci_widget').hide()
allowed_states = ["failed", "canceled", "running", "pending", "success", "skipped", "not_found"] allowed_states = ["failed", "canceled", "running", "pending", "success", "skipped", "not_found"]
if state in allowed_states if state in allowed_states
...@@ -126,6 +127,6 @@ class @MergeRequestWidget ...@@ -126,6 +127,6 @@ class @MergeRequestWidget
$('.ci_widget:visible .ci-coverage').text(text) $('.ci_widget:visible .ci-coverage').text(text)
setMergeButtonClass: (css_class) -> setMergeButtonClass: (css_class) ->
$('.js-merge-button') $('.js-merge-button,.accept-action .dropdown-toggle')
.removeClass('btn-danger btn-warning btn-create') .removeClass('btn-danger btn-warning btn-create')
.addClass(css_class) .addClass(css_class)
...@@ -229,6 +229,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -229,6 +229,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if ci_commit if ci_commit
status = ci_commit.status status = ci_commit.status
coverage = ci_commit.try(:coverage) coverage = ci_commit.try(:coverage)
status ||= "preparing"
else else
ci_service = @merge_request.source_project.ci_service 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 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 ...@@ -238,8 +240,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
end end
status = "preparing" if status.nil?
response = { response = {
title: merge_request.title, title: merge_request.title,
sha: merge_request.last_commit_short_sha, 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