Commit graph

19659 commits

Author SHA1 Message Date
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
Earl Warren a1ef8eaf29 Merge pull request 'Disable self-registration by default on the install page' (#3934) from algernon/forgejo:abandon-all-registration-all-ye-who-enter-here into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3934
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-31 11:49:20 +00:00
Earl Warren 05c55e53a8 Merge pull request 'Update linters' (#3921) from renovate/linters into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3921
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-05-31 10:39:01 +00:00
forgejo-renovate-action 494ef1a78a Merge pull request 'Update ghcr.io/visualon/renovate Docker tag to v37.382.4' (#3957) from renovate/ghcr.io-visualon-renovate-37.x into forgejo 2024-05-31 10:33:50 +00:00
Renovate Bot 1a6fb16166 Update ghcr.io/visualon/renovate Docker tag to v37.382.4 2024-05-31 09:09:22 +00:00
Renovate Bot 430183fa14 Update linters 2024-05-31 08:55:12 +00:00
Earl Warren dcc842dfeb Merge pull request 'chore(renovate): disallow eslint-plugin-no-use-extend-native v0.6.0+, requires eslint v9' (#3951) from viceice/forgejo:chore/renovate/update-config into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3951
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 08:36:38 +00:00
Michael Kriese 99789e2b9a
chore(renovate): disallow eslint-plugin-no-use-extend-native v0.6.0+, requires eslint v9 2024-05-31 09:00:52 +02:00
Gergely Nagy 6b24a7919d
Add a release note about the previous changes
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-31 08:21:55 +02:00
Earl Warren e48b23c2be Merge pull request 'Update dependency happy-dom to v14.12.0' (#3954) from renovate/happy-dom-14.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3954
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 05:56:24 +00:00
Earl Warren 3a8a8fb467 Merge pull request 'Update module github.com/alecthomas/chroma/v2 to v2.14.0 (take 2)' (#3952) from earl-warren/forgejo:wip-chroma into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3952
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-31 05:25:06 +00:00
forgejo-renovate-action d1c4586d6b Merge pull request 'Update dependency swagger-ui-dist to v5.17.13' (#3929) from renovate/swagger-ui-dist-5.17.x into forgejo 2024-05-31 04:34:46 +00:00
Renovate Bot 652c2840f9 Update dependency happy-dom to v14.12.0 2024-05-31 04:07:17 +00:00
Renovate Bot 7ad366d253 Update dependency swagger-ui-dist to v5.17.14 2024-05-31 04:06:55 +00:00
0ko 503953fb9b Unify vertical and horizontal paddings in markup file view (#3944)
Use the same padding horizontally and vertically, so the views like readme look a bit nicer. Just slightly adjusted two values, nothing really test-able here.

## Motivation

I came to the conclusion that they should be the same myself, later I checked GitHub and it turned out to also use the same paddings. I would like to notice that the padding here (2em = 32px) is the same as GitHub uses too.
I find this as a logical UI change because the paddings are usually same on both axis across the UI (like on PR sidebar).

Also updated paddings for when the files are shown in profile, but copied the `1.5em` that GitHub uses. This, once again, makes sense, because the overview markdown isn't the primary content, or as primary as the readme on the repo is, taking the full usable width.

## Preview

https://codeberg.org/attachments/55f6685c-1978-410a-a17b-9fac91f0642e
---
https://codeberg.org/attachments/d9016a1c-13cf-4ea6-a8e4-2619d93f3560

## Note

`.non-diff-file-content .plain-text` is left untouched with `1em 2em`, because the plaintext seems to add it's own margins, so it would make it look worse.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3944
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-05-31 03:38:45 +00:00
Renovate Bot 5e33f2d50f Update module github.com/go-testfixtures/testfixtures/v3 to v3.11.0 2024-05-31 00:05:11 +00:00
Earl Warren e417e424fa
Update module github.com/alecthomas/chroma/v2 to v2.14.0 (take 2)
Because the branch of the other PR was deleted by mistake.

Refs: https://codeberg.org/forgejo/forgejo/pulls/3922
2024-05-30 22:52:26 +02:00
0ko 68c9e9c2b9 Remove unused CSS rules (#3937)
Remove CSS code that was made unused by some changes in Gitea. I was working on a layout change here but was bothered a bit by these. I dug a bit into the git history to find out how they were made unused but it's relatively uneasy.

- remove rule that was setting `width: 100%;`: the exactly same selector setting this exact value is duplicated below
- remove rules with `followers` in selectors: we don't use this class in templates (would be nice if someone double-checks)
- my editor forced EoF fix

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3937
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-05-30 11:41:45 +00:00
Earl Warren b1e04a89be Merge pull request 'Fix localization of release/tag counters on releases page' (#3938) from 0ko/forgejo:i18n-release-page into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3938
2024-05-29 22:06:22 +00:00