From 3602a1987db58da13ee2baa33bb0c36a60e27608 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:00:53 +0800 Subject: [PATCH 01/65] Add border to file tree 'sub-items' and add padding to 'item-file' (#27593) ## Add border to file tree 'sub-items' close #24766 view in `gitea-light` image view in `gitea-dark` image ## Change the 'item-file' padding Before that the 'item-file' only have padding when they in 'item-directory', which is too compact when 'item-file' after 'item-directory'
![)RW`SDJ_UQL@$}0 PL(3DS7](https://github.com/go-gitea/gitea/assets/70063547/5fa523a4-44c3-4cb9-a882-a3ea6d944673) --------- Co-authored-by: silverwind --- web_src/js/components/DiffFileTreeItem.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web_src/js/components/DiffFileTreeItem.vue b/web_src/js/components/DiffFileTreeItem.vue index 22c23f3ca0c..9d7ab4afc5d 100644 --- a/web_src/js/components/DiffFileTreeItem.vue +++ b/web_src/js/components/DiffFileTreeItem.vue @@ -61,11 +61,12 @@ a, a:hover { display: flex; flex-direction: column; gap: 1px; - padding-left: 8px; + margin-left: 13px; + border-left: 1px solid var(--color-secondary); } .sub-items .item-file { - padding-left: 24px; + padding-left: 18px; } .item-file.selected { From f39256f035a561fbd10955ac40ef5ad4b794f47d Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 25 Oct 2023 19:40:39 +0900 Subject: [PATCH 02/65] Add word-break to organization name and description (#26624) Fix #24318 Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/38282e5e-0b4d-4568-a853-59352798e826) ![image](https://github.com/go-gitea/gitea/assets/18380374/79d89ee6-61f6-45a7-af0b-d1c23fead25a) ![image](https://github.com/go-gitea/gitea/assets/18380374/39b45fae-52e2-4697-b83a-7cd10f76ac43) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/09e8cfcf-0150-494e-9f63-0868f529da65) ![image](https://github.com/go-gitea/gitea/assets/18380374/d2c348d3-fe03-466a-a5f4-878b7a93a318) ![image](https://github.com/go-gitea/gitea/assets/18380374/7f75b807-300c-42d5-b2c3-bae9e45e3c08) ![image](https://github.com/go-gitea/gitea/assets/18380374/06eca901-f5cf-4100-bb65-92457ad106e3) --- templates/org/header.tmpl | 2 +- templates/org/home.tmpl | 2 +- templates/shared/user/org_profile_avatar.tmpl | 2 +- web_src/css/base.css | 1 + web_src/css/org.css | 1 + web_src/css/repo.css | 1 + 6 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 72adf6d9b5a..7b912c1c569 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -2,7 +2,7 @@
-
+
{{ctx.AvatarUtils.Avatar . 100}} {{.DisplayName}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index ff4f3a8b1af..ee3237d45b0 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -3,7 +3,7 @@
{{ctx.AvatarUtils.Avatar .Org 140 "org-avatar"}}
-
+
{{.Org.DisplayName}} {{if .Org.Visibility.IsLimited}}{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}{{end}} diff --git a/templates/shared/user/org_profile_avatar.tmpl b/templates/shared/user/org_profile_avatar.tmpl index b9ade23d050..a8846b0abd6 100644 --- a/templates/shared/user/org_profile_avatar.tmpl +++ b/templates/shared/user/org_profile_avatar.tmpl @@ -2,7 +2,7 @@
-
+
{{ctx.AvatarUtils.Avatar . 100}} {{.DisplayName}} diff --git a/web_src/css/base.css b/web_src/css/base.css index 0cfd311158c..ae8eb057090 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1411,6 +1411,7 @@ img.ui.avatar, .ui.label { padding: 0.3em 0.5em; transition: none; + white-space: nowrap; } .ui.label, diff --git a/web_src/css/org.css b/web_src/css/org.css index 061d30bef2c..d2bf0ff6066 100644 --- a/web_src/css/org.css +++ b/web_src/css/org.css @@ -102,6 +102,7 @@ .organization.profile #org-info { overflow-wrap: anywhere; flex: 1; + word-break: break-all; } .organization.profile #org-info .ui.header { diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 7d76dd8b3ff..5b532aa495c 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -2606,6 +2606,7 @@ tbody.commit-list { justify-content: space-between; flex-wrap: wrap; word-break: break-word; + gap: 0.5rem; } @media (max-width: 767.98px) { From 31f8880bc252a25075f8752e2722b316c6e46ec7 Mon Sep 17 00:00:00 2001 From: Gerd Katzenbeisser Date: Wed, 25 Oct 2023 13:12:36 +0200 Subject: [PATCH 03/65] Show placeholder email in privacy popup (#27770) This PR will show the _noreply_ address in the privacy popup _keep_email_private_popup_. I had to look into the source code to figure out which E-Mail Adress I had to use on gitea.com to hide it from public access. According to the contribution guidelines I only updated the en-US translation file. Co-authored-by: Hakito --- options/locale/locale_en-US.ini | 2 +- templates/user/settings/profile.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b0c21816ae9..e3f2fcdd839 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -729,7 +729,7 @@ add_email_success = The new email address has been added. email_preference_set_success = Email preference has been set successfully. add_openid_success = The new OpenID address has been added. keep_email_private = Hide Email Address -keep_email_private_popup = This will hide your email address from your profile, as well as when you make a pull request or edit a file using the web interface. Pushed commits will not be modified. +keep_email_private_popup = This will hide your email address from your profile, as well as when you make a pull request or edit a file using the web interface. Pushed commits will not be modified. Use %s in commits to associate them with your account. openid_desc = OpenID lets you delegate authentication to an external provider. manage_ssh_keys = Manage SSH Keys diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index a508a5e835a..1f32aed0e88 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -73,7 +73,7 @@
- +
From 1eae2aadae0583ab092d6ed857bb727829aa52b7 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:51:49 +0800 Subject: [PATCH 04/65] Fix issue not showing on default board and add test (#27720) See https://github.com/go-gitea/gitea/pull/27718#issuecomment-1773743014 . Add a test to ensure its behavior. Why this test uses `ProjectBoardID=0`? Because in `SearchOptions`, `ProjectBoardID=0` means what it is. But in `IssueOptions`, `ProjectBoardID=0` means there is no condition, and `ProjectBoardID=db.NoConditionID` means the board ID = 0. It's really confusing. Probably it's better to separate the db search engine and the other issue search code. It's really two different systems. As far as I can see, `IssueOptions` is not necessary for most of the code, which has very simple issue search conditions. --- models/issues/issue_search.go | 2 +- modules/indexer/issues/indexer_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index 9b6bf117b1f..0bea1fed143 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -186,7 +186,7 @@ func applyProjectBoardCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.S if opts.ProjectBoardID > 0 { sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectBoardID})) } else if opts.ProjectBoardID == db.NoConditionID { - sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Neq{"project_board_id": 0})) + sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": 0})) } return sess } diff --git a/modules/indexer/issues/indexer_test.go b/modules/indexer/issues/indexer_test.go index 0ec23164c28..da4fc9b8789 100644 --- a/modules/indexer/issues/indexer_test.go +++ b/modules/indexer/issues/indexer_test.go @@ -382,6 +382,12 @@ func searchIssueInProject(t *testing.T) { }, []int64{1}, }, + { + SearchOptions{ + ProjectBoardID: int64Pointer(0), // issue with in default board + }, + []int64{2}, + }, } for _, test := range tests { issueIDs, _, err := SearchIssues(context.TODO(), &test.opts) From 7a286e47532a31ed6abcde3a45da4bad1653a42e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 25 Oct 2023 17:01:31 +0200 Subject: [PATCH 05/65] Improve pull request command line instructions (#27778) * Show checkout instructions also when there is no permission to push, for anyone who wants to locally test the changes. * First checkout the branch exactly as is, without immediately having to solve merge conflicts. Leave this to the merge step, since it's often convenient to test a change without worrying about this. * Use `git fetch -u`, so an existing local branch is updated when re-testing the same pull request. But not the more risky `git fetch -f` in to handle force pushes, as we don't want to accidentally overwrite important local changes. * Show different merge command depending on the chosen merge style, interactively updated. --- options/locale/locale_en-US.ini | 11 ++--- templates/repo/issue/view_content/pull.tmpl | 4 +- .../view_content/pull_merge_instruction.tmpl | 46 +++++++++++++++---- .../js/components/PullRequestMergeForm.vue | 4 ++ 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e3f2fcdd839..8dcce73b7d8 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -110,9 +110,6 @@ write = Write preview = Preview loading = Loading… -step1 = Step 1: -step2 = Step 2: - error = Error error404 = The page you are trying to reach either does not exist or you are not authorized to view it. go_back = Go Back @@ -1797,9 +1794,11 @@ pulls.outdated_with_base_branch = This branch is out-of-date with the base branc pulls.close = Close Pull Request pulls.closed_at = `closed this pull request %[2]s` pulls.reopened_at = `reopened this pull request %[2]s` -pulls.merge_instruction_hint = `You can also view command line instructions.` -pulls.merge_instruction_step1_desc = From your project repository, check out a new branch and test the changes. -pulls.merge_instruction_step2_desc = Merge the changes and update on Gitea. +pulls.cmd_instruction_hint = `View command line instructions.` +pulls.cmd_instruction_checkout_title = Checkout +pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes. +pulls.cmd_instruction_merge_title = Merge +pulls.cmd_instruction_merge_desc = Merge the changes and update on Gitea. pulls.clear_merge_message = Clear merge message pulls.clear_merge_message_hint = Clearing the merge message will only remove the commit message content and keep generated git trailers such as "Co-Authored-By …". diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index a4f7ede74d0..2fed5848d5b 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -372,8 +372,8 @@
{{end}} - {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} - {{template "repo/issue/view_content/pull_merge_instruction" .Issue.PullRequest}} + {{if and .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} + {{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions}} {{end}}
diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index b1b52645e05..3dab44710ea 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,19 +1,45 @@
-
{{ctx.Locale.Tr "repo.pulls.merge_instruction_hint" | Safe}}
+
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint" | Safe}}
-

{{ctx.Locale.Tr "step1"}}

{{ctx.Locale.Tr "repo.pulls.merge_instruction_step1_desc"}}
+

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}
+ {{$localBranch := .PullRequest.HeadBranch}} + {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} + {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} + {{end}}
- {{if eq .Flow 0}} -
git checkout -b {{if ne .HeadRepo.ID .BaseRepo.ID}}{{.HeadRepo.OwnerName}}-{{end}}{{.HeadBranch}} {{.BaseBranch}}
-
git pull {{if ne .HeadRepo.ID .BaseRepo.ID}}{{else}}origin{{end}} {{.HeadBranch}}
+ {{if eq .PullRequest.Flow 0}} +
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
+
git checkout {{$localBranch}}
{{else}} -
git fetch origin {{.GetGitRefName}}:{{.HeadBranch}}
+
git fetch -u origin {{.GetGitRefName}}:{{$localBranch}}
{{end}}
-

{{ctx.Locale.Tr "step2"}}

{{ctx.Locale.Tr "repo.pulls.merge_instruction_step2_desc"}}
+ {{if .ShowMergeInstructions}} +

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
-
git checkout {{.BaseBranch}}
-
git merge --no-ff {{if ne .HeadRepo.ID .BaseRepo.ID}}{{.HeadRepo.OwnerName}}-{{end}}{{.HeadBranch}}
-
git push origin {{.BaseBranch}}
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --no-ff {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --ff-only {{$localBranch}}
+
+
+
git checkout {{$localBranch}}
+
git rebase {{.PullRequest.BaseBranch}}
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --no-ff {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --squash {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge {{$localBranch}}
+
+
git push origin {{.PullRequest.BaseBranch}}
+ {{end}}
diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 03d1f99683b..54dcf9d8606 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -1,5 +1,6 @@