Commit graph

519 commits

Author SHA1 Message Date
Gusted 0f79122053
[BUG] Detect protected branch on branch rename
- If a branch cannot be renamed due to a protected branch rule, show
this error in the UI instead of throwing an internal server error.
- Add integration test (also simplify the existing one).
- Resolves #2751
2024-03-26 15:58:52 +01:00
Earl Warren 9397bfd276 Merge pull request 'Offer to remove WIP: prefix in sidebar' (#2660) from 0ko/forgejo:convert-to-normal into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2660
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-25 10:30:11 +00:00
Earl Warren 5a18b74632 Merge pull request '[TESTS] fail when log.Error is called' (#2657) from oliverpool/forgejo:fail_test_on_log_error into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2657
2024-03-24 07:28:31 +00:00
oliverpool 7b576d0a5d activitypub: warn instead of error 2024-03-24 07:12:31 +01:00
oliverpool 2536c2db89 fix webhook fixtures 2024-03-24 07:11:19 +01:00
oliverpool e43c6cd9df fail test when log.Error is called
except for some specific messages (to make the test pass for now)
2024-03-24 07:11:18 +01:00
Earl Warren 0bfd4ca532 Merge pull request 'Allow users to hide all "Add more units..." hints' (#2533) from algernon/forgejo:less-is-more into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2533
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-24 05:42:37 +00:00
oliverpool 33a3ee1955 [TESTS] webhook forms creation and edition 2024-03-23 23:02:06 +01:00
Gergely Nagy 87cd08539e
Update the TestRenderAlertBlocks integration test
The alert/callout blocks rendering has been changed in the previous few
commits, this adapts the test case that verifies them to the updated
output.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-03-23 15:38:43 +01:00
Gergely Nagy 6c330a85ec
Add tests for the "Open with" repository clone menu
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-03-23 11:58:54 +01:00
Gergely Nagy 3123725ff3
Revert "[GITEA] Configurable clone methods"
This reverts commit 1d8bca07f3.
2024-03-23 11:58:54 +01:00
0ko 60a9df1908
Add test for pull summary 2024-03-22 07:11:52 +01:00
0ko 8e1b6a4090 Add test for add/remove WIP link display 2024-03-21 19:33:02 +05:00
Gergely Nagy 36147f580c
Allow users to hide all "Add more units..." hints
Repositories displaying an "Add more..." tab on the header is a neat way
to let people discover they can enable more units. However, displaying
it all the time for repository owners, even when they deliberately do
not want to enable more units gets noisy very fast.

As such, this patch introduces a new setting which lets people disable
this hint under the appearance settings.

Fixes #2378.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-03-21 08:15:51 +01:00
Gergely Nagy 8433f3aa09
Fix repo badges when the label or text contains dashes
shields.io uses dashes to separate parts of the badge it needs to
return. If our label or text parts contain dashes, we need to encode
those for shields.io to recognise what we want it to do, and to have the
correct text on the badge, too.

Fortunately, this is as simple as replacing all dashes with double
dashes in both the label and the text parts. We do not need to do the
same for the color, because that part is not user controlled.

This fixes the badges for cases when a workflow name includes dashes, or
when a release's tag name does.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-03-20 22:41:20 +01:00
Earl Warren 84f33ead4e Merge pull request '[BUG] Reflect Cargo index state in settings' (#2698) from gusted/forgejo-cargo-index into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2698
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-20 11:38:26 +00:00
Earl Warren 468b879fe8 Merge pull request '[PORT] add skip ci support for pull request title (#29774)' (#2701) from earl-warren/forgejo:wip-gitea-skip-ci into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2701
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-03-20 11:34:49 +00:00
Gusted 461f925554
[BUG] Reflect Cargo index state in settings
- Currently in the Cargo section of the packages setting menu two
buttons are always shown, "Initalize index" and "Rebuild index", however
only of these should be shown depending on the state of the index, if
there's no index the "Initalize index" button should be shown and if
there's an index the "Rebuild index" button should be shown. This patch
does exactly that.
- Resolves #2628
2024-03-20 09:17:49 +01:00
norohind d74f74a025
Fix PR creation via api between branches of same repo with head field 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)
2024-03-20 08:46:30 +01:00
Yarden Shoham 24305e4d09
Remove the time-since class (#29826)
It serves no purpose.

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 3f1e4896b6d71dc061e23fa2dcac4c1b7d412540)
2024-03-20 08:46:30 +01:00
yp05327 2da0628f18
Fix incorrect menu/link on webhook edit page (#29709)
Fix #29699

---------

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 2da13675c0cfdc531044553636c3b74f2fda3eb4)
2024-03-20 08:46:29 +01:00
Zettat123 2559c80bec
Add a warning for disallowed email domains (#29658)
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)
2024-03-20 08:46:28 +01:00
Earl Warren 19d7ff9c9e
[TESTS] testPullCreate do not assume the default branch is master 2024-03-20 06:52:37 +01:00
Denys Konovalov d3d0c4cbe7
add skip ci support for pull request title (#29774)
Extends #28075 to support [skip ci] inside PR titles.

Close #29265

(cherry picked from commit 7a90e5954f8515329f20ff0e391130e1ee7b8864)

Conflicts:
	services/actions/notifier_helper.go
	tests/integration/actions_trigger_test.go
	conflicts easily resolved because of
	[TESTS] Convert more tests to CreateDeclarativeRepo
	[ACTIONS] skip superflous pull request synchronized event (#2314)
2024-03-20 06:07:50 +01:00
oliverpool ce6db31efe Merge pull request '[Port] Sync branches to DB immediately when handle git 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>
2024-03-19 08:37:30 +00:00
Earl Warren c16866d4a5 Merge pull request 'English fixes and improvements' (#2631) from 0ko/forgejo:english20240311 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2631
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-19 08:09:27 +00:00
Ada 41676a8634 Fix #2512 /api/forgejo/v1/version auth check (#2582)
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>
2024-03-19 07:16:19 +00:00
Jason Song 286d09203f Sync branches to DB immediately when handle git hook calling (gitea#29493)
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>
2024-03-18 17:38:01 +01:00
0ko 4c1af0d9a6 [I18N] Fix capitalization in English and reword a few strings
fixes #2551
2024-03-17 21:04:11 +05:00
oliverpool 98f1fe7944 Makefile: check git diff exit-code (#2651)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2651
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-14 10:38:58 +00:00
Gusted fbdda5d5b0 Merge pull request '[PORT] Test /user/settings/security auth sources' (#2641) from oliverpool/forgejo:security_test into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2641
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-13 21:57:14 +00:00
Earl Warren 226fa396df Merge pull request 'Accessibility: Taborder in repo explore' (#2636) from fnetx/explore-taborder into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2636
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-13 02:31:47 +00:00
oliverpool d49c116ce5 [PORT] Test /user/settings/security auth sources 2024-03-12 15:41:10 +01:00
Otto Richter 16a63a16b3 Playwright e2e test for taborder
This should be a failing test for Firefox (but working in Chrome?) for
the taborder in the explore page.

Tabbing through the page should ensure that certain elements are focused
at least once.
2024-03-12 02:23:29 +01:00
oliverpool 63973e2c70
add repo_settings_hook_test 2024-03-11 23:37:00 +07:00
wxiaoguang abb0294996
Partially enable MSSQL case-sensitive collation support (#29238)
Follow #28662

(cherry picked from commit 29a8c8de779924694fadad80b31cc855dd62c0f2)
2024-03-11 23:36:59 +07:00
Zettat123 e7afba21ce
Skip email domain check when admins edit user emails (#29609)
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)
2024-03-11 23:36:58 +07:00
Zettat123 b6057a34db
Skip email domain check when admin users adds user manually (#29522)
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)
2024-03-11 23:36:58 +07:00
Gusted 4dbf2d7c11 Merge pull request 'Better number for UserCards pagination' (#2584) from 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>
2024-03-11 15:53:59 +00:00
0ko b2bc233517 Test pagination of repo stars, watchers and forks
based on code suggested in https://codeberg.org/forgejo/forgejo/pulls/2584#issuecomment-1647897 and https://codeberg.org/forgejo/forgejo/pulls/2584#issuecomment-1655289

Co-authored-by: Gusted <gusted@noreply.codeberg.org>
2024-03-10 17:15:59 +05:00
0ko 8f8b608fd7 Add test to UI of archive/unarchive related actions 2024-03-09 13:29:23 +00:00
oliverpool ecfcbcb19f [BUG] prevent removing session cookie when redirect_uri query contains :// 2024-03-07 10:52:30 +01:00
Gusted b9e27b64e6 Merge pull request '[BUG] Disable CODEOWNERS for forked repositories' (#2537) from gusted/forgejo-codeowner-forked into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2537
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-06 18:18:58 +00:00
Gusted e793e28f94
[BUG] Remember topic only in repo search
- Ports b4360d504c
2024-03-06 13:22:39 +01:00
Earl Warren a39f69ac28
Revert "[BUG] Remember topic only in repo search"
This reverts commit b4360d504c.
2024-03-06 12:10:46 +08:00
KN4CK3R 47a913d40d
Add support for API blob upload of release attachments (#29507)
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)
2024-03-06 12:10:46 +08:00
ChristopherHX 66632c4958
Actions Artifacts v4 backend (#28965)
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)
2024-03-06 12:10:45 +08:00
wxiaoguang 459ee98136
Only use supported sort order for "explore/users" page (#29430)
Thanks to inferenceus : some sort orders on the "explore/users" page
could list users by their lastlogintime/updatetime.

It leaks user's activity unintentionally. This PR makes that page only
use "supported" sort orders.

Removing the "sort orders" could also be a good solution, while IMO at
the moment keeping the "create time" and "name" orders is also fine, in
case some users would like to find a target user in the search result,
the "sort order" might help.

![image](https://github.com/go-gitea/gitea/assets/2114189/ce5c39c1-1e86-484a-80c3-33cac6419af8)

(cherry picked from commit eedb8f41297c343d6073a7bab46e4df6ee297a90)
2024-03-06 12:10:43 +08:00
Lunny Xiao 894d9b2836
Move context from modules to services (#29440)
Since `modules/context` has to depend on `models` and many other
packages, it should be moved from `modules/context` to
`services/context` according to design principles. There is no logic
code change on this PR, only move packages.

- Move `code.gitea.io/gitea/modules/context` to
`code.gitea.io/gitea/services/context`
- Move `code.gitea.io/gitea/modules/contexttest` to
`code.gitea.io/gitea/services/contexttest` because of depending on
context
- Move `code.gitea.io/gitea/modules/upload` to
`code.gitea.io/gitea/services/context/upload` because of depending on
context

(cherry picked from commit 29f149bd9f517225a3c9f1ca3fb0a7b5325af696)

Conflicts:
	routers/api/packages/alpine/alpine.go
	routers/api/v1/repo/issue_reaction.go
	routers/install/install.go
	routers/web/admin/config.go
	routers/web/passkey.go
	routers/web/repo/search.go
	routers/web/repo/setting/default_branch.go
	routers/web/user/home.go
	routers/web/user/profile.go
	tests/integration/editor_test.go
	tests/integration/integration_test.go
	tests/integration/mirror_push_test.go
	trivial context conflicts
	also modified all other occurrences in Forgejo specific files
2024-03-06 12:10:43 +08:00
Earl Warren 21b1381e36 Merge pull request 'Move migration functions to services layer - port of gitea#29497' (#2546) from algernon/forgejo:gitea/port/29497 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2546
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-04 10:01:26 +00:00