diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2025-01-18 03:09:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-18 03:09:17 +0800 |
commit | bf664c2e85827f3b745033477f8b68d5848ad879 (patch) | |
tree | 0cd8baa2ca22ab07abcd2d3aeeafe5f7ac8ed6eb | |
parent | 52d298890b009f719713a4d029ad11667ae20407 (diff) | |
download | gitea-bf664c2e85827f3b745033477f8b68d5848ad879.tar.gz gitea-bf664c2e85827f3b745033477f8b68d5848ad879.zip |
Trivial fixes (#33304) (#33312)release/v1.23
Backport #33304
The only conflict is caused by `templates/shared/issueicon.tmpl`
-rw-r--r-- | modules/repository/branch.go | 4 | ||||
-rw-r--r-- | options/locale/locale_en-US.ini | 3 | ||||
-rw-r--r-- | routers/web/repo/actions/view.go | 2 | ||||
-rw-r--r-- | routers/web/repo/issue_dependency.go | 2 | ||||
-rw-r--r-- | routers/web/repo/issue_watch.go | 2 | ||||
-rw-r--r-- | templates/package/content/container.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/maven.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/branch/list.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 2 | ||||
-rw-r--r-- | templates/shared/issueicon.tmpl | 49 | ||||
-rw-r--r-- | web_src/js/features/issue.ts | 23 | ||||
-rw-r--r-- | web_src/js/svg.ts | 2 |
12 files changed, 52 insertions, 43 deletions
diff --git a/modules/repository/branch.go b/modules/repository/branch.go index 4630e70aa8..2bf9930f19 100644 --- a/modules/repository/branch.go +++ b/modules/repository/branch.go @@ -6,7 +6,6 @@ package repository import ( "context" "fmt" - "strings" "code.gitea.io/gitea/models/db" git_model "code.gitea.io/gitea/models/git" @@ -52,9 +51,6 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository, { branches, _, err := gitRepo.GetBranchNames(0, 0) if err != nil { - if strings.Contains(err.Error(), "ref file is empty") { - return 0, nil - } return 0, err } log.Trace("SyncRepoBranches[%s]: branches[%d]: %v", repo.FullName(), len(branches), branches) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c7cede4dc0..8c18395e17 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3561,7 +3561,8 @@ conda.install = To install the package using Conda, run the following command: container.details.type = Image Type container.details.platform = Platform container.pull = Pull the image from the command line: -container.digest = Digest: +container.images = Images +container.digest = Digest container.multi_arch = OS / Arch container.layers = Image Layers container.labels = Labels diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index ba17fa427d..fe490ac717 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -855,7 +855,7 @@ func Run(ctx *context_module.Context) { inputs := make(map[string]any) if workflowDispatch := workflow.WorkflowDispatchConfig(); workflowDispatch != nil { for name, config := range workflowDispatch.Inputs { - value := ctx.Req.PostForm.Get(name) + value := ctx.Req.PostFormValue(name) if config.Type == "boolean" { // https://www.w3.org/TR/html401/interact/forms.html // https://stackoverflow.com/questions/11424037/do-checkbox-inputs-only-post-data-if-theyre-checked diff --git a/routers/web/repo/issue_dependency.go b/routers/web/repo/issue_dependency.go index f1d133edb0..0f6787386d 100644 --- a/routers/web/repo/issue_dependency.go +++ b/routers/web/repo/issue_dependency.go @@ -109,7 +109,7 @@ func RemoveDependency(ctx *context.Context) { } // Dependency Type - depTypeStr := ctx.Req.PostForm.Get("dependencyType") + depTypeStr := ctx.Req.PostFormValue("dependencyType") var depType issues_model.DependencyType diff --git a/routers/web/repo/issue_watch.go b/routers/web/repo/issue_watch.go index 8b033f3b17..6799bf8eb2 100644 --- a/routers/web/repo/issue_watch.go +++ b/routers/web/repo/issue_watch.go @@ -46,7 +46,7 @@ func IssueWatch(ctx *context.Context) { return } - watch, err := strconv.ParseBool(ctx.Req.PostForm.Get("watch")) + watch, err := strconv.ParseBool(ctx.Req.PostFormValue("watch")) if err != nil { ctx.ServerError("watch is not bool", err) return diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl index 04732d276a..a88ebec3bc 100644 --- a/templates/package/content/container.tmpl +++ b/templates/package/content/container.tmpl @@ -24,7 +24,7 @@ </div> </div> {{if .PackageDescriptor.Metadata.Manifests}} - <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4> + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.images"}}</h4> <div class="ui attached segment"> <table class="ui very basic compact table"> <thead> diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl index f56595a830..e98fc53692 100644 --- a/templates/package/content/maven.tmpl +++ b/templates/package/content/maven.tmpl @@ -11,7 +11,7 @@ <div class="markup"><pre class="code-block"><code><repositories> <repository> <id>gitea</id> - <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> </repository> </repositories> diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 5484024ff8..f10b2ef711 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -142,7 +142,7 @@ {{if .LatestPullRequest.HasMerged}} <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> {{else if .LatestPullRequest.Issue.IsClosed}} - <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> + <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> {{else}} <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> {{end}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index bf2ede58e4..7bb00ff9a9 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -42,7 +42,7 @@ {{if .HasMerged}} <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> {{else if .Issue.IsClosed}} - <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> + <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> {{else if .Issue.IsPull}} {{if .IsPullWorkInProgress}} <div class="ui grey label issue-state-label">{{svg "octicon-git-pull-request-draft"}} {{ctx.Locale.Tr "repo.issues.draft_title"}}</div> diff --git a/templates/shared/issueicon.tmpl b/templates/shared/issueicon.tmpl index a62714e988..bb6247c708 100644 --- a/templates/shared/issueicon.tmpl +++ b/templates/shared/issueicon.tmpl @@ -1,25 +1,26 @@ -{{if .IsPull}} - {{if not .PullRequest}} +{{/* the logic should be kept the same as getIssueIcon/getIssueColor in JS code */}} +{{- if .IsPull -}} + {{- if not .PullRequest -}} No PullRequest - {{else}} - {{if .IsClosed}} - {{if .PullRequest.HasMerged}} - {{svg "octicon-git-merge" 16 "text purple"}} - {{else}} - {{svg "octicon-git-pull-request" 16 "text red"}} - {{end}} - {{else}} - {{if .PullRequest.IsWorkInProgress ctx}} - {{svg "octicon-git-pull-request-draft" 16 "text grey"}} - {{else}} - {{svg "octicon-git-pull-request" 16 "text green"}} - {{end}} - {{end}} - {{end}} -{{else}} - {{if .IsClosed}} - {{svg "octicon-issue-closed" 16 "text red"}} - {{else}} - {{svg "octicon-issue-opened" 16 "text green"}} - {{end}} -{{end}} + {{- else -}} + {{- if .IsClosed -}} + {{- if .PullRequest.HasMerged -}} + {{- svg "octicon-git-merge" 16 "text purple" -}} + {{- else -}} + {{- svg "octicon-git-pull-request-closed" 16 "text red" -}} + {{- end -}} + {{- else -}} + {{- if .PullRequest.IsWorkInProgress ctx -}} + {{- svg "octicon-git-pull-request-draft" 16 "text grey" -}} + {{- else -}} + {{- svg "octicon-git-pull-request" 16 "text green" -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .IsClosed -}} + {{- svg "octicon-issue-closed" 16 "text red" -}} + {{- else -}} + {{- svg "octicon-issue-opened" 16 "text green" -}} + {{- end -}} +{{- end -}} diff --git a/web_src/js/features/issue.ts b/web_src/js/features/issue.ts index a56015a2a2..911cf713d9 100644 --- a/web_src/js/features/issue.ts +++ b/web_src/js/features/issue.ts @@ -1,17 +1,21 @@ import type {Issue} from '../types.ts'; +// the getIssueIcon/getIssueColor logic should be kept the same as "templates/shared/issueicon.tmpl" + export function getIssueIcon(issue: Issue) { if (issue.pull_request) { if (issue.state === 'open') { - if (issue.pull_request.draft === true) { + if (issue.pull_request.draft) { return 'octicon-git-pull-request-draft'; // WIP PR } return 'octicon-git-pull-request'; // Open PR - } else if (issue.pull_request.merged === true) { + } else if (issue.pull_request.merged) { return 'octicon-git-merge'; // Merged PR } - return 'octicon-git-pull-request'; // Closed PR - } else if (issue.state === 'open') { + return 'octicon-git-pull-request-closed'; // Closed PR + } + + if (issue.state === 'open') { return 'octicon-issue-opened'; // Open Issue } return 'octicon-issue-closed'; // Closed Issue @@ -19,12 +23,17 @@ export function getIssueIcon(issue: Issue) { export function getIssueColor(issue: Issue) { if (issue.pull_request) { - if (issue.pull_request.draft === true) { - return 'grey'; // WIP PR - } else if (issue.pull_request.merged === true) { + if (issue.state === 'open') { + if (issue.pull_request.draft) { + return 'grey'; // WIP PR + } + return 'green'; // Open PR + } else if (issue.pull_request.merged) { return 'purple'; // Merged PR } + return 'red'; // Closed PR } + if (issue.state === 'open') { return 'green'; // Open Issue } diff --git a/web_src/js/svg.ts b/web_src/js/svg.ts index 90b12fa87d..8b4a2df336 100644 --- a/web_src/js/svg.ts +++ b/web_src/js/svg.ts @@ -34,6 +34,7 @@ import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg import octiconGitCommit from '../../public/assets/img/svg/octicon-git-commit.svg'; import octiconGitMerge from '../../public/assets/img/svg/octicon-git-merge.svg'; import octiconGitPullRequest from '../../public/assets/img/svg/octicon-git-pull-request.svg'; +import octiconGitPullRequestClosed from '../../public/assets/img/svg/octicon-git-pull-request-closed.svg'; import octiconGitPullRequestDraft from '../../public/assets/img/svg/octicon-git-pull-request-draft.svg'; import octiconGrabber from '../../public/assets/img/svg/octicon-grabber.svg'; import octiconHeading from '../../public/assets/img/svg/octicon-heading.svg'; @@ -110,6 +111,7 @@ const svgs = { 'octicon-git-commit': octiconGitCommit, 'octicon-git-merge': octiconGitMerge, 'octicon-git-pull-request': octiconGitPullRequest, + 'octicon-git-pull-request-closed': octiconGitPullRequestClosed, 'octicon-git-pull-request-draft': octiconGitPullRequestDraft, 'octicon-grabber': octiconGrabber, 'octicon-heading': octiconHeading, |