Commit 2b431314 authored by Jacob Schatz's avatar Jacob Schatz Committed by Yorick Peterse

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
parent c4abaf41
...@@ -114,6 +114,7 @@ class @MergeRequestWidget ...@@ -114,6 +114,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
...@@ -134,6 +135,6 @@ class @MergeRequestWidget ...@@ -134,6 +135,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