From 1772c6b94d8e1a574d29643a33f1c0dbc0fdbe6f Mon Sep 17 00:00:00 2001
From: Lunny Xiao <xiaolunwen@gmail.com>
Date: Mon, 1 Jul 2019 12:08:43 +0800
Subject: [PATCH] fix pull view ui merge section (#7335)

* fix pull view ui merge section

* fix tests

* fix tests
---
 integrations/pull_merge_test.go             | 2 +-
 templates/repo/issue/view_content/pull.tmpl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go
index 4266a194eb..f3efa63b07 100644
--- a/integrations/pull_merge_test.go
+++ b/integrations/pull_merge_test.go
@@ -159,7 +159,7 @@ func TestCantMergeWorkInProgress(t *testing.T) {
 		req := NewRequest(t, "GET", resp.Header().Get("Location"))
 		resp = session.MakeRequest(t, req, http.StatusOK)
 		htmlDoc := NewHTMLParser(t, resp.Body)
-		text := strings.TrimSpace(htmlDoc.doc.Find(".merge-section.segment > .text.grey").Text())
+		text := strings.TrimSpace(htmlDoc.doc.Find(".attached.header > .text.grey").Last().Text())
 		assert.NotEmpty(t, text, "Can't find WIP text")
 
 		// remove <strong /> from lang
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index caadba41c7..7bb3c91275 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -46,7 +46,7 @@
 	{{else}}red{{end}}"><span class="mega-octicon octicon-git-merge"></span></a>
 	<div class="content">
 		{{template "repo/pulls/status" .}}
-		<div class="ui attached merge-section segment">
+		<div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}">
 			{{if .Issue.PullRequest.HasMerged}}
 				<div class="item text purple">
 					{{$.i18n.Tr "repo.pulls.has_merged"}}