From b811ab48e513a5b98edb935e0c63e76233ee1783 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Mon, 20 Feb 2023 16:08:33 +0900 Subject: [PATCH 01/65] Add all units to the units permission list in org team members sidebar (#22971) Add all units to the units permission list in org team members sidebar. Before: ![BQF448EIHEYKY62XGG(5101](https://user-images.githubusercontent.com/18380374/219877772-b57df8fb-2b82-4b1a-85c8-3809f8751cab.png) After: ![image](https://user-images.githubusercontent.com/18380374/219877762-f69482b8-abf9-4333-978e-6a3f52039a16.png) Co-authored-by: Lunny Xiao --- templates/org/team/sidebar.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index ab118a7e26..507173e51f 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -58,7 +58,7 @@ {{range $t, $unit := $.Units}} - {{if and (lt $unit.MaxPerm 2) (not $unit.Type.UnitGlobalDisabled)}} + {{if (not $unit.Type.UnitGlobalDisabled)}} {{$.locale.Tr $unit.NameKey}} {{if eq ($.Team.UnitAccessMode $.Context $unit.Type) 0 -}} From 1d64eafe8f296e77c59c18fcda428d2b5df67ac0 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Mon, 20 Feb 2023 16:42:02 +0800 Subject: [PATCH 02/65] Add me to maintainers (#22998) Add me to maintainers. [List of merged PRs](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3AZettat123+is%3Amerged) Co-authored-by: Jason Song --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index a37d336de3..b1adf9ef0d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -47,3 +47,4 @@ Wim (@42wim) Xinyu Zhou (@xin-u) Jason Song (@wolfogre) Yarden Shoham (@yardenshoham) +Yu Tian (@Zettat123) From 3596df52c09831f7f39f8416264ff267954f35a0 Mon Sep 17 00:00:00 2001 From: oliverpool <3864879+oliverpool@users.noreply.github.com> Date: Mon, 20 Feb 2023 09:43:04 +0100 Subject: [PATCH 03/65] Fix hidden commit status on multiple checks (#22889) Since #22632, when a commit status has multiple checks, no check is shown at all (hence no way to see the other checks). This PR fixes this by always adding a tag with the `.commit-statuses-trigger` to the DOM (the `.vm` is for vertical alignment). ![2023-02-13-120528](https://user-images.githubusercontent.com/3864879/218441846-1a79c169-2efd-46bb-9e75-d8b45d7cc8e3.png) --------- Co-authored-by: Lunny Xiao --- templates/repo/commit_statuses.tmpl | 16 +++++-- tests/integration/git_test.go | 15 +++++-- tests/integration/pull_status_test.go | 21 ++++++---- tests/integration/repo_commits_test.go | 58 ++++++++++++++++++++++++-- web_src/js/features/repo-commit.js | 2 +- web_src/less/_base.less | 3 +- web_src/less/_repository.less | 24 ----------- 7 files changed, 92 insertions(+), 47 deletions(-) diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index 8250a85817..8858fb8402 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -1,6 +1,14 @@ -{{if eq (len .Statuses) 1}}{{$status := index .Statuses 0}}{{if $status.TargetURL}}{{template "repo/commit_status" .Status}}{{end}}{{end}} -
-
+{{if .Statuses}} + {{if and (eq (len .Statuses) 1) .Status.TargetURL}} + + {{template "repo/commit_status" .Status}} + + {{else}} + + {{template "repo/commit_status" .Status}} + + {{end}} +
{{range .Statuses}}
{{template "repo/commit_status" .}} @@ -11,4 +19,4 @@
{{end}}
-
+{{end}} diff --git a/tests/integration/git_test.go b/tests/integration/git_test.go index 420a8676b9..d21f3994a1 100644 --- a/tests/integration/git_test.go +++ b/tests/integration/git_test.go @@ -630,8 +630,17 @@ func doAutoPRMerge(baseCtx *APITestContext, dstPath string) func(t *testing.T) { commitID := path.Base(commitURL) + addCommitStatus := func(status api.CommitStatusState) func(*testing.T) { + return doAPICreateCommitStatus(ctx, commitID, api.CreateStatusOption{ + State: status, + TargetURL: "http://test.ci/", + Description: "", + Context: "testci", + }) + } + // Call API to add Pending status for commit - t.Run("CreateStatus", doAPICreateCommitStatus(ctx, commitID, api.CommitStatusPending)) + t.Run("CreateStatus", addCommitStatus(api.CommitStatusPending)) // Cancel not existing auto merge ctx.ExpectedCode = http.StatusNotFound @@ -660,7 +669,7 @@ func doAutoPRMerge(baseCtx *APITestContext, dstPath string) func(t *testing.T) { assert.False(t, pr.HasMerged) // Call API to add Failure status for commit - t.Run("CreateStatus", doAPICreateCommitStatus(ctx, commitID, api.CommitStatusFailure)) + t.Run("CreateStatus", addCommitStatus(api.CommitStatusFailure)) // Check pr status pr, err = doAPIGetPullRequest(ctx, baseCtx.Username, baseCtx.Reponame, pr.Index)(t) @@ -668,7 +677,7 @@ func doAutoPRMerge(baseCtx *APITestContext, dstPath string) func(t *testing.T) { assert.False(t, pr.HasMerged) // Call API to add Success status for commit - t.Run("CreateStatus", doAPICreateCommitStatus(ctx, commitID, api.CommitStatusSuccess)) + t.Run("CreateStatus", addCommitStatus(api.CommitStatusSuccess)) // wait to let gitea merge stuff time.Sleep(time.Second) diff --git a/tests/integration/pull_status_test.go b/tests/integration/pull_status_test.go index e60d17edc0..736d1ee4f0 100644 --- a/tests/integration/pull_status_test.go +++ b/tests/integration/pull_status_test.go @@ -70,7 +70,12 @@ func TestPullCreate_CommitStatus(t *testing.T) { for _, status := range statusList { // Call API to add status for commit - t.Run("CreateStatus", doAPICreateCommitStatus(testCtx, commitID, status)) + t.Run("CreateStatus", doAPICreateCommitStatus(testCtx, commitID, api.CreateStatusOption{ + State: status, + TargetURL: "http://test.ci/", + Description: "", + Context: "testci", + })) req = NewRequestf(t, "GET", "/user1/repo1/pulls/1/commits") resp = session.MakeRequest(t, req, http.StatusOK) @@ -88,15 +93,13 @@ func TestPullCreate_CommitStatus(t *testing.T) { }) } -func doAPICreateCommitStatus(ctx APITestContext, commitID string, status api.CommitStatusState) func(*testing.T) { +func doAPICreateCommitStatus(ctx APITestContext, commitID string, data api.CreateStatusOption) func(*testing.T) { return func(t *testing.T) { - req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/statuses/%s?token=%s", ctx.Username, ctx.Reponame, commitID, ctx.Token), - api.CreateStatusOption{ - State: status, - TargetURL: "http://test.ci/", - Description: "", - Context: "testci", - }, + req := NewRequestWithJSON( + t, + http.MethodPost, + fmt.Sprintf("/api/v1/repos/%s/%s/statuses/%s?token=%s", ctx.Username, ctx.Reponame, commitID, ctx.Token), + data, ) if ctx.ExpectedCode != 0 { ctx.Session.MakeRequest(t, req, ctx.ExpectedCode) diff --git a/tests/integration/repo_commits_test.go b/tests/integration/repo_commits_test.go index cbd83c6deb..e74e3867f4 100644 --- a/tests/integration/repo_commits_test.go +++ b/tests/integration/repo_commits_test.go @@ -52,14 +52,19 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) { // Call API to add status for commit ctx := NewAPITestContext(t, "user2", "repo1", auth_model.AccessTokenScopeRepo) - t.Run("CreateStatus", doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CommitStatusState(state))) + t.Run("CreateStatus", doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CreateStatusOption{ + State: api.CommitStatusState(state), + TargetURL: "http://test.ci/", + Description: "", + Context: "testci", + })) req = NewRequest(t, "GET", "/user2/repo1/commits/branch/master") resp = session.MakeRequest(t, req, http.StatusOK) doc = NewHTMLParser(t, resp.Body) - // Check if commit status is displayed in message column - sel := doc.doc.Find("#commits-table tbody tr td.message a.commit-statuses-trigger .commit-status") + // Check if commit status is displayed in message column (.tippy-target to ignore the tippy trigger) + sel := doc.doc.Find("#commits-table tbody tr td.message .tippy-target .commit-status") assert.Equal(t, 1, sel.Length()) for _, class := range classes { assert.True(t, sel.HasClass(class)) @@ -145,7 +150,12 @@ func TestRepoCommitsStatusParallel(t *testing.T) { go func(parentT *testing.T, i int) { parentT.Run(fmt.Sprintf("ParallelCreateStatus_%d", i), func(t *testing.T) { ctx := NewAPITestContext(t, "user2", "repo1", auth_model.AccessTokenScopeRepoStatus) - runBody := doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CommitStatusState("pending")) + runBody := doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CreateStatusOption{ + State: api.CommitStatusPending, + TargetURL: "http://test.ci/", + Description: "", + Context: "testci", + }) runBody(t) wg.Done() }) @@ -153,3 +163,43 @@ func TestRepoCommitsStatusParallel(t *testing.T) { } wg.Wait() } + +func TestRepoCommitsStatusMultiple(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + session := loginUser(t, "user2") + + // Request repository commits page + req := NewRequest(t, "GET", "/user2/repo1/commits/branch/master") + resp := session.MakeRequest(t, req, http.StatusOK) + + doc := NewHTMLParser(t, resp.Body) + // Get first commit URL + commitURL, exists := doc.doc.Find("#commits-table tbody tr td.sha a").Attr("href") + assert.True(t, exists) + assert.NotEmpty(t, commitURL) + + // Call API to add status for commit + ctx := NewAPITestContext(t, "user2", "repo1", auth_model.AccessTokenScopeRepo) + t.Run("CreateStatus", doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CreateStatusOption{ + State: api.CommitStatusSuccess, + TargetURL: "http://test.ci/", + Description: "", + Context: "testci", + })) + + t.Run("CreateStatus", doAPICreateCommitStatus(ctx, path.Base(commitURL), api.CreateStatusOption{ + State: api.CommitStatusSuccess, + TargetURL: "http://test.ci/", + Description: "", + Context: "other_context", + })) + + req = NewRequest(t, "GET", "/user2/repo1/commits/branch/master") + resp = session.MakeRequest(t, req, http.StatusOK) + + doc = NewHTMLParser(t, resp.Body) + // Check that the data-tippy="commit-statuses" (for trigger) and commit-status (svg) are present + sel := doc.doc.Find("#commits-table tbody tr td.message [data-tippy=\"commit-statuses\"] .commit-status") + assert.Equal(t, 1, sel.Length()) +} diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js index e2eef3ee59..d22aa8e980 100644 --- a/web_src/js/features/repo-commit.js +++ b/web_src/js/features/repo-commit.js @@ -58,7 +58,7 @@ export function initRepoCommitLastCommitLoader() { } export function initCommitStatuses() { - $('.commit-statuses-trigger').each(function () { + $('[data-tippy="commit-statuses"]').each(function () { const top = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0; createTippy(this, { diff --git a/web_src/less/_base.less b/web_src/less/_base.less index fae29d0d60..fc04df4f94 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -340,8 +340,7 @@ a.label, .ui.search .results a, .ui .menu a, .ui.cards a.card, -.issue-keyword a, -a.commit-statuses-trigger { +.issue-keyword a { text-decoration: none !important; } diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index f489335712..3bec5f58fb 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1,28 +1,4 @@ .repository { - .popup.commit-statuses { - // we had better limit the max size of the popup, and add scroll bars if the content size is too large. - // otherwise some part of the popup will be hidden by viewport boundary - max-height: 45vh; - max-width: 60vw; - - &.ui.right { - // Override `.ui.attached.header .right:not(.dropdown) height: 30px;` which would otherwise lead to - // the status popup box having its height fixed at 30px. See https://github.com/go-gitea/gitea/issues/18498 - height: auto; - } - - overflow: auto; - padding: 0; - - .list { - padding: .8em; // to make the scrollbar align to the border, we move the padding from outer `.popup` to this inside `.list` - - > .item { - line-height: 2; - } - } - } - .repo-header { .ui.compact.menu { margin-left: 1rem; From 9a83aa28a351c9af1731a94ce0e1b5d3842db4e8 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Mon, 20 Feb 2023 19:30:41 +0800 Subject: [PATCH 04/65] Get rules by id when editing branch protection rule (#22932) When users rename an existing branch protection rule, a new rule with the new name will be created and the old rule will still exist. ![image](https://user-images.githubusercontent.com/15528715/219276442-d3c001ad-e693-44ec-9ad2-b33f2666b49b.png) --- ![image](https://user-images.githubusercontent.com/15528715/219276478-547c3b93-b3f1-4292-a1ef-c1b7747fe1bb.png) The reason is that the `SettingsProtectedBranchPost` function only get branch protection rule by name before updating or creating a rule. When the rule name changes, the function cannot find the existing rule so it will create a new rule rather than update the existing rule. To fix the bug, the function should get rule by id first. --------- Co-authored-by: Lunny Xiao --- options/locale/locale_en-US.ini | 1 + routers/web/repo/setting_protected_branch.go | 34 +++++++++++++++++--- services/forms/repo_form.go | 1 + 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 411a585c81..92ca5be8d3 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2152,6 +2152,7 @@ settings.choose_branch = Choose a branch… settings.no_protected_branch = There are no protected branches. settings.edit_protected_branch = Edit settings.protected_branch_required_rule_name = Required rule name +settings.protected_branch_duplicate_rule_name = Duplicate rule name settings.protected_branch_required_approvals_min = Required approvals cannot be negative. settings.tags = Tags settings.tags.protection = Tag Protection diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index a54565c1f1..0a8c39fef0 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -166,10 +166,36 @@ func SettingsProtectedBranchPost(ctx *context.Context) { } var err error - protectBranch, err = git_model.GetProtectedBranchRuleByName(ctx, ctx.Repo.Repository.ID, f.RuleName) - if err != nil { - ctx.ServerError("GetProtectBranchOfRepoByName", err) - return + if f.RuleID > 0 { + // If the RuleID isn't 0, it must be an edit operation. So we get rule by id. + protectBranch, err = git_model.GetProtectedBranchRuleByID(ctx, ctx.Repo.Repository.ID, f.RuleID) + if err != nil { + ctx.ServerError("GetProtectBranchOfRepoByID", err) + return + } + if protectBranch != nil && protectBranch.RuleName != f.RuleName { + // RuleName changed. We need to check if there is a rule with the same name. + // If a rule with the same name exists, an error should be returned. + sameNameProtectBranch, err := git_model.GetProtectedBranchRuleByName(ctx, ctx.Repo.Repository.ID, f.RuleName) + if err != nil { + ctx.ServerError("GetProtectBranchOfRepoByName", err) + return + } + if sameNameProtectBranch != nil { + ctx.Flash.Error(ctx.Tr("repo.settings.protected_branch_duplicate_rule_name")) + ctx.Redirect(fmt.Sprintf("%s/settings/branches/edit?rule_name=%s", ctx.Repo.RepoLink, protectBranch.RuleName)) + return + } + } + } else { + // FIXME: If a new ProtectBranch has a duplicate RuleName, an error should be returned. + // Currently, if a new ProtectBranch with a duplicate RuleName is created, the existing ProtectBranch will be updated. + // But we cannot modify this logic now because many unit tests rely on it. + protectBranch, err = git_model.GetProtectedBranchRuleByName(ctx, ctx.Repo.Repository.ID, f.RuleName) + if err != nil { + ctx.ServerError("GetProtectBranchOfRepoByName", err) + return + } } if protectBranch == nil { // No options found, create defaults. diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index ff0916f8e1..374ae0ac5c 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -190,6 +190,7 @@ func (f *RepoSettingForm) Validate(req *http.Request, errs binding.Errors) bindi // ProtectBranchForm form for changing protected branch settings type ProtectBranchForm struct { RuleName string `binding:"Required"` + RuleID int64 EnablePush string WhitelistUsers string WhitelistTeams string From c3d9a70d0a4fc77fe4c44028e72d1a9aadee3e5a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 20 Feb 2023 21:08:41 +0800 Subject: [PATCH 05/65] only trigger docs build and publish when docs changed (#22968) Since drone plugin https://github.com/meltwater/drone-convert-pathschanged/ enabled, we can filter event with path in drone. Building docs will now only be triggered when documentations changed. --------- Co-authored-by: Jason Song --- .drone.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7150629028..cf0caf7612 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -112,7 +115,6 @@ steps: image: golang:1.19 # this step is kept as the lowest version of golang that we support pull: always environment: - GO111MODULE: on GOPROXY: https://goproxy.io commands: - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag @@ -124,7 +126,6 @@ steps: - name: build-backend-arm64 image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: arm64 @@ -140,7 +141,6 @@ steps: - name: build-backend-windows image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: windows GOARCH: amd64 @@ -155,7 +155,6 @@ steps: - name: build-backend-386 image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: 386 @@ -183,6 +182,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -410,6 +412,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -517,6 +522,9 @@ depends_on: trigger: event: - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -696,6 +704,9 @@ trigger: - "release/*" event: - push + paths: + exclude: + - docs/** depends_on: - testing-amd64 @@ -947,6 +958,9 @@ trigger: - push - tag - pull_request + paths: + include: + - docs/** steps: - name: build-docs @@ -1241,6 +1255,9 @@ depends_on: trigger: ref: - "refs/pull/**" + paths: + exclude: + - docs/** steps: - name: dryrun From 36d1d5fb7871058e510e59b027d5ee32bba43f2b Mon Sep 17 00:00:00 2001 From: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Date: Mon, 20 Feb 2023 22:22:34 +0800 Subject: [PATCH 06/65] Fix panic when call api (/repos/{owner}/{repo}/pulls/{index}/files) (#22921) Close: #22910 --- I'm confused about that why does the api (`GET /repos/{owner}/{repo}/pulls/{index}/files`) require caller to pass the parameters `limit` and `page`. In my case, the caller only needs to pass a `skip-to` to paging. This is consistent with the api `GET /{owner}/{repo}/pulls/{index}/files` So, I deleted the code related to `listOptions` --------- Co-authored-by: Lunny Xiao --- routers/api/v1/repo/pull.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 7005725cf6..fa8b517ae7 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -1420,8 +1420,9 @@ func GetPullRequestFiles(ctx *context.APIContext) { startCommitID := prInfo.MergeBase endCommitID := headCommitID - maxLines, maxFiles := setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffFiles + maxLines := setting.Git.MaxGitDiffLines + // FIXME: If there are too many files in the repo, may cause some unpredictable issues. diff, err := gitdiff.GetDiff(baseGitRepo, &gitdiff.DiffOptions{ BeforeCommitID: startCommitID, @@ -1429,7 +1430,7 @@ func GetPullRequestFiles(ctx *context.APIContext) { SkipTo: ctx.FormString("skip-to"), MaxLines: maxLines, MaxLineCharacters: setting.Git.MaxGitDiffLineCharacters, - MaxFiles: maxFiles, + MaxFiles: -1, // GetDiff() will return all files WhitespaceBehavior: gitdiff.GetWhitespaceFlag(ctx.FormString("whitespace")), }) if err != nil { @@ -1452,6 +1453,7 @@ func GetPullRequestFiles(ctx *context.APIContext) { if lenFiles < 0 { lenFiles = 0 } + apiFiles := make([]*api.ChangedFile, 0, lenFiles) for i := start; i < end; i++ { apiFiles = append(apiFiles, convert.ToChangedFile(diff.Files[i], pr.HeadRepo, endCommitID)) From 018815215fa08b530108f551ab58c1f1b3657799 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 23:52:21 +0800 Subject: [PATCH 07/65] Bump golang.org/x/net from 0.4.0 to 0.7.0 (#22980) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.4.0 to 0.7.0.
Commits
  • 8e2b117 http2/hpack: avoid quadratic complexity in hpack decoding
  • 547e7ed http2: avoid referencing ResponseWrite.Write parameter after returning
  • 39940ad html: parse comments per HTML spec
  • 87ce33e go.mod: update golang.org/x dependencies
  • 415cb6d all: fix some comments
  • 7e3c19c all: correct typos in comments
  • 296f09a http2: case insensitive handling for 100-continue
  • f8411da nettest: fix tests on dragonfly and js/wasm
  • 8e0e7d8 go.mod: update golang.org/x dependencies
  • 7805fdc http2: rewrite inbound flow control tracking
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/net&package-manager=go_modules&previous-version=0.4.0&new-version=0.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: techknowlogick Co-authored-by: delvh Co-authored-by: Lunny Xiao --- go.mod | 6 +++--- go.sum | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 3dc050b99a..343a70da25 100644 --- a/go.mod +++ b/go.mod @@ -103,10 +103,10 @@ require ( github.com/yuin/goldmark-highlighting/v2 v2.0.0-20220924101305-151362477c87 github.com/yuin/goldmark-meta v1.1.0 golang.org/x/crypto v0.4.0 - golang.org/x/net v0.4.0 + golang.org/x/net v0.7.0 golang.org/x/oauth2 v0.3.0 - golang.org/x/sys v0.3.0 - golang.org/x/text v0.5.0 + golang.org/x/sys v0.5.0 + golang.org/x/text v0.7.0 golang.org/x/tools v0.1.12 google.golang.org/grpc v1.47.0 google.golang.org/protobuf v1.28.1 diff --git a/go.sum b/go.sum index 03c2cc18c6..7eb420b02b 100644 --- a/go.sum +++ b/go.sum @@ -1463,8 +1463,8 @@ golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1609,14 +1609,15 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1627,8 +1628,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 9aaf6998b735ad091202513c52b1d40076dd6afe Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 20 Feb 2023 17:08:32 +0100 Subject: [PATCH 08/65] Fix pull request branch selector visible without clicking Edit (#23012) Caused by #22950 --- templates/repo/issue/view_title.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index b43253f90b..f0ac1e021e 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -61,7 +61,7 @@ {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} {{end}} - +
+ {{if $.IsOrganizationOwner}}
{{$.locale.Tr "admin.users.2fa"}}
@@ -51,6 +52,7 @@ {{end}}
+ {{end}}
{{end}}
From 97aacc3ea1ea89d5781da4b86a11f8340148ca49 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Tue, 21 Feb 2023 08:14:02 +0800 Subject: [PATCH 15/65] Improve pull_request_template.md (#22888) Update `pull_request_template.md` because: - It's a kind idea to hide the tips. However, it's easier to include them in the commit message by mistake when you cannot see them. Check `git log | grep 'Please check the following:'`. So don't hide it, expose it and help fix it. - "for backports" is much clearer than "for bug fixes". I saw someone post a PR to a release branch because they believed it was the right way for a bugfix. - "Allow edits by maintainers", or we have to ask the contributor to update the branch and they could be confused. - Remind the contributor that the words could be included in the commit message, to avoid some words like "Hello", "Sorry". If they really need them, they can separate them with a line, like: ```markdown Close #xxxx Because ... Then ... Finally ... --- Hello, this is my first time opening a pull request. Sorry for any mistakes. ``` And the merger should be careful, check and delete the extra content before merging. --------- Co-authored-by: techknowlogick --- .github/pull_request_template.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3a12bb8f72..b752abb794 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,9 @@ - Please check the following: - -1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes. -2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md -3. Describe what your pull request does and which issue you're targeting (if any) - ---> +1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for backports. +2. Make sure you have read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md . +3. Describe what your pull request does and which issue you're targeting (if any). +4. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily. +5. Your input here will be included in the commit message when this PR has been merged. If you don't want some content to be included, please separate them with a line like `---`. +6. Delete all these tips before posting. + From 35d2fa744aae5782dcced573aa08ee9ff62c8e36 Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 21 Feb 2023 00:15:49 +0000 Subject: [PATCH 16/65] Fix intermittent panic in notify issue change content (#23019) Ensure that issue pullrequests are loaded before trying to set the self-reference. Signed-off-by: Andrew Thornton Co-authored-by: delvh Co-authored-by: techknowlogick --- models/issues/issue.go | 14 ++++++++------ services/webhook/notifier.go | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index 6c76909fcf..c59e9d14e5 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -251,13 +251,15 @@ func (issue *Issue) LoadPoster(ctx context.Context) (err error) { // LoadPullRequest loads pull request info func (issue *Issue) LoadPullRequest(ctx context.Context) (err error) { - if issue.IsPull && issue.PullRequest == nil { - issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID) - if err != nil { - if IsErrPullRequestNotExist(err) { - return err + if issue.IsPull { + if issue.PullRequest == nil { + issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID) + if err != nil { + if IsErrPullRequestNotExist(err) { + return err + } + return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err) } - return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err) } issue.PullRequest.Issue = issue } diff --git a/services/webhook/notifier.go b/services/webhook/notifier.go index ba6d968dbd..b023717cd2 100644 --- a/services/webhook/notifier.go +++ b/services/webhook/notifier.go @@ -150,7 +150,6 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(ctx context.Context, doer *u log.Error("LoadPullRequest failed: %v", err) return } - issue.PullRequest.Issue = issue apiPullRequest := &api.PullRequestPayload{ Index: issue.Index, PullRequest: convert.ToAPIPullRequest(ctx, issue.PullRequest, nil), @@ -196,7 +195,6 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(ctx context.Context, doer *user log.Error("LoadPullRequest failed: %v", err) return } - issue.PullRequest.Issue = issue err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueEdited, Index: issue.Index, @@ -328,7 +326,10 @@ func (m *webhookNotifier) NotifyIssueChangeContent(ctx context.Context, doer *us mode, _ := access_model.AccessLevel(ctx, issue.Poster, issue.Repo) var err error if issue.IsPull { - issue.PullRequest.Issue = issue + if err := issue.LoadPullRequest(ctx); err != nil { + log.Error("LoadPullRequest: %v", err) + return + } err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueEdited, Index: issue.Index, From 1b950b98cf98c5064bafbd57cd6cde1fa029881b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 21 Feb 2023 08:16:56 +0800 Subject: [PATCH 17/65] Use `gt-relative` class instead of the ambiguous `gt-pr` class (#23008) `.gt-relative` is also `position: relative !important;` There are `gt-pr-?` styles below (line 140) for `padding-right`, which makes `.gt-pr` ambiguous Co-authored-by: delvh Co-authored-by: John Olheiser Co-authored-by: techknowlogick --- templates/repo/commit_page.tmpl | 2 +- web_src/less/helpers.less | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 0ecbf29161..028fdc7e51 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -17,7 +17,7 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} -
+

{{RenderCommitMessage $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses "root" $}}

{{if not $.PageIsWiki}} diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less index 9cabe01626..baa5959946 100644 --- a/web_src/less/helpers.less +++ b/web_src/less/helpers.less @@ -2,7 +2,6 @@ .gt-di { display: inline !important; } .gt-dif { display: inline-flex !important; } .gt-dib { display: inline-block !important; } -.gt-pr { position: relative !important; } .gt-ac { align-items: center !important; } .gt-tc { text-align: center !important; } .gt-tl { text-align: left !important; } From 34ae184622ba1eee62d73f13db709bc6b646795f Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 21 Feb 2023 10:22:13 +0800 Subject: [PATCH 18/65] Render access log template as text instead of HTML (#23013) Fix https://github.com/go-gitea/gitea/pull/22906#discussion_r1112106675 --- modules/context/access_log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/context/access_log.go b/modules/context/access_log.go index 84663ee8d3..1aaba9dc2d 100644 --- a/modules/context/access_log.go +++ b/modules/context/access_log.go @@ -6,8 +6,8 @@ package context import ( "bytes" "context" - "html/template" "net/http" + "text/template" "time" "code.gitea.io/gitea/modules/log" From 4fcf3a3f90ddced158cb31fbb5c1b534c824fc8c Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 21 Feb 2023 11:56:13 +0900 Subject: [PATCH 19/65] Add me to maintainers (#23026) Add me to maintainers. [My PRs list](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Ayp05327+is%3Amerged+) --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index b1adf9ef0d..fcd235e52a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -48,3 +48,4 @@ Xinyu Zhou (@xin-u) Jason Song (@wolfogre) Yarden Shoham (@yardenshoham) Yu Tian (@Zettat123) +Eddie Yang <576951401@qq.com> (@yp05327) From e3cffa70f9f731436ab005e4bb10f57166ffc6d5 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 21 Feb 2023 13:03:44 +0800 Subject: [PATCH 20/65] add margin top to the top of branches (#23002) add margin top as mentioned in #22973 --------- Co-authored-by: jidi Co-authored-by: Lunny Xiao --- templates/repo/branch/list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index cfa81a0f5b..a093c19deb 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -5,7 +5,7 @@ {{template "base/alert" .}} {{template "repo/sub_menu" .}} {{if .DefaultBranchBranch}} -

+

{{.locale.Tr "repo.default_branch"}}

From dc9cebdf45d3594058727a5c8a5f20af098c5e7a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 21 Feb 2023 14:12:57 +0800 Subject: [PATCH 21/65] Use `--message=%s` for git commit message (#23028) Close #23027 `git commit` message option _only_ supports 4 formats (well, only ....): * `"commit", "-m", msg` * `"commit", "-m{msg}"` (no space) * `"commit", "--message", msg` * `"commit", "--message={msg}"` The long format with `=` is the best choice, and it's documented in `man git-commit`: `-m , --message= ...` ps: I would suggest always use long format option for git command, as much as possible. Co-authored-by: Lunny Xiao --- modules/git/commit.go | 2 +- modules/repository/init.go | 5 ++--- services/pull/merge.go | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/git/commit.go b/modules/git/commit.go index 1f6289ed02..4a55645d30 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -131,7 +131,7 @@ func CommitChangesWithArgs(repoPath string, args TrustedCmdArgs, opts CommitChan if opts.Author != nil { cmd.AddOptionFormat("--author='%s <%s>'", opts.Author.Name, opts.Author.Email) } - cmd.AddOptionValues("-m", opts.Message) + cmd.AddOptionFormat("--message=%s", opts.Message) _, _, err := cmd.RunStdString(&RunOpts{Dir: repoPath}) // No stderr but exit status 1 means nothing to commit. diff --git a/modules/repository/init.go b/modules/repository/init.go index 5705fe5b99..771b68a491 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -316,9 +316,8 @@ func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Reposi return fmt.Errorf("git add --all: %w", err) } - cmd := git.NewCommand(ctx, "commit"). - AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email). - AddOptionValues("-m", "Initial commit") + cmd := git.NewCommand(ctx, "commit", "--message=Initial commit"). + AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email) sign, keyID, signer, _ := asymkey_service.SignInitialCommit(ctx, tmpPath, u) if sign { diff --git a/services/pull/merge.go b/services/pull/merge.go index 3ac67d91b7..ad428427cc 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -533,7 +533,7 @@ func rawMerge(ctx context.Context, pr *issues_model.PullRequest, doer *user_mode if err := git.NewCommand(ctx, "commit"). AddArguments(signArgs...). AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email). - AddOptionValues("-m", message). + AddOptionFormat("--message=%s", message). Run(&git.RunOpts{ Env: env, Dir: tmpBasePath, @@ -641,7 +641,7 @@ func rawMerge(ctx context.Context, pr *issues_model.PullRequest, doer *user_mode func commitAndSignNoAuthor(ctx context.Context, pr *issues_model.PullRequest, message string, signArgs git.TrustedCmdArgs, tmpBasePath string, env []string) error { var outbuf, errbuf strings.Builder - if err := git.NewCommand(ctx, "commit").AddArguments(signArgs...).AddOptionValues("-m", message). + if err := git.NewCommand(ctx, "commit").AddArguments(signArgs...).AddOptionFormat("--message=%s", message). Run(&git.RunOpts{ Env: env, Dir: tmpBasePath, From e7be610d5773e69abbfb98d19e23112dfad6dfcc Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 21 Feb 2023 14:13:37 +0800 Subject: [PATCH 22/65] Improve frontend guidelines (#23007) Some were out-dated, some are added. --- .../developers/guidelines-frontend.en-us.md | 18 +++++++--- web_src/js/features/aria.md | 33 +++++++++++++++++-- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/docs/content/doc/developers/guidelines-frontend.en-us.md b/docs/content/doc/developers/guidelines-frontend.en-us.md index 23be6c6773..7f4d87d901 100644 --- a/docs/content/doc/developers/guidelines-frontend.en-us.md +++ b/docs/content/doc/developers/guidelines-frontend.en-us.md @@ -39,12 +39,20 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h ### Gitea specific guidelines: 1. Every feature (Fomantic-UI/jQuery module) should be put in separate files/directories. -2. HTML ids and classes should use kebab-case. +2. HTML ids and classes should use kebab-case, it's preferred to contain 2-3 feature related keywords. 3. HTML ids and classes used in JavaScript should be unique for the whole project, and should contain 2-3 feature related keywords. We recommend to use the `js-` prefix for classes that are only used in JavaScript. -4. jQuery events across different features could use their own namespaces if there are potential conflicts. -5. CSS styling for classes provided by frameworks should not be overwritten. Always use new class-names with 2-3 feature related keywords to overwrite framework styles. -6. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}` -7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3. +4. CSS styling for classes provided by frameworks should not be overwritten. Always use new class names with 2-3 feature related keywords to overwrite framework styles. Gitea's helper CSS classes in `helpers.less` could be helpful. +5. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`, but do not expose whole models to the frontend to avoid leaking sensitive data. +6. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3. +7. Clarify variable types, prefer `elem.disabled = true` instead of `elem.setAttribute('disabled', 'anything')`, prefer `$el.prop('checked', var === 'yes')` instead of `$el.prop('checked', var)`. +8. Use semantic elements, prefer ` -
- -
- -
{{end}} {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}} diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 2e10ce2531..bc960c1e70 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -36,6 +36,10 @@
+
+ +
+