Skip to content

Commit bf664c2

Browse files
authored
Trivial fixes (#33304) (#33312)
Backport #33304 The only conflict is caused by `templates/shared/issueicon.tmpl`
1 parent 52d2988 commit bf664c2

File tree

12 files changed

+52
-43
lines changed

12 files changed

+52
-43
lines changed

Diff for: 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)

Diff for: options/locale/locale_en-US.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -3561,7 +3561,8 @@ conda.install = To install the package using Conda, run the following command:
35613561
container.details.type = Image Type
35623562
container.details.platform = Platform
35633563
container.pull = Pull the image from the command line:
3564-
container.digest = Digest:
3564+
container.images = Images
3565+
container.digest = Digest
35653566
container.multi_arch = OS / Arch
35663567
container.layers = Image Layers
35673568
container.labels = Labels

Diff for: routers/web/repo/actions/view.go

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

Diff for: 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

Diff for: 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

Diff for: 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>

Diff for: 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

Diff for: templates/repo/branch/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
{{if .LatestPullRequest.HasMerged}}
143143
<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>
144144
{{else if .LatestPullRequest.Issue.IsClosed}}
145-
<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>
145+
<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>
146146
{{else}}
147147
<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>
148148
{{end}}

Diff for: 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>

Diff for: templates/shared/issueicon.tmpl

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
{{if .IsPull}}
2-
{{if not .PullRequest}}
1+
{{/* the logic should be kept the same as getIssueIcon/getIssueColor in JS code */}}
2+
{{- if .IsPull -}}
3+
{{- if not .PullRequest -}}
34
No PullRequest
4-
{{else}}
5-
{{if .IsClosed}}
6-
{{if .PullRequest.HasMerged}}
7-
{{svg "octicon-git-merge" 16 "text purple"}}
8-
{{else}}
9-
{{svg "octicon-git-pull-request" 16 "text red"}}
10-
{{end}}
11-
{{else}}
12-
{{if .PullRequest.IsWorkInProgress ctx}}
13-
{{svg "octicon-git-pull-request-draft" 16 "text grey"}}
14-
{{else}}
15-
{{svg "octicon-git-pull-request" 16 "text green"}}
16-
{{end}}
17-
{{end}}
18-
{{end}}
19-
{{else}}
20-
{{if .IsClosed}}
21-
{{svg "octicon-issue-closed" 16 "text red"}}
22-
{{else}}
23-
{{svg "octicon-issue-opened" 16 "text green"}}
24-
{{end}}
25-
{{end}}
5+
{{- else -}}
6+
{{- if .IsClosed -}}
7+
{{- if .PullRequest.HasMerged -}}
8+
{{- svg "octicon-git-merge" 16 "text purple" -}}
9+
{{- else -}}
10+
{{- svg "octicon-git-pull-request-closed" 16 "text red" -}}
11+
{{- end -}}
12+
{{- else -}}
13+
{{- if .PullRequest.IsWorkInProgress ctx -}}
14+
{{- svg "octicon-git-pull-request-draft" 16 "text grey" -}}
15+
{{- else -}}
16+
{{- svg "octicon-git-pull-request" 16 "text green" -}}
17+
{{- end -}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{- else -}}
21+
{{- if .IsClosed -}}
22+
{{- svg "octicon-issue-closed" 16 "text red" -}}
23+
{{- else -}}
24+
{{- svg "octicon-issue-opened" 16 "text green" -}}
25+
{{- end -}}
26+
{{- end -}}

Diff for: 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
}

Diff for: web_src/js/svg.ts

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg
3434
import octiconGitCommit from '../../public/assets/img/svg/octicon-git-commit.svg';
3535
import octiconGitMerge from '../../public/assets/img/svg/octicon-git-merge.svg';
3636
import octiconGitPullRequest from '../../public/assets/img/svg/octicon-git-pull-request.svg';
37+
import octiconGitPullRequestClosed from '../../public/assets/img/svg/octicon-git-pull-request-closed.svg';
3738
import octiconGitPullRequestDraft from '../../public/assets/img/svg/octicon-git-pull-request-draft.svg';
3839
import octiconGrabber from '../../public/assets/img/svg/octicon-grabber.svg';
3940
import octiconHeading from '../../public/assets/img/svg/octicon-heading.svg';
@@ -110,6 +111,7 @@ const svgs = {
110111
'octicon-git-commit': octiconGitCommit,
111112
'octicon-git-merge': octiconGitMerge,
112113
'octicon-git-pull-request': octiconGitPullRequest,
114+
'octicon-git-pull-request-closed': octiconGitPullRequestClosed,
113115
'octicon-git-pull-request-draft': octiconGitPullRequestDraft,
114116
'octicon-grabber': octiconGrabber,
115117
'octicon-heading': octiconHeading,

0 commit comments

Comments
 (0)