summaryrefslogtreecommitdiffstats
path: root/routers (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix PR creation via api between branches of same repo with head field ↵norohind2024-03-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | namespaced (#26986) Fix #20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --- Although GitHub implementation of API allows performing such action and since Gitea targeting compatibility with GitHub API I see it as an appropriate change. I'm proposing a fix to the described problem and test case which covers this logic. My use-case just in case: https://github.com/go-gitea/gitea/issues/20175#issuecomment-1711283022 (cherry picked from commit ed02d1fab85c9b8206c0af84dcfc3792e61609cf)
* Fix incorrect menu/link on webhook edit page (#29709)yp053272024-03-201-0/+1
| | | | | | | | | Fix #29699 --------- Co-authored-by: silverwind <me@silverwind.io> (cherry picked from commit 2da13675c0cfdc531044553636c3b74f2fda3eb4)
* Use relative links for commits, mentions, and issues in markdown (#29427)KN4CK3R2024-03-201-2/+4
| | | | | | | | | | | | | | Fixes #29404 Use relative links for - commits - mentions - issues --------- Co-authored-by: silverwind <me@silverwind.io> (cherry picked from commit 85c59d6c21e10ef9d3ccf11713548f50e47e920f)
* Refactor to use optional.Option for issue index search option (#29739)65432024-03-203-38/+38
| | | | | Signed-off-by: 6543 <6543@obermui.de> (cherry picked from commit 7fd0a5b276aadcf88dcc012fcd364fe160a58810)
* Use Get but not Post to get actions artifacts (#29734)Lunny Xiao2024-03-201-1/+1
| | | | | | | (cherry picked from commit 171d3d9a3c891d107001094b9118d93b0b00c02c) Conflicts: routers/web/web.go
* Some performance optimization on dashboard and issues page (#29010)Lunny Xiao2024-03-201-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. (cherry picked from commit aed3b53abdd02a3ffbf9e8eb90272ff567333073)
* remove repetitive words (#29695)pengqiseven2024-03-202-2/+2
| | | | | Signed-off-by: pengqiseven <912170095@qq.com> (cherry picked from commit 7f856d5d742dcb6febdb8a3f22cd9a8fecc69a4d)
* Add a warning for disallowed email domains (#29658)Zettat1232024-03-202-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) (cherry picked from commit 4129e0e79bbf30e4297efd33feb2602c40322d10)
* Use repo object format name instead of detecting from git repository (#29702)Lunny Xiao2024-03-202-12/+2
| | | | | | | | | | It's unnecessary to detect the repository object format from git repository. Just use the repository's object format name. (cherry picked from commit 3c6fc25a77c37d50686caa495d27a31dcef7f75f) Conflicts: services/pull/pull.go
* Merge pull request '[PORT] Refactor code_indexer to use an SearchOptions ↵Gusted2024-03-193-4/+33
|\ | | | | | | | | | | | | struct for PerformSearch (gitea#29724)' (#2686) from snematoda/port-29724 into forgejo Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2686 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
| * Refactor code_indexer to use an SearchOptions struct for PerformSearch (#29724)65432024-03-183-4/+33
| | | | | | | | | | | | | | | | | | | | similar to how it's already done for the issue_indexer --- *Sponsored by Kithara Software GmbH* Conflicts: routers/web/repo/search.go
* | Merge pull request '[Port] Sync branches to DB immediately when handle git ↵oliverpool2024-03-191-1/+63
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | hook calling gitea#29493' (#2684) from oliverpool/forgejo:sync_branch into forgejo Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2684 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org>
| * | Sync branches first (gitea#29714)Jason Song2024-03-181-13/+13
| | | | | | | | | | | | | | | | | | Follow gitea#29493. Sync branches to DB first, then trigger push events.
| * | use gitRepo.GetCommit directlyoliverpool2024-03-181-3/+1
| | | | | | | | | | | | and give it a commitID instead of a branchName (a bit more correct and faster)
| * | Sync branches to DB immediately when handle git hook calling (gitea#29493)Jason Song2024-03-181-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>
* | Fix #2512 /api/forgejo/v1/version auth check (#2582)Ada2024-03-193-133/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the same auth check and middlewares as the /v1/ API. It require to export some variable from /v1 API, i am not sure if is the correct way to do Co-authored-by: oliverpool <git@olivier.pfad.fr> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2582 Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Ada <ada@gnous.eu> Co-committed-by: Ada <ada@gnous.eu>
* | routers: Minor code cleanup in UsernameSubRouteGergely Nagy2024-03-181-1/+0
|/ | | | | | | | | The `reloadParam` function already calls `context.UserAssignmentWeb` with the same parameters, there's no need to do it again. Change cherry picked from gitea#29751. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
* fix #2501Shiny Nematoda2024-03-141-1/+1
|
* Makefile: check git diff exit-code (#2651)oliverpool2024-03-141-0/+1
| | | | | Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2651 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
* Patch in exact search for meilisearch (#29671)65432024-03-113-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* Conflicts: routers/web/repo/search.go trivial context confict s/isMatch/isFuzzy/
* Move get/set default branch from git package to gitrepo package to hide ↵Lunny Xiao2024-03-114-5/+8
| | | | | | | | | | | | | repopath (#29126) (cherry picked from commit 25b842df261452a29570ba89ffc3a4842d73f68c) Conflicts: routers/web/repo/wiki.go services/repository/branch.go services/repository/migrate.go services/wiki/wiki.go also apply to Forgejo specific usage of the refactored functions
* Make runs-on support variable expression (#29468)sillyguodong2024-03-111-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. (cherry picked from commit a1f5dd767729e30d07ab42fda80c19f30a72679f)
* Fix 500 when deleting account with incorrect password or unsupported login ↵Lunny Xiao2024-03-111-2/+17
| | | | | | | | | | | type (#29579) Fix #26210 --------- Co-authored-by: Jason Song <i@wolfogre.com> (cherry picked from commit ce8a98f8789a7e4e9ee97ab0abac6064d78fb1f6)
* Cache repository default branch commit status to reduce query on commit ↵Lunny Xiao2024-03-112-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"> (cherry picked from commit e308d25f1b2fe24b4735432b05e5e221879a2705)
* Detect broken git hooks (#29494)Jason Song2024-03-111-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> (cherry picked from commit a4bcfb8ef1d5b2b522f78c9560d53ddbdbb02218)
* Skip email domain check when admins edit user emails (#29609)Zettat1232024-03-112-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` (cherry picked from commit 136dd99e86eea9c8bfe61b972a12b395655171e8)
* Skip email domain check when admin users adds user manually (#29522)Zettat1232024-03-112-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`. (cherry picked from commit 4fd9c56ed09b31e2f6164a5f534a31c6624d0478)
* Make "/user/login" page redirect if the current user has signed in (#29583)wxiaoguang2024-03-113-11/+64
| | | | | | | Fix #29582 and maybe more. Maybe fix #29116 (cherry picked from commit df1268ca08aaacae54c775a8eec34006dfe365e0)
* Allow options to disable user ssh keys configuration from the interface on ↵Lunny Xiao2024-03-112-0/+27
| | | | | | | | | | | | | | | | | app.ini (#29447) Follow #29275 Extract from #20549 Fix #24716 --------- Co-authored-by: delvh <dev.lh@web.de> (cherry picked from commit 8e12ba34bab7e728ac93ccfaecbe91e053ef1c89) Conflicts: custom/conf/app.example.ini trivial context conflict
* Merge pull request 'Better number for UserCards pagination' (#2584) from ↵Gusted2024-03-111-4/+4
|\ | | | | | | | | | | | | | | 0ko/forgejo:its39 into forgejo Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2584 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
| * Better number for UserCards pagination0ko2024-03-071-4/+4
| |
* | Port "Fix wrong test usage of AppSubURL"KN4CK3R2024-03-061-9/+9
|/ | | | | | | - Port of https://github.com/go-gitea/gitea/pull/29459 - The tests use an invalid `setting.AppSubURL`. The wrong behaviour disturbs other PRs like https://github.com/go-gitea/gitea/pull/29222 and https://github.com/go-gitea/gitea/pull/29427.
* Add an trailing slash to dashboard links (#29555)wxiaoguang2024-03-061-0/+17
| | | | | | | | | | | Fix #29533, and add some tests for "base/paginate.tmpl" (cherry picked from commit 8553b4600e3035b6f6ad6907c37cebd013fa4d64) Conflicts: services/contexttest/context_tests.go trivial conflict because "Improve user experience for outdated comments" was skipped
* Fix 500 when pushing release to an empty repo (#29554)Nanguan Lin2024-03-061-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 (cherry picked from commit 6e2aafd5130cb9436f02209ae90bf79a58cc13ae)
* Filter Repositories by type (#29231)Tim-Niclas Oelschläger2024-03-064-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) (cherry picked from commit e3524c63d6d42865ea8288af89b372544d35474b)
* Fix incorrect cookie path for AppSubURL (#29534)wxiaoguang2024-03-061-0/+1
| | | | | | Regression of #24107 (cherry picked from commit 44398e405ffe297997c6b9c8dbb97f966926b65a)
* Add option to set language in admin user view (#28449)65432024-03-061-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* (cherry picked from commit e3e6569c5fd8c69aa65384e6d1636cc14b23a32b)
* Fix elipsis button not working if the last commit loading is deferred (#29544)Yarden Shoham2024-03-061-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> (cherry picked from commit 937e8b55149388840bbf6c4d7216495bc3dd2fe9)
* Fix incorrect relative/absolute URL usages (#29531)wxiaoguang2024-03-062-2/+3
| | | | | | | Add two "HTMLURL" methods for PackageDescriptor. And rename "FullWebLink" to "VersionWebLink" (cherry picked from commit bf6502a8f7a2e9a2b64b43b7733316d863c9a768)
* Add support for API blob upload of release attachments (#29507)KN4CK3R2024-03-061-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> (cherry picked from commit 70c126e6184872a6ac63cae2f327fc745b25d1d7)
* remove util.OptionalBool and related functions (#29513)65432024-03-0631-143/+145
| | | | | | | | | | | | | and migrate affected code _last refactoring bits to replace **util.OptionalBool** with **optional.Option[bool]**_ (cherry picked from commit a3f05d0d98408bb47333b19f505b21afcefa9e7c) Conflicts: services/repository/branch.go trivial context conflict
* Make PR form use toast to show error message (#29545)wxiaoguang2024-03-064-20/+20
| | | | | | ![image](https://github.com/go-gitea/gitea/assets/2114189/b7a14ed6-db89-4f21-a590-66cd33307233) (cherry picked from commit 27deea7330f83ddb37c918afbb4159053d8847cb)
* Fix incorrect redirection when creating a PR fails (#29537)wxiaoguang2024-03-061-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> (cherry picked from commit e650f64d812f5ebeb4a11d2ec20f2376c6d963bc)
* Actions Artifacts v4 backend (#28965)ChristopherHX2024-03-067-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. (cherry picked from commit a53d268aca87a281aadc2246541f8749eddcebed)
* Allow options to disable user gpg keys configuration from the interface on ↵Lunny Xiao2024-03-062-0/+21
| | | | | | | | | | | | | | | | app.ini (#29486) Follow #29447 Fix #29454 Extract from #20549 (cherry picked from commit 9de5e39e25009bacc5ca201ed97e9cbb623e56e9) Conflicts: custom/conf/app.example.ini docs/content/administration/config-cheat-sheet.en-us.md docs/content/administration/config-cheat-sheet.zh-cn.md trivial context conflict
* Rename Str2html to SanitizeHTML and clarify its behavior (#29516)wxiaoguang2024-03-063-5/+5
| | | | | | | | | | | | | Str2html was abused a lot. So use a proper name for it: SanitizeHTML And add some tests to show its behavior. (cherry picked from commit fb42972c057364a1dc99dfb528554e7a94415be7) Conflicts: docs/content/administration/mail-templates.en-us.md docs/content/administration/mail-templates.zh-cn.md prefer their version always
* Refactor some Str2html code (#29397)wxiaoguang2024-03-065-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. (cherry picked from commit e71eb8930a5d0f60874b038c223498b41ad65592) Conflicts: modules/templates/util_string.go trivial context conflict
* migrate some more "OptionalBool" to "Option[bool]" (#29479)65432024-03-0613-48/+53
| | | | | | | | | | | | | | just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]** --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me> (cherry picked from commit f6656181e4a07d6c415927220efa2077d509f7c6) Conflicts: models/repo/repo_list_test.go trivial shared fixture count conflicts
* Fix incorrect user location link on profile page (#29474)wxiaoguang2024-03-061-2/+3
| | | | | | Fix #29472. Regression of #29236, a "if" check was missing. (cherry picked from commit 10cfa0879a538a470598281d7093de3555c018be)
* Move generate from module to service (#29465)Lunny Xiao2024-03-062-2/+2
| | | | (cherry picked from commit b5188cd55c535a588492fb4e153d646ec4f3232a)