From 5a24438698d29fe65bc4941277533ea263427cd7 Mon Sep 17 00:00:00 2001 From: bircni Date: Thu, 11 Jun 2026 19:33:21 +0200 Subject: [PATCH] chore: various trivial fixes (#38070) Follow-up to #37987, addressing the unresolved review comments on the org members search form. And fix more trivial problems together (see the commit titles) --------- Co-authored-by: wxiaoguang --- modules/markup/markdown/markdown.go | 10 +++---- routers/web/repo/issue_view.go | 5 +++- routers/web/repo/pull.go | 6 ++-- routers/web/repo/pull_merge_form.go | 6 ++-- templates/devtest/flex-list.tmpl | 2 +- templates/devtest/toast-and-message.tmpl | 1 + templates/explore/repos.tmpl | 1 + templates/org/home.tmpl | 1 + templates/org/member/members.tmpl | 15 ++++------ templates/shared/repo/list.tmpl | 4 +-- templates/shared/repo/search.tmpl | 13 ++++----- templates/shared/search/code/results.tmpl | 6 ++-- .../notification_subscriptions.tmpl | 1 + templates/user/profile.tmpl | 2 ++ web_src/css/base.css | 1 + web_src/css/modules/label.css | 11 +------ web_src/css/modules/toast.css | 4 +++ web_src/js/features/repo-search.ts | 29 ++++++------------- web_src/js/modules/devtest.ts | 3 ++ 19 files changed, 59 insertions(+), 62 deletions(-) diff --git a/modules/markup/markdown/markdown.go b/modules/markup/markdown/markdown.go index 790de93c09d..0467ed9ba0c 100644 --- a/modules/markup/markdown/markdown.go +++ b/modules/markup/markdown/markdown.go @@ -65,17 +65,17 @@ func newParserContext(ctx *markup.RenderContext) parser.Context { return pc } -type GlodmarkRender struct { +type GoldmarkRender struct { ctx *markup.RenderContext goldmarkMarkdown goldmark.Markdown } -func (r *GlodmarkRender) Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error { +func (r *GoldmarkRender) Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error { return r.goldmarkMarkdown.Convert(source, writer, opts...) } -func (r *GlodmarkRender) highlightingRenderer(w util.BufWriter, c highlighting.CodeBlockContext, entering bool) { +func (r *GoldmarkRender) highlightingRenderer(w util.BufWriter, c highlighting.CodeBlockContext, entering bool) { if entering { languageBytes, _ := c.Language() languageStr := giteautil.IfZero(string(languageBytes), "text") @@ -136,10 +136,10 @@ func goldmarkDefaultParser() parser.Parser { } // SpecializedMarkdown sets up the Gitea specific markdown extensions -func SpecializedMarkdown(ctx *markup.RenderContext) *GlodmarkRender { +func SpecializedMarkdown(ctx *markup.RenderContext) *GoldmarkRender { // TODO: it could use a pool to cache the renderers to reuse them with different contexts // at the moment it is fast enough (see the benchmarks) - r := &GlodmarkRender{ctx: ctx} + r := &GoldmarkRender{ctx: ctx} r.goldmarkMarkdown = goldmark.New( goldmark.WithParser(goldmarkDefaultParser()), goldmark.WithExtensions( diff --git a/routers/web/repo/issue_view.go b/routers/web/repo/issue_view.go index dfff6c295b5..ac5a3beb036 100644 --- a/routers/web/repo/issue_view.go +++ b/routers/web/repo/issue_view.go @@ -4,6 +4,7 @@ package repo import ( + "errors" "fmt" "math/big" "net/http" @@ -502,7 +503,9 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxCommitSigning(ctx *context.Con wontSignReason = string(err.(*asymkey_service.ErrWontSign).Reason) } else { wontSignReason = "error" - log.Error("Error whilst checking if could sign pr %d in repo %s. Error: %v", pull.ID, pull.BaseRepo.FullName(), err) + if !errors.Is(err, util.ErrNotExist) { + log.Error("Error whilst checking if could sign pr %d in repo %s. Error: %v", pull.ID, pull.BaseRepo.FullName(), err) + } } } } diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index fcd45deea0a..650f94110ff 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -204,7 +204,9 @@ func GetPullDiffStats(ctx *context.Context) { // do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view. headCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(pull.GetGitHeadRefName()) - if err != nil { + if errors.Is(err, util.ErrNotExist) { + return + } else if err != nil { log.Error("Failed to GetRefCommitID: %v, repo: %v", err, ctx.Repo.Repository.FullName()) return } @@ -375,7 +377,7 @@ func (prInfo *pullRequestViewInfo) prepareViewFillCompareInfo(ctx *context.Conte pull := prInfo.issue.PullRequest prInfo.CompareInfo, err = git_service.GetCompareInfo(ctx, ctx.Repo.Repository, ctx.Repo.Repository, ctx.Repo.GitRepo, baseRef, git.RefName(pull.GetGitHeadRefName()), false, false) if err != nil { - isKnownErrorForBroken := gitcmd.IsStderr(err, gitcmd.StderrNotValidObjectName) || gitcmd.IsStderr(err, gitcmd.StderrUnknownRevisionOrPath) + isKnownErrorForBroken := errors.Is(err, util.ErrNotExist) || gitcmd.IsStderr(err, gitcmd.StderrNotValidObjectName) || gitcmd.IsStderr(err, gitcmd.StderrUnknownRevisionOrPath) if !isKnownErrorForBroken { log.Error("GetCompareInfo: %v", err) } diff --git a/routers/web/repo/pull_merge_form.go b/routers/web/repo/pull_merge_form.go index 8fc236d4b4f..668717604f7 100644 --- a/routers/web/repo/pull_merge_form.go +++ b/routers/web/repo/pull_merge_form.go @@ -4,6 +4,7 @@ package repo import ( + "errors" "html/template" pull_model "gitea.dev/models/pull" @@ -11,6 +12,7 @@ import ( "gitea.dev/models/unit" "gitea.dev/modules/svg" "gitea.dev/modules/templates" + "gitea.dev/modules/util" "gitea.dev/services/context" pull_service "gitea.dev/services/pull" ) @@ -61,12 +63,12 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxFormProps(ctx *context.Context } defaultMergeTitle, defaultMergeBody, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, mergeStyle) - if err != nil { + if err != nil && !errors.Is(err, util.ErrNotExist) { ctx.ServerError("GetDefaultMergeMessage", err) return } defaultSquashMergeTitle, defaultSquashMergeBody, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, repo_model.MergeStyleSquash) - if err != nil { + if err != nil && !errors.Is(err, util.ErrNotExist) { ctx.ServerError("GetDefaultSquashMergeMessage", err) return } diff --git a/templates/devtest/flex-list.tmpl b/templates/devtest/flex-list.tmpl index 22030202440..26df0920c5d 100644 --- a/templates/devtest/flex-list.tmpl +++ b/templates/devtest/flex-list.tmpl @@ -72,7 +72,7 @@
- Go + Go {{svg "octicon-star" 16}}45000 {{svg "octicon-git-branch" 16}}1234 diff --git a/templates/devtest/toast-and-message.tmpl b/templates/devtest/toast-and-message.tmpl index 484110ef1bf..85385082b76 100644 --- a/templates/devtest/toast-and-message.tmpl +++ b/templates/devtest/toast-and-message.tmpl @@ -8,6 +8,7 @@ +
diff --git a/templates/explore/repos.tmpl b/templates/explore/repos.tmpl index 68da3983063..02ea81b3688 100644 --- a/templates/explore/repos.tmpl +++ b/templates/explore/repos.tmpl @@ -3,6 +3,7 @@ {{template "explore/navbar" .}}
{{template "shared/repo/search" .}} +
{{template "shared/repo/list" .}} {{template "base/paginate" .}}
diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 12b41c3e942..d1472a889ee 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -9,6 +9,7 @@
{{.ProfileReadmeContent}}
{{end}} {{template "shared/repo/search" .}} +
{{if not .Repos}}
{{svg "octicon-repo" 48}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 7c6b097765b..1a8aefa7a73 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -9,16 +9,13 @@
{{ctx.Locale.Tr "org.teams.manage_team_member_prompt"}}
{{ctx.Locale.Tr "org.teams.manage_team_member"}}
-
{{end}} -
-
-
- {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}} - {{template "shared/search/button"}} -
-
-
+
+
+ {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}} + {{template "shared/search/button"}} +
+
{{range .Members}} {{$isPublic := index $.MembersIsPublicMember .ID}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index af2f5d97003..0b84aa0812e 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -36,8 +36,8 @@