aboutsummaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Move fork router functions to a standalone file (#29756)Lunny Xiao2024-03-132-214/+238
| | | To reduce the pull.go file's size.
* Refactor to use optional.Option for issue index search option (#29739)65432024-03-133-38/+38
| | | Signed-off-by: 6543 <6543@obermui.de>
* Fix user router possbile panic (#29751)Lunny Xiao2024-03-131-2/+5
| | | regression from #28023
* Refactor label.IsArchived() (#29750)65432024-03-131-7/+5
| | | just some missed nits
* Use Get but not Post to get actions artifacts (#29734)Lunny Xiao2024-03-121-1/+1
|
* Do some performance optimize for issues list and view issue/pull (#29515)Lunny Xiao2024-03-123-31/+20
| | | | | | | | | | | | | | This PR do some performance optimzations. - [x] Add `index` for the column `comment_id` of `Attachment` table to accelerate query from the database. - [x] Remove unnecessary database queries when viewing issues. Before some conditions which id = 0 will be sent to the database - [x] Remove duplicated load posters - [x] Batch loading attachements, isread of comments on viewing issue --------- Co-authored-by: Zettat123 <zettat123@gmail.com>
* Some performance optimization on dashboard and issues page (#29010)Lunny Xiao2024-03-121-1/+5
| | | | | | | | | This PR do some loading speed optimization for feeds user interface pages. - Load action users batchly but not one by one. - Load action repositories batchly but not one by one. - Load action's Repo Owners batchly but not one by one. - Load action's possible issues batchly but not one by one. - Load action's possible comments batchly but not one by one.
* remove repetitive words (#29695)pengqiseven2024-03-112-2/+2
| | | Signed-off-by: pengqiseven <912170095@qq.com>
* Sync branches first (#29714)Jason Song2024-03-111-13/+13
| | | | | Follow #29493. Sync branches to DB first, then trigger push events.
* Add a warning for disallowed email domains (#29658)Zettat1232024-03-112-0/+17
| | | | | | | | | | | | | Resolve #29660 Follow #29522 and #29609 Add a warning for disallowed email domains when admins manually add/edit users. Thanks @yp05327 for the [comment](https://github.com/go-gitea/gitea/pull/29605#issuecomment-1980105119) ![image](https://github.com/go-gitea/gitea/assets/15528715/6737b221-a3a2-4180-9ef8-b846c10f96e0)
* Use repo object format name instead of detecting from git repository (#29702)Lunny Xiao2024-03-102-12/+2
| | | | It's unnecessary to detect the repository object format from git repository. Just use the repository's object format name.
* Patch in exact search for meilisearch (#29671)65432024-03-093-6/+6
| | | | | | | | | | | | | | | | | | | meilisearch does not have an search option to contorl fuzzynes per query right now: - https://github.com/meilisearch/meilisearch/issues/1192 - https://github.com/orgs/meilisearch/discussions/377 - https://github.com/meilisearch/meilisearch/discussions/1096 so we have to create a workaround by post-filter the search result in gitea until this is addressed. For future works I added an option in backend only atm, to enable fuzzynes for issue indexer too. And also refactored the code so the fuzzy option is equal in logic to code indexer --- *Sponsored by Kithara Software GmbH*
* Move get/set default branch from git package to gitrepo package to hide ↵Lunny Xiao2024-03-083-4/+5
| | | | repopath (#29126)
* Make runs-on support variable expression (#29468)sillyguodong2024-03-081-68/+12
| | | | | | | | As title. Close issue: https://gitea.com/gitea/act_runner/issues/445 Follow: https://gitea.com/gitea/act/pulls/91 Move `getSecretsOfTask` and `getVariablesOfTask` under `models` because of circular dependency issues.
* Fix 500 when deleting account with incorrect password or unsupported login ↵Lunny Xiao2024-03-081-2/+17
| | | | | | | | | type (#29579) Fix #26210 --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Update various logos and unify their filenames (#29637)silverwind2024-03-061-1/+1
| | | | | | | | 1. Checked all logos, updated 3 of them to newer versions. 2. Remove `open-with-` infix on the editor logos to be consistent with other files. <img width="626" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/3b2d9486-6e0a-45c6-b0e4-d38dc4c0b118">
* Cache repository default branch commit status to reduce query on commit ↵Lunny Xiao2024-03-062-22/+10
| | | | | | | | | | | | | status table (#29444) After repository commit status has been introduced on dashaboard, the most top SQL comes from `GetLatestCommitStatusForPairs`. This PR adds a cache for the repository's default branch's latest combined commit status. When a new commit status updated, the cache will be marked as invalid. <img width="998" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/76759de7-3a83-4d54-8571-278f5422aed3">
* Detect broken git hooks (#29494)Jason Song2024-03-061-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | Detect broken git hooks by checking if the commit id of branches in DB is the same with the git repo. It can help #29338 #28277 and maybe more issues. Users could complain about actions, webhooks, and activities not working, but they were not aware that it is caused by broken git hooks unless they could see a warning. <img width="1348" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/2b92a46d-7f1d-4115-bef4-9f970bd695da"> It should be merged after #29493. Otherwise, users could see a ephemeral warning after committing and opening the repo home page immediately. And it also waits for #29495, since the doc link (the anchor part) will be updated. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Sync branches to DB immediately when handle git hook calling (#29493)Jason Song2024-03-061-1/+65
| | | | | | | | | | | Unlike other async processing in the queue, we should sync branches to the DB immediately when handling git hook calling. If it fails, users can see the error message in the output of the git command. It can avoid potential inconsistency issues, and help #29494. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make wiki default branch name changable (#29603)wxiaoguang2024-03-063-25/+72
| | | | | | | | | Fix #29000 Fix #28685 Fix #18568 Related: #27497 And by the way fix #24036, add a Cancel button there (one line)
* Fix 500 error when adding PR comment (#29622)wxiaoguang2024-03-061-0/+6
|
* Skip email domain check when admins edit user emails (#29609)Zettat1232024-03-052-2/+2
| | | | | | Follow #29522 Administrators should be able to set a user's email address even if the email address is not in `EMAIL_DOMAIN_ALLOWLIST`
* Skip email domain check when admin users adds user manually (#29522)Zettat1232024-03-052-2/+2
| | | | | | Fix #27457 Administrators should be able to manually create any user even if the user's email address is not in `EMAIL_DOMAIN_ALLOWLIST`.
* Make "/user/login" page redirect if the current user has signed in (#29583)wxiaoguang2024-03-053-11/+64
| | | | Fix #29582 and maybe more. Maybe fix #29116
* Add missing database transaction for new issue (#29490)Lunny Xiao2024-03-042-14/+10
| | | | When creating an issue, inserting issue, assign users and set project should be in the same transaction.
* Move some asymkey functions to service layer (#28894)Lunny Xiao2024-03-042-3/+3
| | | | After the moving, all models will not depend on `util.Rename` so that I can do next step refactoring.
* Add user blocking (#29028)KN4CK3R2024-03-0430-92/+724
| | | | | | | | | | | | | | | | | | | | | | Fixes #17453 This PR adds the abbility to block a user from a personal account or organization to restrict how the blocked user can interact with the blocker. The docs explain what's the consequence of blocking a user. Screenshots: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/4ed884f3-e06a-4862-afd3-3b8aa2488dc6) ![grafik](https://github.com/go-gitea/gitea/assets/1666336/ae6d4981-f252-4f50-a429-04f0f9f1cdf1) ![grafik](https://github.com/go-gitea/gitea/assets/1666336/ca153599-5b0f-4b4a-90fe-18bdfd6f0b6b) --------- Co-authored-by: Lauris BH <lauris@nix.lv>
* Allow options to disable user ssh keys configuration from the interface on ↵Lunny Xiao2024-03-042-0/+27
| | | | | | | | | | | app.ini (#29447) Follow #29275 Extract from #20549 Fix #24716 --------- Co-authored-by: delvh <dev.lh@web.de>
* Enable/disable owner and repo projects independently (#28805)Denys Konovalov2024-03-045-52/+87
| | | | | | | | | | | | | | | Part of #23318 Add menu in repo settings to allow for repo admin to decide not just if projects are enabled or disabled per repo, but also which kind of projects (repo-level/owner-level) are enabled. If repo projects disabled, don't show the projects tab. ![grafik](https://github.com/go-gitea/gitea/assets/47871822/b9b43fb4-824b-47f9-b8e2-12004313647c) --------- Co-authored-by: delvh <dev.lh@web.de>
* Add an trailing slash to dashboard links (#29555)wxiaoguang2024-03-041-0/+17
| | | Fix #29533, and add some tests for "base/paginate.tmpl"
* Fix 500 when pushing release to an empty repo (#29554)Nanguan Lin2024-03-031-0/+5
| | | | | | As title. The former code directly used `ctx.Repo.GitRepo`, causing 500. https://github.com/go-gitea/gitea/blob/22b4f0c09f1de5e581929bd10f39833d30d2c482/routers/api/v1/repo/release.go#L241
* Filter Repositories by type (#29231)Tim-Niclas Oelschläger2024-03-034-0/+90
| | | | | | | | | | | | | Filter Repositories by type (resolves #1170, #1318) before: ![image](https://github.com/go-gitea/gitea/assets/72873130/74e6be62-9010-4ab4-8f9b-bd8afbebb8fb) after: ![image](https://github.com/go-gitea/gitea/assets/72873130/e4d85ed6-7864-4150-8d72-5194dac1293f)
* Fix incorrect cookie path for AppSubURL (#29534)wxiaoguang2024-03-031-0/+1
| | | Regression of #24107
* Add option to set language in admin user view (#28449)65432024-03-021-0/+1
| | | | | | | | | | | ![image](https://github.com/go-gitea/gitea/assets/24977596/be7e3f92-af3f-4628-b4ed-abf6439687f3) `/admin/users/<UserID>/edit` ![image](https://github.com/go-gitea/gitea/assets/24977596/906af0dd-cceb-4ed9-9cd9-32c71ae1bf71) `/admin/users/<UserID>` --- *Sponsored by Kithara Software GmbH*
* Fix elipsis button not working if the last commit loading is deferred (#29544)Yarden Shoham2024-03-021-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, if we had more than 200 entries being deferred in loading, the entire table would get replaced thus losing any event listeners attached to the elements within the table, such as the elipsis button and commit list with tippy. With this change we remove the previous javascript code that replaced the table and use htmx to replace the table. htmx attributes added: - `hx-indicator="tr.notready td.message span"`: attach the loading spinner to the files whose last commit is still being loaded - `hx-trigger="load"` trigger the request-replace behavior as soon as possible - `hx-swap="morph"`: use the idiomorph morphing algorithm, this is the thing that makes it so the elipsis button event listener is kept during the replacement, fixing the bug because we don't actually replace the table, only modifying it - `hx-post="{{.LastCommitLoaderURL}}"`: make a post request to this url to get the table with all of the commit information As part of this change I removed the handling of partial replacement in the case we have less than 200 "not ready" files. The first reason is that I couldn't make htmx replace only a subset of returned elements, the second reason is that we have a cache implemented in the backend already so the only cost added is that we query the cache a few times (which is sure to be populated due to the initial request), and the last reason is that since the last refactor of this functionality that removed jQuery we don't properly send the "not ready" entries as the backend expects `FormData` with `f[]` and we send a JSON with `f` so we always query for all rows anyway. # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/482ebfec-66c5-40cc-9c1e-e3b3bfe1bbc1) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/454c517e-3a4e-4006-a49f-99cc56e0fd60) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix incorrect relative/absolute URL usages (#29531)wxiaoguang2024-03-022-2/+3
| | | | Add two "HTMLURL" methods for PackageDescriptor. And rename "FullWebLink" to "VersionWebLink"
* Add support for API blob upload of release attachments (#29507)KN4CK3R2024-03-021-10/+29
| | | | | | | | | | | | Fixes #29502 Our endpoint is not Github compatible. https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset --------- Co-authored-by: Giteabot <teabot@gitea.io>
* remove util.OptionalBool and related functions (#29513)65432024-03-0231-143/+145
| | | | | | and migrate affected code _last refactoring bits to replace **util.OptionalBool** with **optional.Option[bool]**_
* Make PR form use toast to show error message (#29545)wxiaoguang2024-03-024-20/+20
| | | ![image](https://github.com/go-gitea/gitea/assets/2114189/b7a14ed6-db89-4f21-a590-66cd33307233)
* Fix a bug returning 404 when display a single tag with no release (#29466)Lunny Xiao2024-03-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Partially caused by #29149 When use ```go releases, err := getReleaseInfos(ctx, &repo_model.FindReleasesOptions{ ListOptions: db.ListOptions{Page: 1, PageSize: 1}, RepoID: ctx.Repo.Repository.ID, TagNames: []string{ctx.Params("*")}, // only show draft releases for users who can write, read-only users shouldn't see draft releases. IncludeDrafts: writeAccess, }) ``` replace ```go release, err := repo_model.GetRelease(ctx, ctx.Repo.Repository.ID, ctx.Params("*")) ``` It missed `IncludeTags: true,`. That means this bug will be occupied only when the release is a tag. This PR will fix - Get the right tag record when it's not a release - Display correct tag tab but not release tag when it's a tag. - The button will bring the tag name to the new page when it's a single tag page - the new page will automatically hide the release target inputbox when the tag name is pre filled. This should be backport to v1.21.
* Fix incorrect redirection when creating a PR fails (#29537)wxiaoguang2024-03-021-1/+1
| | | | | | | | | | | This is only a quick fix to make it easier to backport. After this PR gets merged, I will propose a new PR to fix the FIXME. <details> ![image](https://github.com/go-gitea/gitea/assets/2114189/98d1d5c4-2e79-4a75-80e9-76fd898986e0) </details>
* Actions Artifacts v4 backend (#28965)ChristopherHX2024-03-027-23/+1751
| | | | | | | | | | Fixes #28853 Needs both https://gitea.com/gitea/act_runner/pulls/473 and https://gitea.com/gitea/act_runner/pulls/471 on the runner side and patched `actions/upload-artifact@v4` / `actions/download-artifact@v4`, like `christopherhx/gitea-upload-artifact@v4` and `christopherhx/gitea-download-artifact@v4`, to not return errors due to GHES not beeing supported yet.
* Allow options to disable user gpg keys configuration from the interface on ↵Lunny Xiao2024-03-022-0/+21
| | | | | | | | app.ini (#29486) Follow #29447 Fix #29454 Extract from #20549
* Fix issue & comment history bugs (#29525)wxiaoguang2024-03-011-1/+5
| | | | | | * Follow #17746: `HasIssueContentHistory` should use expr builder to make sure zero value (0) be respected. * Add "doer" check to make sure `canSoftDeleteContentHistory` only be called by sign-in users.
* Use a predictiable fork URL to allow forking repositories without providing ↵wxiaoguang2024-03-012-5/+3
| | | | | | | | | | a repo ID (#29519) Close #29512 The "fork" URL: * Before: `/repo/fork/{RepoID}` * After: `/{OwnerName}/{RepoName}/fork`
* Rename Str2html to SanitizeHTML and clarify its behavior (#29516)wxiaoguang2024-03-013-5/+5
| | | | | Str2html was abused a lot. So use a proper name for it: SanitizeHTML And add some tests to show its behavior.
* Add admin API route for managing user's badges (#23106)techknowlogick2024-03-013-0/+133
| | | | | | | Fix #22785 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor some Str2html code (#29397)wxiaoguang2024-03-015-13/+20
| | | | | | | | | | | | | | | This PR touches the most interesting part of the "template refactoring". 1. Unclear variable type. Especially for "web/feed/convert.go": sometimes it uses text, sometimes it uses HTML. 2. Assign text content to "RenderedContent" field, for example: ` project.RenderedContent = project.Description` in web/org/projects.go 3. Assign rendered content to text field, for example: `r.Note = rendered content` in web/repo/release.go 4. (possible) Incorrectly calling `{{Str2html .PackageDescriptor.Metadata.ReleaseNotes}}` in package/content/nuget.tmpl, I guess the name Str2html misleads developers to use it to "render string to html", but it only sanitizes. if ReleaseNotes really contains HTML, then this is not a problem.
* Move migration functions to services layer (#29497)Lunny Xiao2024-03-011-2/+1
|
* migrate some more "OptionalBool" to "Option[bool]" (#29479)65432024-02-2913-48/+53
| | | | | | | | just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]** --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>