Skip to content

Commit 3b839f8

Browse files
authored
Trivial fixes (#33304)
1. the error check was added for go-git, it was caused by the empty `.keep` file in the test fixtures. 2. use `PostFormValue` instead of `PostForm.Get` (`Get` needs to parse the form ahead) 3. fix incorrect container text (it should show "Images" in the header but not "OS/Arch") 4. align maven xml 5. fix closed PR color&icon
1 parent 7582eb0 commit 3b839f8

File tree

12 files changed

+29
-20
lines changed

12 files changed

+29
-20
lines changed

modules/repository/branch.go

-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package repository
66
import (
77
"context"
88
"fmt"
9-
"strings"
109

1110
"code.gitea.io/gitea/models/db"
1211
git_model "code.gitea.io/gitea/models/git"
@@ -52,9 +51,6 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
5251
{
5352
branches, _, err := gitRepo.GetBranchNames(0, 0)
5453
if err != nil {
55-
if strings.Contains(err.Error(), "ref file is empty") {
56-
return 0, nil
57-
}
5854
return 0, err
5955
}
6056
log.Trace("SyncRepoBranches[%s]: branches[%d]: %v", repo.FullName(), len(branches), branches)

options/locale/locale_en-US.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,8 @@ conda.install = To install the package using Conda, run the following command:
35733573
container.details.type = Image Type
35743574
container.details.platform = Platform
35753575
container.pull = Pull the image from the command line:
3576-
container.digest = Digest:
3576+
container.images = Images
3577+
container.digest = Digest
35773578
container.multi_arch = OS / Arch
35783579
container.layers = Image Layers
35793580
container.labels = Labels

routers/web/repo/actions/view.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ func Run(ctx *context_module.Context) {
850850
inputs := make(map[string]any)
851851
if workflowDispatch := workflow.WorkflowDispatchConfig(); workflowDispatch != nil {
852852
for name, config := range workflowDispatch.Inputs {
853-
value := ctx.Req.PostForm.Get(name)
853+
value := ctx.Req.PostFormValue(name)
854854
if config.Type == "boolean" {
855855
// https://www.w3.org/TR/html401/interact/forms.html
856856
// https://stackoverflow.com/questions/11424037/do-checkbox-inputs-only-post-data-if-theyre-checked

routers/web/repo/issue_dependency.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func RemoveDependency(ctx *context.Context) {
109109
}
110110

111111
// Dependency Type
112-
depTypeStr := ctx.Req.PostForm.Get("dependencyType")
112+
depTypeStr := ctx.Req.PostFormValue("dependencyType")
113113

114114
var depType issues_model.DependencyType
115115

routers/web/repo/issue_watch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func IssueWatch(ctx *context.Context) {
4646
return
4747
}
4848

49-
watch, err := strconv.ParseBool(ctx.Req.PostForm.Get("watch"))
49+
watch, err := strconv.ParseBool(ctx.Req.PostFormValue("watch"))
5050
if err != nil {
5151
ctx.ServerError("watch is not bool", err)
5252
return

templates/package/content/container.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525
</div>
2626
{{if .PackageDescriptor.Metadata.Manifests}}
27-
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4>
27+
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.images"}}</h4>
2828
<div class="ui attached segment">
2929
<table class="ui very basic compact table">
3030
<thead>

templates/package/content/maven.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="markup"><pre class="code-block"><code>&lt;repositories&gt;
1212
&lt;repository&gt;
1313
&lt;id&gt;gitea&lt;/id&gt;
14-
&lt;url&gt;<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url>&lt;/url&gt;
14+
&lt;url&gt;<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url>&lt;/url&gt;
1515
&lt;/repository&gt;
1616
&lt;/repositories&gt;
1717

templates/repo/branch/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
{{if .LatestPullRequest.HasMerged}}
144144
<a href="{{.LatestPullRequest.Issue.Link}}" class="ui purple large label">{{svg "octicon-git-merge" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.pulls.merged"}}</a>
145145
{{else if .LatestPullRequest.Issue.IsClosed}}
146-
<a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a>
146+
<a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request-closed" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a>
147147
{{else}}
148148
<a href="{{.LatestPullRequest.Issue.Link}}" class="ui green large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.open_title"}}</a>
149149
{{end}}

templates/repo/issue/view_title.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{{if .HasMerged}}
4343
<div class="ui purple label issue-state-label">{{svg "octicon-git-merge" 16 "tw-mr-1"}} {{if eq .Issue.PullRequest.Status 3}}{{ctx.Locale.Tr "repo.pulls.manually_merged"}}{{else}}{{ctx.Locale.Tr "repo.pulls.merged"}}{{end}}</div>
4444
{{else if .Issue.IsClosed}}
45-
<div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div>
45+
<div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request-closed" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div>
4646
{{else if .Issue.IsPull}}
4747
{{if .IsPullWorkInProgress}}
4848
<div class="ui grey label issue-state-label">{{svg "octicon-git-pull-request-draft"}} {{ctx.Locale.Tr "repo.issues.draft_title"}}</div>

templates/shared/issueicon.tmpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{/* the logic should be kept the same as getIssueIcon/getIssueColor in JS code */}}
12
{{- if .IsPull -}}
23
{{- if not .PullRequest -}}
34
No PullRequest
@@ -6,7 +7,7 @@
67
{{- if .PullRequest.HasMerged -}}
78
{{- svg "octicon-git-merge" 16 "text purple" -}}
89
{{- else -}}
9-
{{- svg "octicon-git-pull-request" 16 "text red" -}}
10+
{{- svg "octicon-git-pull-request-closed" 16 "text red" -}}
1011
{{- end -}}
1112
{{- else -}}
1213
{{- if .PullRequest.IsWorkInProgress ctx -}}

web_src/js/features/issue.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
11
import type {Issue} from '../types.ts';
22

3+
// the getIssueIcon/getIssueColor logic should be kept the same as "templates/shared/issueicon.tmpl"
4+
35
export function getIssueIcon(issue: Issue) {
46
if (issue.pull_request) {
57
if (issue.state === 'open') {
6-
if (issue.pull_request.draft === true) {
8+
if (issue.pull_request.draft) {
79
return 'octicon-git-pull-request-draft'; // WIP PR
810
}
911
return 'octicon-git-pull-request'; // Open PR
10-
} else if (issue.pull_request.merged === true) {
12+
} else if (issue.pull_request.merged) {
1113
return 'octicon-git-merge'; // Merged PR
1214
}
13-
return 'octicon-git-pull-request'; // Closed PR
14-
} else if (issue.state === 'open') {
15+
return 'octicon-git-pull-request-closed'; // Closed PR
16+
}
17+
18+
if (issue.state === 'open') {
1519
return 'octicon-issue-opened'; // Open Issue
1620
}
1721
return 'octicon-issue-closed'; // Closed Issue
1822
}
1923

2024
export function getIssueColor(issue: Issue) {
2125
if (issue.pull_request) {
22-
if (issue.pull_request.draft === true) {
23-
return 'grey'; // WIP PR
24-
} else if (issue.pull_request.merged === true) {
26+
if (issue.state === 'open') {
27+
if (issue.pull_request.draft) {
28+
return 'grey'; // WIP PR
29+
}
30+
return 'green'; // Open PR
31+
} else if (issue.pull_request.merged) {
2532
return 'purple'; // Merged PR
2633
}
34+
return 'red'; // Closed PR
2735
}
36+
2837
if (issue.state === 'open') {
2938
return 'green'; // Open Issue
3039
}

web_src/js/svg.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg
3535
import octiconGitCommit from '../../public/assets/img/svg/octicon-git-commit.svg';
3636
import octiconGitMerge from '../../public/assets/img/svg/octicon-git-merge.svg';
3737
import octiconGitPullRequest from '../../public/assets/img/svg/octicon-git-pull-request.svg';
38+
import octiconGitPullRequestClosed from '../../public/assets/img/svg/octicon-git-pull-request-closed.svg';
3839
import octiconGitPullRequestDraft from '../../public/assets/img/svg/octicon-git-pull-request-draft.svg';
3940
import octiconGrabber from '../../public/assets/img/svg/octicon-grabber.svg';
4041
import octiconHeading from '../../public/assets/img/svg/octicon-heading.svg';
@@ -112,6 +113,7 @@ const svgs = {
112113
'octicon-git-commit': octiconGitCommit,
113114
'octicon-git-merge': octiconGitMerge,
114115
'octicon-git-pull-request': octiconGitPullRequest,
116+
'octicon-git-pull-request-closed': octiconGitPullRequestClosed,
115117
'octicon-git-pull-request-draft': octiconGitPullRequestDraft,
116118
'octicon-grabber': octiconGrabber,
117119
'octicon-heading': octiconHeading,

0 commit comments

Comments
 (0)