aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-03-12Sync the class change of Edit Column Button to JS code (#23400)giteayp05327
In #22767, we changed the class of `Edit Column` button from `red` to `primary` But `red` is used to find this button in js..... --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
2023-03-12Preserve file size when creating attachments (#23406)Peter
When creating attachments (issue, release, repo) the file size (being part of the multipart file header) is passed through the chain of creating an attachment to ensure the MinIO client can stream the file directly instead of having to read it to memory completely at first. Fixes #23393 Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-12[skip ci] Updated translations via CrowdinGiteaBot
2023-03-11Use buildkit for docker builds (#23415)techknowlogick
This switches Docker builds to use build kit which is less prone to error than legacy docker-in-docker building. It also switches back to using the upstream docker image again now that it has been updated to a version that supports alpine 3.14+ Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-03-11Refactor branch/tag selector dropdown (first step) (#23394)wxiaoguang
Follow: * #23345 The branch/tag selector dropdown mixes jQuery/Fomantic UI/Vue together, it's very diffcult to maintain and causes unfixable a11y problems. It also causes problems like #19851 #21314 #21952 This PR is the first step for the refactoring, move `data-` attributes to JS object and use Vue data as much as possible. The old selector `'.choose.reference .dropdown'` was also wrong, it hits `<div class="choose reference"><svg class="dropdown icon">` and would cause undefined behaviors. I have done some quick tests and it works. After this PR gets merged, I will move the code into a Vue SFC in next PR. ![image](https://user-images.githubusercontent.com/2114189/224099638-378a8a86-0865-47d1-bcba-f972506374c7.png) ![image](https://user-images.githubusercontent.com/2114189/224099690-70276cf5-b1e4-404a-b0c6-582448abf40e.png) --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-11[skip ci] Updated translations via CrowdinGiteaBot
2023-03-10Hide target selector if tag exists when creating new release (#23171)Zettat123
Close #22649. |status|screenshot| |-|-| |empty tag name|<img src="https://user-images.githubusercontent.com/15528715/221490165-fd3abd2e-6dc5-4562-bece-d1d6a305479e.png" width="300px"/>| |new tag|<img src="https://user-images.githubusercontent.com/15528715/221490450-49b2a48e-b206-49f4-bd79-34b1ea64156f.png" width="300px"/>| |existing tag|<img src="https://user-images.githubusercontent.com/15528715/221490301-4d1879dd-4947-4abc-9b9a-e77be1806981.png" width="300px"/>|
2023-03-10Parse external request id from request headers, and print it in access log ↵sillyguodong
(#22906) Close: #22890. --- ### Configure in .ini file: ```ini [log] REQUEST_ID_HEADERS = X-Request-ID, X-Trace-Id ``` ### Params in Request Header ``` X-Trace-ID: trace-id-1q2w3e4r ``` ![image](https://user-images.githubusercontent.com/33891828/218665296-8fd19a0f-ada6-4236-8bdb-f99201c703e8.png) ### Log output: ![image](https://user-images.githubusercontent.com/33891828/218665225-cc242a57-4ffc-449a-a1f6-f45ded0ead60.png)
2023-03-10Add missing tabs to org projects page (#22705)yp05327
Fixes https://github.com/go-gitea/gitea/issues/22676 Context Data `IsOrganizationMember` and `IsOrganizationOwner` is used to control the visibility of `people` and `team` tab. https://github.com/go-gitea/gitea/blob/2871ea08096cba15546f357d0ec473734ee9d8be/templates/org/menu.tmpl#L19-L40 And because of the reuse of user projects page, User Context is changed to Organization Context. But the value of `IsOrganizationMember` and `IsOrganizationOwner` are not being given. I reused func `HandleOrgAssignment` to add them to the ctx, but may have some unnecessary variables, idk whether it is ok. I found there is a missing `PageIsViewProjects` at create project page.
2023-03-10Add user webhooks (#21563)KN4CK3R
Currently we can add webhooks for organizations but not for users. This PR adds the latter. You can access it from the current users settings. ![grafik](https://user-images.githubusercontent.com/1666336/197391408-15dfdc23-b476-4d0c-82f7-9bc9b065988f.png)
2023-03-10Handle OpenID discovery URL errors a little nicer when creating/editing ↵zeripath
sources (#23397) When there is an error creating a new openIDConnect authentication source try to handle the error a little better. Close #23283 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-10Split CI pipelines (#23385)John Olheiser
- This PR attempts to split our various DB tests into separate pipelines. - It splits up some of the extra feature-related tests rather than having most of them in the MySQL test. - It disables the race detector for some of the pipelines as well, as it can cause slower runs and is mostly redundant when the pipelines just swap DBs. - It builds without SQLite support for any of the non-SQLite pipelines. - It moves the e2e test to using SQLite rather than PG (partially because I moved the minio tests to PG and that mucked up the test config, and partially because it avoids another running service) - It splits up the `go mod download` task in the Makefile from the tool installation, as the tools are only needed in the compliance pipeline. (Arguably even some of the tools aren't needed there, but that could be a follow-up PR) - SQLite is now the only arm64 pipeline, moving PG back to amd64 which can leverage autoscaler Should resolve #22010 - one thing that wasn't changed here but is mentioned in that issue, unit tests are needed in the same pipeline as an integration test in order to form a complete coverage report (at least as far as I could tell), so for now it remains in a pipeline with a DB integration test. Please let me know if I've inadvertently changed something that was how it was on purpose. --- I will say sometimes it's hard to pin down the average time, as a pipeline could be waiting for a runner for X minutes and that brings the total up by X minutes as well, but overall this does seem to be faster on average. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-09Improve squash merge commit author and co-author with private emails (#22977)Brecht Van Lommel
When emails addresses are private, squash merges always use `@noreply.localhost` for the author of the squash commit. And the author is redundantly added as a co-author in the commit message. Also without private mails, the redundant co-author is possible when committing with a signature that's different than the user full name and primary email. Now try to find a commit by the same user in the list of commits, and prefer the signature from that over one constructed from the account settings.
2023-03-09Fix broken Chroma CSS styles (#23174)wxiaoguang
The CSS styles in Gitea themes are out-of-sync of Chroma's styles. This PR introduces a `chroma-style-diff.go` tool to compare the diff. The missing CSS styles have been added manually. They are left as empty to reduce arguments because there was no color for them before. And this PR fixes #22348, with just 2 lines changed: `.chroma .kt & .n`, these colors are taken from GitHub. It's good enough for #22348 ![image](https://user-images.githubusercontent.com/2114189/221551941-0d27d11d-e71e-498f-8e88-92b558fe4a18.png) --------- Co-authored-by: silverwind <me@silverwind.io>
2023-03-09Add gradle samples in maven doc of packages (#23374)InsanusMokrassar
Samples for gitea.io docs to help to use maven packages with gradle-oriented projects --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-03-09Fix and move "Use this template" button (#23398)silverwind
Before: <img width="1157" alt="Screenshot 2023-03-09 at 23 21 25" src="https://user-images.githubusercontent.com/115237/224174168-869966cc-fa59-4231-b449-23bd9db12862.png"> After: <img width="1145" alt="Screenshot 2023-03-09 at 23 24 34" src="https://user-images.githubusercontent.com/115237/224174173-7f5b9c22-44c4-4eed-990c-da49d749eb0e.png"> --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-10[skip ci] Updated translations via CrowdinGiteaBot
2023-03-09Add init file for Ubuntu (#23362)Lycolia Rizzim
Created an init file for Ubuntu that will be useful when running it on WSL.
2023-03-09Rename `canWriteUnit` to `canWriteProjects` (#23386)yp05327
A part of https://github.com/go-gitea/gitea/pull/22865
2023-03-09Fix pull request update showing too many commits with multiple branches (#22856)Brecht Van Lommel
When the base repository contains multiple branches with the same commits as the base branch, pull requests can show a long list of commits already in the base branch as having been added. What this is supposed to do is exclude commits already in the base branch. But the mechansim to do so assumed a commit only exists in a single branch. Now use `git rev-list A B --not branchName` instead of filtering commits afterwards. The logic to detect if there was a force push also was wrong for multiple branches. If the old commit existed in any branch in the base repository it would assume there was no force push. Instead check if the old commit is an ancestor of the new commit.
2023-03-09Fix incorrect NotFound conditions in org/projects.go (#23384)yp05327
A part of https://github.com/go-gitea/gitea/pull/22865 user/org project's `RepoID` is always 0, we need to check `OwnerID`
2023-03-09Refactor merge/update git command calls (#23366)wxiaoguang
Follow #22568 * Remove unnecessary ToTrustedCmdArgs calls * the FAQ in #22678 * Quote: When using ToTrustedCmdArgs, the code will be very complex (see the changes for examples). Then developers and reviewers can know that something might be unreasonable. * The `signArg` couldn't be empty, it's either `-S{keyID}` or `--no-gpg-sign`. * Use `signKeyID` instead, add comment "empty for no-sign, non-empty to sign" * 5-line code could be extracted to a common `NewGitCommandCommit()` to handle the `signKeyID`, but I think it's not a must, current code is clear enough.
2023-03-09Redirect to project again after editing it (#23326)yp05327
A part of https://github.com/go-gitea/gitea/pull/22865 We have edit buttons in projects list page and project view page. But after user edit a project, it will always redirect to the projects list page.
2023-03-09Add Gitea Community Code of Conduct (#23188)Jason Song
The Gitea Community Code of Conduct. Authored by lunny. Slightly modified from [Go CoC](https://go.dev/conduct) --- CC all TOCs: @go-gitea/technical-oversight-committee And we welcome suggestions from everyone. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Nick <nick@kousu.ca> Co-authored-by: Lauris BH <lauris@nix.lv>
2023-03-09Test renderReadmeFile (#23185)Nick
Add test coverage to the important features of [`routers.web.repo.renderReadmeFile`](https://github.com/go-gitea/gitea/blob/067b0c2664d127c552ccdfd264257caca4907a77/routers/web/repo/view.go#L273); namely that: - it can handle looking in docs/, .gitea/, and .github/ - it can handle choosing between multiple competing READMEs - it prefers the localized README to the markdown README to the plaintext README - it can handle broken symlinks when processing all the options - it uses the name of the symlink, not the name of the target of the symlink
2023-03-09[skip ci] Updated translations via CrowdinGiteaBot
2023-03-08Set `X-Gitea-Debug` header once (#23361)Yarden Shoham
Instead of adding it # Before On the raw commit page: ![image](https://user-images.githubusercontent.com/20454870/223470744-cdf11898-e023-4198-8c8b-c294e5d78b73.png) # After ![image](https://user-images.githubusercontent.com/20454870/223470596-af898d66-bd5b-4ddb-b220-ceb1f149bfec.png) Fixes #23308 --------- Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-03-08Improve cache context (#23330)Jason Song
Related to: #22294 #23186 #23054 Replace: #23218 Some discussion is in the comments of #23218. Highlights: - Add Expiration for cache context. If a cache context has been used for more than 10s, the cache data will be ignored, and warning logs will be printed. - Add `discard` field to `cacheContext`, a `cacheContext` with `discard` true will drop all cached data and won't store any new one. - Introduce `WithNoCacheContext`, if one wants to run long-life tasks, but the parent context is a cache context, `WithNoCacheContext(perentCtx)` will discard the cache data, so it will be safe to keep the context for a long time. - It will be fine to treat an original context as a cache context, like `GetContextData(context.Backgraud())`, no warning logs will be printed. Some cases about nesting: When: - *A*, *B* or *C* means a cache context. - ~*A*~, ~*B*~ or ~*C*~ means a discard cache context. - `ctx` means `context.Backgrand()` - *A(ctx)* means a cache context with `ctx` as the parent context. - *B(A(ctx))* means a cache context with `A(ctx)` as the parent context. - `With` means `WithCacheContext` - `WithNo` means `WithNoCacheContext` So: - `With(ctx)` -> *A(ctx)* - `With(With(ctx))` -> *A(ctx)*, not *B(A(ctx))* - `With(With(With(ctx)))` -> *A(ctx)*, not *C(B(A(ctx)))* - `WithNo(ctx)` -> *ctx*, not *~A~(ctx)* - `WithNo(With(ctx))` -> *~A~(ctx)* - `WithNo(WithNo(With(ctx)))` -> *~A~(ctx)*, not *~B~(~A~(ctx))* - `With(WithNo(With(ctx)))` -> *B(~A~(ctx))* - `WithNo(With(WithNo(With(ctx))))` -> *~B~(~A~(ctx))* - `With(WithNo(With(WithNo(With(ctx)))))` -> *C(~B~(~A~(ctx)))*
2023-03-08add user visibility in dashboard navbar (#22747)yp05327
Add private/limited tag to dashboard user/org list dropdown menu ![image](https://user-images.githubusercontent.com/18380374/216752207-5beb5281-1b0b-4e2b-adfc-b39c192c5032.png) Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-08Fix panic when getting notes by ref (#23372)Zettat123
Fix #23357 . Now the `/repos/{owner}/{repo}/git/notes/{sha}` API supports getting notes by a ref or sha (https://try.gitea.io/api/swagger#/repository/repoGetNote). But the `GetNote` func can only accept commit ID. https://github.com/go-gitea/gitea/blob/a12f5757372f751d25f9e5ca1f168f6920ded894/modules/git/notes_nogogit.go#L18 So we need to convert the query parameter to commit ID before calling `GetNote`.
2023-03-08Use CleanPath instead of path.Clean (#23371)Lunny Xiao
As title.
2023-03-08Reduce duplicate and useless code in options (#23369)Jason Song
Avoid maintaining two copies of code, some functions can be used with both `bindata` and `no bindata`. And removed `GetRepoInitFile`, it's useless now. `Readme`/`Gitignore`/`License`/`Labels` will clean the name and use custom files when available.
2023-03-08Clean Path in Options (#23006)JakobDev
At the Moment it is possible to read files in another Directory as supposed using the Options functions. e.g. `options.Gitignore("../label/Default) `. This was discovered while working on #22783, which exposes `options.Gitignore()` through the public API. At the moment, this is not a security problem, as this function is only used internal, but I thought it would be a good idea to make a PR to fix this for all types of Options files, not only Gitignore, to make it safe for the further. This PR should be merged before the linked PR. --------- Co-authored-by: Jason Song <i@wolfogre.com>
2023-03-07Do not recognize text files as audio (#23355)wxiaoguang
Close #17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-08Fix incorrect display for comment context menu (#23343)wxiaoguang
Replace #23342 Fix a regression of #23014: the `a` couldn't be used here because Fomantic UI has style conflicts: `.ui.comments .comment .actions a { display: inline-block; }` And complete one more of my TODOs: "in the future there could be a special CSS class for it"
2023-03-08[skip ci] Updated translations via CrowdinGiteaBot
2023-03-07Pass context to avatar for projects view (#23359)delvh
Previously, a 500 response was returned when - an issue had assignees - the issue was assigned to a project - you tried to view this project Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-07Refactor and tidy-up the merge/update branch code (#22568)zeripath
The merge and update branch code was previously a little tangled and had some very long functions. The functions were not very clear in their reasoning and there were deficiencies in their logging and at least one bug in the handling of LFS for update by rebase. This PR substantially refactors this code and splits things out to into separate functions. It also attempts to tidy up the calls by wrapping things in "context"s. There are also attempts to improve logging when there are errors. Signed-off-by: Andrew Thornton <art27@cantab.net> --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: delvh <dev.lh@web.de>
2023-03-07Fix adding of empty class name (#23352)Hester Gong
This PR is to fix the error shown below. The reason is because [`class-name` prop](https://github.com/go-gitea/gitea/blob/main/web_src/js/components/ActionRunStatus.vue#L6) given to `svg` component has a space, and classList cannot add empty string. https://user-images.githubusercontent.com/17645053/223346720-c7f9de43-5e69-4ecf-93c0-90bf04090693.mov --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-07Fix various ImageDiff/SVG bugs (#23312)wxiaoguang
Replace #23310, Close #19733 And fix various UI problems, including regressions from #22959 #22950 and more. ## SVG Detection The old regexp may mismatch non-SVG files. This PR adds new tests for those cases. ## UI Changes ### Before ![image](https://user-images.githubusercontent.com/2114189/222967716-f6ad8721-f46a-4a3f-9eb0-a89e488d3436.png) ![image](https://user-images.githubusercontent.com/2114189/222967780-8af8981a-e69d-4304-9dc4-0235582fa4f4.png) ### After ![image](https://user-images.githubusercontent.com/2114189/222967575-c21c23d4-0200-4e09-aac3-57895e853000.png) ![image](https://user-images.githubusercontent.com/2114189/222967585-8b8da262-bc96-441a-9851-8d3845f2659d.png) ![image](https://user-images.githubusercontent.com/2114189/222967595-58d9bea5-6df4-41fa-bf8a-86704117959d.png) ![image](https://user-images.githubusercontent.com/2114189/222967608-38757c1a-b8bd-4ebf-b7a8-3b30edb7f303.png) ![image](https://user-images.githubusercontent.com/2114189/222967623-9849a339-6fae-4484-8fa5-939e2fdacbf5.png) ![image](https://user-images.githubusercontent.com/2114189/222967633-4383d7dd-62ba-47a3-8c10-86f7ca7757ae.png) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-07Refactor `setting.Database.UseXXX` to methods (#23354)Jason Song
Replace #23350. Refactor `setting.Database.UseMySQL` to `setting.Database.Type.IsMySQL()`. To avoid mismatching between `Type` and `UseXXX`. This refactor can fix the bug mentioned in #23350, so it should be backported.
2023-03-07Update documentation for the new YAML label file format (#23020)JonRB
update documentation to include an overview of the yaml label template that is part of PR #22976 Signed-off-by: Jon Roadley-Battin <jon.roadleybattin@gmail.com> --------- Co-authored-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
2023-03-06Remove unnecessary space on link (#23334)Lunny Xiao
The action run title has a blank. This PR removes it.
2023-03-06Fix incorrect redirect link of delete org project (#23327)yp05327
A part of https://github.com/go-gitea/gitea/pull/22865/commits The old code will cause 500 error.
2023-03-06Fix incorrect project links and use symlink icon for org-wide projects (#23325)yp05327
Fix displaying same projects icons between user/repo projects. And fix incorrect projects links. A part of https://github.com/go-gitea/gitea/pull/22865. ![image](https://user-images.githubusercontent.com/18380374/223044279-7b620ff1-d88a-4146-97e6-531bbf269761.png) ![image](https://user-images.githubusercontent.com/18380374/223044390-42911e3f-1f6b-439f-8441-4f3ebf99ea13.png) ![image](https://user-images.githubusercontent.com/18380374/223044437-5cad5391-0f95-4c8b-b0a3-32e263e2854f.png)
2023-03-06Fix PR view misalignment caused by long name file (#23321)Hester Gong
Close #23248 The UI after this PR: https://user-images.githubusercontent.com/17645053/223009758-7f0c9f12-d346-4cb2-a605-729fddce732f.mov
2023-03-06Add ActionRunStatus component (#23259)yp05327
Related to: https://github.com/go-gitea/gitea/pull/23212#discussion_r1122856231 Decrease duplication of SvgIcon when display a run status svg. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-06Scoped labels: don't require holding alt key to remove (#23303)Brecht Van Lommel
Alt doesn't work on all browsers, the simplest solution for v1.19 is to just not require it and toggle the label by just clicking. Part of #22974 Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-06Update hacking-on-gitea-zh_cn documentation (#23315)Lunny Xiao
This PR fix outdated hacking-on-gitea-zh_cn documentation. --------- Co-authored-by: Jason Song <i@wolfogre.com>
2023-03-06Fix broken code editor diff preview (#23307)wxiaoguang
Close #23265, the code editor diff preview has been broken for long time. * Fix the regression for `data-line-num` * `.code-diff` is necessary to show the line number * Fix the regression for #12434 * The diff: [12434](https://github.com/go-gitea/gitea/pull/12434/files?diff=unified&w=1) * It hides the Type(4) (aka HunkHeader) for unexpected cases. Diff with ignoring whitespaces: https://github.com/go-gitea/gitea/pull/23307/files?diff=unified&w=1 Before: see the issue #23265 After: ![image](https://user-images.githubusercontent.com/2114189/222942810-286dc9af-0b39-4e9d-8585-8c299b881241.png)