Commit graph

19827 commits

Author SHA1 Message Date
Earl Warren
e9ee514c9a
chore(dependency): renovate is used for managing updates
Remove https://github.com/silverwind/updates as a dependency
2024-06-03 07:21:19 +02:00
Renovate Bot
87b4a169ca Update ghcr.io/visualon/renovate Docker tag to v37.385.0 2024-06-02 22:06:00 +00:00
Earl Warren
0bf83db41b Merge pull request 'Update dependency @github/text-expander-element to v2.7.1' (#3939) from renovate/github-text-expander-element-2.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3939
Reviewed-by: Otto <otto@codeberg.org>
2024-06-02 21:36:31 +00:00
Earl Warren
bbdba70db6 Merge pull request 'fix(hook): repo admins are wrongly denied the right to force merge' (#3976) from earl-warren/forgejo:wip-admin-protection into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3976
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-02 19:48:44 +00:00
Earl Warren
09f3518069
fix(hook): repo admins are wrongly denied the right to force merge
The right to force merge is uses the wrong predicate and
applies to instance admins:

  ctx.user.IsAdmin

It must apply to repository admins and use the following predicate:

 ctx.userPerm.IsAdmin()

This regression is from the ApplyToAdmins implementation in
79b7089360.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3780
2024-06-02 21:16:46 +02:00
Lunny Xiao
62448bfb93
Fix push multiple branches error with tests (#31151)
(cherry picked from commit 5c1b550e00e9460078e00c41a32d206b260ef482)

Conflicts:
	tests/integration/git_push_test.go
	trivial context conflict because of
	2ac3dcbd43 test: hook post-receive for sha256 repos
2024-06-02 20:39:42 +02:00
Earl Warren
b1c16a673d Merge pull request 'Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.59.0' (#3971) from renovate/github.com-golangci-golangci-lint-cmd-golangci-lint-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3971
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 16:24:19 +00:00
Earl Warren
36ae4ae70e Merge pull request 'add missed return in POST /repos/{owner}/{repo}/push_mirrors' (#3945) from earl-warren/forgejo:wip-missed-return into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3945
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-02 15:43:51 +00:00
Earl Warren
166bb2861f
tests(api): POST /repos/{owner}/{repo}/push_mirrors coverage 2024-06-02 16:31:41 +02:00
Earl Warren
5747951cc7
test(mock): DeletePushMirrors & AddPushMirrorRemote
make them into variables that can be mocked
2024-06-02 16:31:41 +02:00
Lunny Xiao
ba37b9e577
Add missed return after ctx.ServerError (#31130) (partial)
Only routers/api/v1/repo/mirror.go

(cherry picked from commit b6f15c7948ac3d09977350de83ec91d5789ea083)
2024-06-02 16:31:41 +02:00
Earl Warren
16e8dfe417 Merge pull request 'test(util): MockProtect when mocking multiple times' (#3959) from earl-warren/forgejo:wip-mock-protect into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3959
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-02 14:27:35 +00:00
Earl Warren
b4887fcd37
chore(deadcode): update 2024-06-02 16:26:54 +02:00
Lunny Xiao
f6e2b79dd8
Fix the possible migration failure on 286 with postgres 16 (#31209)
Try to fix #31205

(cherry picked from commit 98a61040b1c83790b0e0e977188842f967ae357e)
2024-06-02 16:26:54 +02:00
Max Wipfli
737c3e90eb
Only update poster in issue/comment list if it has been loaded (#31216)
Previously, all posters were updated, even if they were not part of
posterMaps. In that case, a ghost user was erroneously inserted.

Fixes #31213.

(cherry picked from commit 3cc7f763c3c22ae4c3b5331f8b72b7009c5b11ea)
2024-06-02 16:26:54 +02:00
Lunny Xiao
47a2102694
Performance improvements for pull request list API (#30490)
Fix #30483

---------

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 352a2cae247afa254241f113c5c22b9351f116b9)
2024-06-02 16:26:54 +02:00
Jason Song
3e5f85ccf3
Drop IDOrderDesc for listing Actions task and always order by id DESC (#31150)
Close #31066

Just follow what `FindRunOptions` and `FindScheduleOptions` do.

(cherry picked from commit 572fa55fbcc2cb9418b4f7b981a7c80a11899276)
2024-06-02 16:26:54 +02:00
Lunny Xiao
18eef3b23a
Fix branch order (#31174)
Fix #31172

The original order or the default order should not be ignored even if we
have an is_deleted order.

(cherry picked from commit 1137a0357eb1e35a046e86a7277594154d0f6c85)
2024-06-02 16:26:54 +02:00
Lunny Xiao
ee2247d77c
Add topics for repository API (#31127)
Fix ##31100

(cherry picked from commit de4616690f742aebc3e019fde5c73c432d543292)
2024-06-02 16:26:54 +02:00
Lunny Xiao
344bf48c9b
Add missed return after ctx.ServerError (#31130)
(cherry picked from commit b6f15c7948ac3d09977350de83ec91d5789ea083)
2024-06-02 16:26:54 +02:00
metiftikci
ca0921a95a
Prevent simultaneous editing of comments and issues (#31053)
fixes #22907

Tested:
- [x] issue content edit
- [x] issue content change tasklist
- [x] pull request content edit
- [x] pull request change tasklist

![issue-content-edit](https://github.com/go-gitea/gitea/assets/29250154/a0828889-fb96-4bc4-8600-da92e3205812)

(cherry picked from commit aa92b13164e84c26be91153b6022220ce0a27720)

Conflicts:
	models/issues/comment.go
	 c7a389f2b2 [FEAT] allow setting the update date on issues and comments

	options/locale/locale_en-US.ini
	 trivial context conflicts

	routers/api/v1/repo/issue_comment.go
	routers/api/v1/repo/issue_comment_attachment.go
	services/issue/comments.go
	services/issue/content.go
         user blocking is implemented differently in Forgejo

	routers/web/repo/issue.go
	 trivial difference from 6a0750177f Allow to save empty comment
         user blocking is implemented differently in Forgejo

	templates/repo/issue/view_content/conversation.tmpl
	 templates changed a lot in Forgejo but the change is
	 trivially ported

	tests/integration/issue_test.go
	 other tests were added in the same region

	web_src/js/features/repo-issue-edit.js
	 the code is still web_src/js/features/repo-legacy.js
	 trivially ported
2024-06-02 16:26:54 +02:00
Earl Warren
884b3c0f4b
test(util): MockProtect when mocking multiple times
It is fine to use MockVariableValue to change a setting such as:

defer test.MockVariableValue(&setting.Mirror.Enabled, true)()

But when testing for errors and mocking a function, multiple variants
of the functions will be used, not just one. MockProtect a function
will make sure that when the test fails it always restores a sane
version of the function. For instance:

defer test.MockProtect(&mirror_service.AddPushMirrorRemote)()

mirror_service.AddPushMirrorRemote = mockOne
do some tests that may fail

mirror_service.AddPushMirrorRemote = mockTwo
do more tests that may fail
2024-06-02 15:24:06 +02:00
0ko
c7f01c9bbd Refactor install page hints (#3961)
- rewrite a lot of hints on install page
- make sure checkboxes don't hide useful information behind hover
This is good for compactness but makes first-time installation more painful than it should be. BTW, this was inherited from Gogs.
- update related translation keys (will require Weblate sync to merge)
- make sure string locations in en-US.ini make sense. Unfortunately, makes viewing changes harder, but I've attached screenshots

## Preview

![](https://codeberg.org/attachments/b0d26013-5fd9-495c-b4c0-7919f9f6fbf4)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3961
Reviewed-by: Otto <otto@codeberg.org>
2024-06-02 13:06:56 +00:00
Codeberg Translate
ebabb96ce0 [I18N] Translations update from Weblate (#3908)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: wintryexit <weatherdowner@proton.me>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Atalanttore <Atalanttore@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: purkwiat <purkwiat@gmail.com>
Co-authored-by: KaKi87 <KaKi87@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: gitcookie-1 <gitcookie-1@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3908
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-06-02 12:01:06 +00:00
Rowan Bohde
73706ae26d
feat: add support for a credentials chain for minio access (#31051)
We wanted to be able to use the IAM role provided by the EC2 instance
metadata in order to access S3 via the Minio configuration. To do this,
a new credentials chain is added that will check the following locations
for credentials when an access key is not provided. In priority order,
they are:

1. MINIO_ prefixed environment variables
2. AWS_ prefixed environment variables
3. a minio credentials file
4. an aws credentials file
5. EC2 instance metadata

(cherry picked from commit c0880e7695346997c6a93f05cd01634cb3ad03ee)

Conflicts:
	docs/content/administration/config-cheat-sheet.en-us.md
	does not exist in Forgejo
2024-06-02 10:14:09 +02:00
Lunny Xiao
a7591f9738
Rename project board -> column to make the UI less confusing (#30170)
This PR split the `Board` into two parts. One is the struct has been
renamed to `Column` and the second we have a `Template Type`.

But to make it easier to review, this PR will not change the database
schemas, they are just renames. The database schema changes could be in
future PRs.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 98751108b11dc748cc99230ca0fc1acfdf2c8929)

Conflicts:
	docs/content/administration/config-cheat-sheet.en-us.md
	docs/content/index.en-us.md
	docs/content/installation/comparison.en-us.md
	docs/content/usage/permissions.en-us.md
	non existent files

	options/locale/locale_en-US.ini
	routers/web/web.go
	templates/repo/header.tmpl
	templates/repo/settings/options.tmpl
	trivial context conflicts
2024-06-02 09:42:39 +02:00
Zettat123
ec05ab1e3c
Improve the handling of jobs.<job_id>.if (#31070)
Fix #25897
Fix #30322

#29464 cannot handle some complex `if` conditions correctly because it
only checks `always()` literally. In fact, it's not easy to evaluate the
`if` condition on the Gitea side because evaluating it requires a series
of contexts. But act_runner is able to evaluate the `if` condition
before running the job (for more information, see
[`gitea/act`](517d11c671/pkg/runner/run_context.go (L739-L753)))
. So we can use act_runner to check the `if` condition.

In this PR, how to handle a blocked job depends on its `needs` and `if`:
- If not all jobs in `needs` completed successfully and the job's `if`
is empty, set the job status to `StatusSkipped`
- In other cases, the job status will be set to `StatusWaiting`, and
then act_runner will check the `if` condition and run the job if the
condition is met

(cherry picked from commit 31a0c4dfb4156a7b4d856cceae1e61c7fc1a4a1b)
2024-06-02 09:08:07 +02:00
Lunny Xiao
9e495f700e
Fix possible ui 500 if workflow's job is nil (#31092)
Fix #31087

(cherry picked from commit e695ba47557ed4c3999c63b28051a449ca4653de)
2024-06-02 09:04:43 +02:00
GiteaBot
9d4f0671f3
[skip ci] Updated licenses and gitignores
(cherry picked from commit e625813aa9f585718e9c7677fc441f1f3ad69c61)
2024-06-02 09:03:10 +02:00
Earl Warren
319af78171 Merge pull request 'Adding release note for #3337' (#3984) from Mai-Lapyst/forgejo:add-releasenote-3337 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3984
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 06:41:20 +00:00
Earl Warren
2c94bbf751 Merge pull request 'Add missing options & values to app.example.ini' (#3983) from Mai-Lapyst/forgejo:cleanup-app-example-ini into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3983
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 06:39:42 +00:00
Mai-Lapyst
56a6d3f77d
Adding release note for #3337 2024-06-02 06:04:53 +02:00
Mai-Lapyst
c3d60ed9f7
Cleanup & add missing options to app.example.ini 2024-06-02 03:32:36 +02:00
Earl Warren
05f0007437
fix(hook): instance admins wrongly restricted by permissions checks
This exception existed for both instance admins and repo admins
before ApplyToAdmins was introduced in
79b7089360.

It should have been kept for instance admins only because they are not
subject to permission checks.
2024-06-01 23:50:57 +02:00
Earl Warren
793421bf59
tests(integration): add TestPullMergeBranchProtect
Verify variations of branch protection that are in play when merging a
pull request as:

* instance admin
* repository admin / owner
* user with write permissions on the repository

In all cases the result is expected to be the same when merging
the pull request via:

* API
* web

Although the implementations are different.
2024-06-01 23:50:57 +02:00
Earl Warren
e0eba21ab7
test(integration): add protected file to doBranchProtect
A protected file pushed to a protected branch branch is not allowed.
2024-06-01 23:50:57 +02:00
Earl Warren
0d8478b82e
test(integration): refactor doBranchProtectPRMerge
* group test cases to clarify their purpose
* remove pull request branch protection tests, they are redundant
  with TestPullMergeBranchProtect
2024-06-01 23:50:57 +02:00
Earl Warren
20591d966e
test(integration): refactor testPullMerge
* split into testPullMergeForm which can be called directly if
  the caller wants to specify extra parameters.
* testPullMergeForm can expect something different than StatusOK
2024-06-01 23:50:57 +02:00
Earl Warren
49aea9879b
test(integration): refactor doAPIMergePullRequest
* http.StatusMethodNotAllowed can be expected: only retry if the
  error message is "Please try again later"
* split into doAPIMergePullRequestForm which can be called directly if
  the caller wants to specify extra parameters.
2024-06-01 23:50:57 +02:00
Earl Warren
70aa294cc1
test(integration): refactor doProtectBranch
explicitly specify the parameters instead of providing them as
arguments so the caller has a more fine grain control over them.
2024-06-01 23:50:57 +02:00
Earl Warren
4c2ed3c35d
test(integration): add t.Helper() to reduce stack polution
Without the a testify stack is likely to not show the relevant test.
2024-06-01 23:50:57 +02:00
0ko
1084362f7c CSS improvements around commit status icons (#3948)
- make sure margins are all consistent and good, elements are not too close or too apart
- this also applies to "Show commit body" button
- remove unused code. The class `commit-status-link` doesn't exist in templates, nor I could find it on any related pages in case it's generated in runtime

## Preview

![](/attachments/9cf6d73a-8132-4f30-8094-5687d7dd98e9)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3948
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-06-01 15:20:40 +00:00
Earl Warren
6d712590f1
chore(lint): make golangci-lint to v1.59.0 happy 2024-06-01 16:17:07 +02:00
Renovate Bot
288075c724 Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.59.0 2024-06-01 02:07:47 +00:00
Earl Warren
f887972348 Merge pull request 'forgejo-federated-star: UI to define following repos' (#3886) from meissa/forgejo:forgejo-federated-pr5 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3886
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 15:57:17 +00:00
Earl Warren
5e71e0fd4a Merge pull request 'chore(renovate): use sqlite package cache' (#3958) from viceice/renovate-sqlite into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3958
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 15:32:02 +00:00
Michael Jerger
8aade372cb add a release note 2024-05-31 16:28:26 +02:00
Earl Warren
3a469d72a0 Merge pull request 'Update module github.com/go-testfixtures/testfixtures/v3 to v3.11.0' (#3955) from renovate/github.com-go-testfixtures-testfixtures-v3-3.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3955
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 13:51:08 +00:00
Earl Warren
dd4a1aa0d4
chore(dependency): automerge go-testfixtures/testfixtures
Refs: https://codeberg.org/forgejo/forgejo/pulls/3955
2024-05-31 15:10:49 +02:00
Michael Kriese
629554f8a8
chore(renovate): use sqlite package cache 2024-05-31 13:54:12 +02:00