{{template "repo/header" .}} {{$showDiffBox := false}} - {{$canReadPullRequests := .Permission.CanRead $.UnitTypePullRequests}}

{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} - {{if $canReadPullRequests}} - {{ctx.Locale.Tr "repo.pulls.compare_changes"}} -
{{ctx.Locale.Tr "repo.pulls.compare_changes_desc"}}
- {{else}} - {{ctx.Locale.Tr "compare.branches.title"}} - {{end}} + {{ctx.Locale.Tr "repo.pulls.compare_changes"}} +
{{ctx.Locale.Tr "repo.pulls.compare_changes_desc"}}
{{else}} {{ctx.Locale.Tr "action.compare_commits_general"}} {{end}} @@ -171,7 +166,7 @@ {{else}}
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_have_tag"}}
{{end}} - {{else if and .PageIsComparePull (gt .CommitCount 0) $canReadPullRequests}} + {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}}
diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl index 362b8d52ee..49b210f75c 100644 --- a/templates/repo/editor/cherry_pick.tmpl +++ b/templates/repo/editor/cherry_pick.tmpl @@ -11,7 +11,7 @@
diff --git a/templates/repo/shabox.tmpl b/templates/repo/shabox.tmpl index 86413a5412..270eab7759 100644 --- a/templates/repo/shabox.tmpl +++ b/templates/repo/shabox.tmpl @@ -1,4 +1,4 @@ -{{$class := "sha label"}} +{{$class := "ui sha label"}} {{if .signature}} {{$class = (print $class " isSigned")}} {{if .verification.Verified}} diff --git a/tests/integration/compare_test.go b/tests/integration/compare_test.go index 581aa67659..3c3e8adf94 100644 --- a/tests/integration/compare_test.go +++ b/tests/integration/compare_test.go @@ -267,14 +267,13 @@ func TestCompareWithPRsDisabled(t *testing.T) { []unit_model.Type{unit_model.TypePullRequests}) require.NoError(t, err) - t.Run("branch view offer comparing branches", func(t *testing.T) { + t.Run("branch view doesn't offer creating PRs", func(t *testing.T) { defer tests.PrintCurrentTest(t)() req := NewRequest(t, "GET", "/user1/repo1/branches") resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) - compareLink := htmlDoc.Find("a[href='/user1/repo1/compare/master...recent-push']") - assert.Equal(t, "Compare branches", strings.TrimSpace(compareLink.Text())) + htmlDoc.AssertElement(t, "a[href='/user1/repo1/compare/master...recent-push']", false) }) t.Run("compare doesn't offer local branches", func(t *testing.T) { @@ -291,13 +290,11 @@ func TestCompareWithPRsDisabled(t *testing.T) { } }) - t.Run("comparing against a disabled-PR repo", func(t *testing.T) { + t.Run("comparing against a disabled-PR repo is 404", func(t *testing.T) { defer tests.PrintCurrentTest(t)() req := NewRequest(t, "GET", "/user1/repo1/compare/master...recent-push") - resp := session.MakeRequest(t, req, http.StatusOK) - htmlDoc := NewHTMLParser(t, resp.Body) - assert.Equal(t, "Compare branches", strings.TrimSpace(htmlDoc.Find("h2.header").Text())) + session.MakeRequest(t, req, http.StatusNotFound) }) }) } diff --git a/web_src/css/index.css b/web_src/css/index.css index 7b0fa45916..d86a784bcc 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -30,7 +30,6 @@ @import "./modules/svg.css"; @import "./modules/flexcontainer.css"; @import "./modules/user-cards.css"; -@import "./modules/hashbox.css"; @import "./shared/flex-list.css"; @import "./shared/milestone.css"; diff --git a/web_src/css/modules/hashbox.css b/web_src/css/modules/hashbox.css deleted file mode 100644 index 316ac1f655..0000000000 --- a/web_src/css/modules/hashbox.css +++ /dev/null @@ -1,104 +0,0 @@ -.sha.label { - display: inline-flex; - flex-shrink: 0; - gap: 0; - align-items: center; - margin: 0 6px; /* needs to go but looked into case-by-case */ - padding: 0; - min-width: 0; /* from .ui.label, may be bad actually */ - background: var(--color-label-bg); - color: var(--color-label-text); - border: 1px solid var(--color-light-border); - border-radius: var(--border-radius); - white-space: nowrap; - font-family: var(--fonts-monospace); - font-size: 13px; - font-weight: var(--font-weight-normal); - line-height: 1; -} - -.primary.sha.label { - border: none; - background: var(--color-primary); - color: var(--color-primary-contrast); -} - -.sha.label .shortsha { - padding: 0.33rem 0.5rem; -} - -.sha.label .signature { - color: var(--color-text); - background: var(--color-light); - padding: 0.25rem 0.33rem; - border-left: 1px solid var(--color-light-border); - border-top-right-radius: inherit; - border-bottom-right-radius: inherit; -} - -.sha.label .signature-author { - display: flex; - gap: 0.25rem; -} - -.sha.label .signature-author .avatar { - height: 16px; - width: 16px; - margin: 0 !important; /* In some areas selectors with .avatar are too broad */ -} - -.sha.label.isSigned.isWarning { - border: 1px solid var(--color-red-badge); - background: var(--color-red-badge-bg); -} - -.sha.label.isSigned.isWarning .signature { - border-left: 1px solid var(--color-red-badge); - color: var(--color-red-badge); -} - -.sha.label.isSigned.isWarning:hover { - background: var(--color-red-badge-hover-bg); -} - -.sha.label.isSigned.isVerified { - border: 1px solid var(--color-green-badge); - background: var(--color-green-badge-bg); -} - -.sha.label.isSigned.isVerified .signature { - border-left: 1px solid var(--color-green-badge); - color: var(--color-green-badge); -} - -.sha.label.isSigned.isVerified:hover { - background: var(--color-green-badge-hover-bg); -} - -.sha.label.isSigned.isVerifiedUntrusted { - border: 1px solid var(--color-yellow-badge); - background: var(--color-yellow-badge-bg); -} - -.sha.label.isSigned.isVerifiedUntrusted .signature { - border-left: 1px solid var(--color-yellow-badge); - color: var(--color-yellow-badge); -} - -.sha.label.isSigned.isVerifiedUntrusted:hover { - background: var(--color-yellow-badge-hover-bg); -} - -.sha.label.isSigned.isVerifiedUnmatched { - border: 1px solid var(--color-orange-badge); - background: var(--color-orange-badge-bg); -} - -.sha.label.isSigned.isVerifiedUnmatched .signature { - border-left: 1px solid var(--color-orange-badge); - color: var(--color-orange-badge); -} - -.sha.label.isSigned.isVerifiedUnmatched:hover { - background: var(--color-orange-badge-hover-bg); -} diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 4aa6faa46e..a3713a4c3d 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1238,6 +1238,103 @@ pdf-object { background-color: var(--color-light) !important; } +.ui .sha.label { + font-family: var(--fonts-monospace); + font-size: 13px; + font-weight: var(--font-weight-normal); + margin: 0 6px; + padding: 0; + gap: 0; + flex-shrink: 0; +} + +.ui.ui .sha.label { + border: 1px solid var(--color-light-border); +} + +.ui.primary.sha.label { + border: none !important; + background: var(--color-primary) !important; +} + +.sha.label .shortsha { + padding: 0.33rem 0.5rem; +} + +.sha.label .signature { + color: var(--color-text); + background: var(--color-light); + padding: 0.25rem 0.33rem; + border-left: 1px solid var(--color-light-border); +} + +.sha.label .signature-author { + display: flex; + gap: 0.25rem; +} + +.sha.label .signature-author .avatar { + height: 16px; + margin-bottom: 0; + width: 16px; +} + +.sha.label.isSigned.isWarning { + border: 1px solid var(--color-red-badge); + background: var(--color-red-badge-bg); +} + +.sha.label.isSigned.isWarning .signature { + border-left: 1px solid var(--color-red-badge); + color: var(--color-red-badge); +} + +.sha.label.isSigned.isWarning:hover { + background: var(--color-red-badge-hover-bg) !important; +} + +.sha.label.isSigned.isVerified { + border: 1px solid var(--color-green-badge); + background: var(--color-green-badge-bg); +} + +.sha.label.isSigned.isVerified .signature { + border-left: 1px solid var(--color-green-badge); + color: var(--color-green-badge); +} + +.sha.label.isSigned.isVerified:hover { + background: var(--color-green-badge-hover-bg) !important; +} + +.sha.label.isSigned.isVerifiedUntrusted { + border: 1px solid var(--color-yellow-badge); + background: var(--color-yellow-badge-bg); +} + +.sha.label.isSigned.isVerifiedUntrusted .signature { + border-left: 1px solid var(--color-yellow-badge); + color: var(--color-yellow-badge); +} + +.sha.label.isSigned.isVerifiedUntrusted:hover { + background: var(--color-yellow-badge-hover-bg) !important; +} + +.sha.label.isSigned.isVerifiedUnmatched { + border: 1px solid var(--color-orange-badge); + background: var(--color-orange-badge-bg); +} + +.sha.label.isSigned.isVerifiedUnmatched .signature { + border-left: 1px solid var(--color-orange-badge); + color: var(--color-orange-badge); +} + +.sha.label.isSigned.isVerifiedUnmatched:hover { + background: var(--color-orange-badge-hover-bg) !important; +} + .repository .data-table { width: 100%; }