Compare commits

..

602 commits

Author SHA1 Message Date
Lunny Xiao e953bce5d7 fix(repository): git push to an adopted repository fails
Fix adopt repository has empty object name in database (#31333)

Fix #31330
Fix #31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.

(cherry picked from commit 1968c2222dcf47ebd1697afb4e79a81e74702d31)

With tests services/repository/adopt_test.go

(cherry picked from commit 8efef06fb1)
2024-06-16 18:15:02 +00:00
0ko e997cbc8d5 Rename repo_updated to repo_updated_v7 to prevent regressions (#4117)
Currently this string has different amount of placeholders in v8 and v7 because https://codeberg.org/forgejo/forgejo/pulls/3837 was not backported to v7.

### The problem

This string is currently [not translated](https://translate.codeberg.org/translate/forgejo/forgejo/en/?checksum=405b09ee2c2371d4) in every language. For example, when UI is in Slovenian, it would be in English.
But if someone translates it into Slovenian, it will be something like `Posodobljen %s`. Then we merge the Weblate PR, @forgejo-backport-action creates a backport and we forget to check this backport for presence of `repo_updated`. We ship this as a point release of our LTS v7, and then Slovenian users will literally see `Posodobljen %s` in the UI instead of `Posodobljen včeraj`.

By renaming this key in v7 we protect it from these kinds of regressions.

### Test

Go to Explore, look at repo entries, they should contain relative time.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4117
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-06-14 13:26:46 +00:00
Earl Warren 5c59a1347a Merge pull request '[v7.0/forgejo] Minor improvements to English locale' (#4114) from 0ko/forgejo:i18n-backport-20240612 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4114
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-12 07:11:49 +00:00
0ko 4c5d0495a1 [I18N] Minor improvements to English locale 2024-06-12 09:47:23 +05:00
Earl Warren d497551151 Merge pull request '[v7.0/forgejo] Fix margin above headline in rendered org-mode' (#4107) from bp-v7.0/forgejo-187860b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4107
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-06-11 19:22:11 +00:00
Beowulf bfa98d56fa Fix margin above headline in rendered org-mode (#4076)
This Fixes #3962 by adding `!important` to the margin of the heading in the rendered markdown.

In the current behaviour, the margin-top was always overridden by a global css-rule. This is prevented by this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4076
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>
(cherry picked from commit 187860bded)
2024-06-11 16:34:03 +00:00
Earl Warren f132e98d12 Merge pull request '[gitea] week 2024-24-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#4084) from earl-warren/wcp/2024-24-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4084
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-06-11 10:37:57 +00:00
forgejo-backport-action 6c570bc3bd [v7.0/forgejo] Org buttons add missing vertical padding (#4088)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3964

This adds the missing vertical padding between the new repository and new migration button.

| Before | After (btns horizontal) | After (btns vertical) |
| -- | -- | -- |
| ![](/attachments/4f74c5c5-ccc7-4b57-936b-09e3a226c170) | <img width="293" alt="grafik" src="/attachments/560a0e85-3453-4357-bca0-75b1cbdfe658">  | <img width="284" alt="grafik" src="/attachments/2be0383b-2d44-48ef-8a35-1bd143ef044c"> |

## Manual test steps:

- Open org page
- Resize window
- Check padding

Co-authored-by: Beowulf <beowulf@beocode.eu>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4088
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-06-11 06:26:07 +00:00
Earl Warren 4574f776c6 Merge pull request '[I18N] Translations update from Weblate' (#4099) from 0ko/forgejo:i18n-backport-20240610 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4099
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-10 19:47:36 +00:00
Codeberg Translate 9e3c465b77 [I18N] Translations update from Weblate
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: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Xinayder <Xinayder@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: qwerty287 <qwerty287@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: SDKAAA <SDKAAA@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: mondstern <mondstern@users.noreply.translate.codeberg.org>
Co-authored-by: Application-Maker <Application-Maker@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3992
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>

(cherry-picked from ea5f7f0848)

Fixed key change conflicts in: cz de ru sl.
2024-06-10 23:53:19 +05:00
Earl Warren 080da5bca9 Merge pull request '[v7.0/forgejo] fix(cmd): actions artifacts cannot be migrated' (#4086) from bp-v7.0/forgejo-e759794-4afbfd3 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4086
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-09 15:36:38 +00:00
Earl Warren 43cd6e34e0 tests(cmd): add coverage for migrateActionsArtifacts
Also convert a comment into a warning in the logs when the deletion of
an artifact cannot find the file in the destination storage.

The case were an error happens while deleting the file is not covered
as it would require to mock the storage.Copy function.

(cherry picked from commit e759794408)
2024-06-09 14:55:01 +00:00
Rowan Bohde ab66bfff91 fix: allow actions artifacts storage migration to complete succesfully (#31251)
Change the copy to use `ActionsArtifact.StoragePath` instead of the
`ArtifactPath`. Skip artifacts that are expired, and don't error if the
file to copy does not exist.

---

When trying to migrate actions artifact storage from local to MinIO, we
encountered errors that prevented the process from completing
successfully:

* The migration tries to copy the files using the per-run
`ArtifactPath`, instead of the unique `StoragePath`.
* Artifacts that have been marked expired and had their files deleted
would throw an error
* Artifacts that are pending, but don't have a file uploaded yet will
throw an error.

This PR addresses these cases, and allow the process to complete
successfully.

(cherry picked from commit 8de8972baf5d82ff7b58ed77d78e8e1869e64eb5)
(cherry picked from commit 4afbfd3946)
2024-06-09 14:55:01 +00:00
wxiaoguang 816e77485f
Fix some URLs whose sub-path is missing (#31289)
Fix #31285

(cherry picked from commit 0188d82e4908eb173f7203d577f801f3168ffcb8)

Conflicts:
	templates/user/settings/applications.tmpl
(cherry picked from commit 3723d8c32059a571b84dc8636cb3649be6e6f1b3)

Conflicts:
	templates/user/settings/applications.tmpl
	trivial context conflict <i> vs <p>

(cherry picked from commit bbe98a3254e65eb8b9ec8fddf5e0ffe416a96614)
2024-06-09 12:05:43 +02:00
Giteabot 67fd0cea1b
Optimize runner-tags layout to enhance visual experience (#31258) (#31263)
Backport #31258 by @kerwin612

![image](https://github.com/go-gitea/gitea/assets/3371163/b8199005-94f2-45be-8ca9-4fa1b3f221b2)

Co-authored-by: Kerwin Bryant <kerwin612@qq.com>
(cherry picked from commit 83cf348e07fa83070d8a50d7d96943de08104fd4)
2024-06-09 11:57:05 +02:00
Thomas Desveaux f8774e3611
Fix NuGet Package API for $filter with Id equality (#31188) (#31242)
Backport #31188

Fixes issue when running `choco info pkgname` where `pkgname` is also a
substring of another package Id.

Relates to #31168

---

This might fix the issue linked, but I'd like to test it with more choco
commands before closing the issue in case I find other problems if
that's ok.
I'm pretty inexperienced with Go, so feel free to nitpick things.

Not sure I handled
[this](70f87e11b5/routers/api/packages/nuget/nuget.go (L135-L137))
in the best way, so looking for feedback on if I should fix the
underlying issue (`nil` might be a better default for `Value`?).

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit ca414a7ccf5e26272662e360c44ac50221a0f2d4)
2024-06-09 11:49:18 +02:00
Giteabot 9f89724324
Fix overflow on push notification (#31179) (#31238)
Backport #31179 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/30063

<img width="1301" alt="Screenshot 2024-05-30 at 14 43 24"
src="https://github.com/go-gitea/gitea/assets/115237/00443af0-088d-49a5-be9e-8c9adcc2c01d">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 331c32f9b680f0e25efe5d48ec57dfc1db194adf)
2024-06-09 11:48:07 +02:00
Giteabot 568300cf6b
Remove .segment from .project-column (#31204) (#31239)
Backport #31204 by @silverwind

Using `.segment` on the project columns is a major abuse of that class,
so remove it and instead set the border-radius directly on it.

Fixes: https://github.com/go-gitea/gitea/issues/31129

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 298d05df3b79634a0364926f34fb02b73d442c31)
2024-06-09 11:47:34 +02:00
Giteabot 5a2904166e
Fix overflow on notifications (#31178) (#31237)
Backport #31178 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/31170.

<img width="1312" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/627711ed-93ca-4be6-b958-10d673ae9517">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 85a81767083efd49bf675b3de30de5421ab2ae69)
2024-06-09 11:46:37 +02:00
Earl Warren 874dde0d4c Merge pull request '[v7.0/forgejo] RFC 6749 Section 10.2 conformance' (#4046) from bp-v7.0/forgejo-5924694 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4046
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-06 11:55:55 +00:00
Denys Konovalov 0c770d528f
use existing oauth grant for public client (#31015)
Do not try to create a new authorization grant when one exists already,
thus preventing a DB-related authorization issue.

Fix https://github.com/go-gitea/gitea/pull/30790#issuecomment-2118812426

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 9c8c9ff6d10b35de8d2d7eae0fc2646ad9bbe94a)
(cherry picked from commit 07fe5a8b13)
2024-06-06 12:05:50 +02:00
Archer a228ab3ab2
Prevent automatic OAuth grants for public clients (#30790)
This commit forces the resource owner (user) to always approve OAuth 2.0
authorization requests if the client is public (e.g. native
applications).

As detailed in [RFC 6749 Section 10.2](https://www.rfc-editor.org/rfc/rfc6749.html#section-10.2),

> The authorization server SHOULD NOT process repeated authorization
requests automatically (without active resource owner interaction)
without authenticating the client or relying on other measures to ensure
that the repeated request comes from the original client and not an
impersonator.

With the implementation prior to this patch, attackers with access to
the redirect URI (e.g., the loopback interface for
`git-credential-oauth`) can get access to the user account without any
user interaction if they can redirect the user to the
`/login/oauth/authorize` endpoint somehow (e.g., with `xdg-open` on
Linux).

Fixes #25061.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 5c542ca94caa3587329167cfe9e949357ca15cf1)
(cherry picked from commit 1b088fade6)
2024-06-06 12:05:37 +02:00
Earl Warren 8f88817c00 test(oauth): RFC 6749 Section 10.2 conformance
See:

1b088fade6 Prevent automatic OAuth grants for public clients
07fe5a8b13 use existing oauth grant for public client

(cherry picked from commit 592469464b)
2024-06-06 10:01:56 +00:00
Earl Warren 71c4eee50d Merge pull request '[v7.0/forgejo] chore(dependency): whitelist mholt/archiver/v3 CVE-2024-0406' (#4035) from earl-warren/forgejo:wip-v7.0-archiver into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4035
Reviewed-by: proton-ab <proton-ab@noreply.codeberg.org>
2024-06-05 22:17:19 +00:00
Earl Warren e7977767fa
chore(dependency): whitelist mholt/archiver/v3 CVE-2024-0406
It is not possible to tell vulncheck that Forgejo is not affected by
CVE-2024-0406. Use a mirror of the repository to do that.

Refs: https://github.com/mholt/archiver/issues/404
(cherry picked from commit 3bfec270ac)

Conflicts:
	go.sum
	trivial context conflict
2024-06-05 22:19:30 +02:00
Earl Warren e17e243624 Merge pull request '[v7.0/forgejo] test(oauth): coverage for the redirection of a denied grant' (#4029) from bp-v7.0/forgejo-32c882a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4029
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-05 17:17:29 +00:00
Earl Warren a930cb847a Merge pull request '[v7.0/forgejo] fix(oauth): HTML snippets in templates can be displayed' (#4031) from bp-v7.0/forgejo-caadd18 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4031
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-05 16:03:15 +00:00
Earl Warren 32673ad6a6 Merge pull request '[v7.0/forgejo] test(avatar): deleting a user avatar and file is atomic' (#4017) from bp-v7.0/forgejo-c139efb-20148e0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4017
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-05 15:27:58 +00:00
Zettat123 d841e95191
Return access_denied error when an OAuth2 request is denied (#30974)
According to [RFC
6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1),
when the resource owner or authorization server denied an request, an
`access_denied` error should be returned. But currently in this case
Gitea does not return any error.

For example, if the user clicks "Cancel" here, an `access_denied` error
should be returned.

<img width="360px"
src="https://github.com/go-gitea/gitea/assets/15528715/be31c09b-4c0a-4701-b7a4-f54b8fe3a6c5"
/>

(cherry picked from commit f1d9f18d96050d89a4085c961f572f07b1e653d1)
(cherry picked from commit 886a675f62)
2024-06-05 17:19:22 +02:00
Earl Warren f1301542b8 fix(oauth): HTML snippets in templates can be displayed
These changes were missed when cherry-picking the following

c9d0e63c202827756c637d9ca7bbde685c1984b7 Remove unnecessary "Str2html" modifier from templates (#29319)

Fixes: https://codeberg.org/forgejo/forgejo/issues/3623
(cherry picked from commit caadd1815a)
2024-06-05 15:18:43 +00:00
Earl Warren 40bf161ff0 test(oauth): coverage for the redirection of a denied grant
See 886a675f62 Return `access_denied` error when an OAuth2 request is denied

(cherry picked from commit 32c882af91)
2024-06-05 14:19:38 +00:00
Earl Warren cf2d8b57ae
test(avatar): deleting a user avatar is idempotent
If the avatar file in storage does not exist, it is not an error and
the database can be updated.

See 1be797faba Fix bug on avatar

(cherry picked from commit d2c4d833f4)
2024-06-05 16:02:24 +02:00
Lunny Xiao 32d8ada0e7
Fix bug on avatar (#31008)
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 58a03e9fadb345de5653345c2a68ecfd0750940a)
(cherry picked from commit 1be797faba)
2024-06-05 08:04:10 +02:00
Earl Warren 3ba58114c7 test(avatar): deleting a user avatar and file is atomic
The avatar must not be unset in the database if there is a failure to
remove the avatar file from storage (file or S3). The two operations
are wrapped in a transaction for that purpose and this test verifies
it is effective.

See 1be797faba Fix bug on avatar

(cherry picked from commit c139efb1e9)
2024-06-04 22:39:38 +00:00
Earl Warren afba61f55d test(storage): export UninitializedStorage to simulate failure
(cherry picked from commit 20148e061a)
2024-06-04 22:39:38 +00:00
Earl Warren e17e330712 Merge pull request '[gitea] week 2024-23-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#4004) from earl-warren/wcp/2024-23-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4004
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-04 07:47:02 +00:00
Giteabot e04b490cf6
Fix overflow in issue card (#31203) (#31225)
Backport #31203 by @silverwind

Before:

<img width="373" alt="Screenshot 2024-06-01 at 01 31 26"
src="https://github.com/go-gitea/gitea/assets/115237/82a210f2-c82e-4b7e-ac43-e70e46fa1186">

After:
<img width="376" alt="Screenshot 2024-06-01 at 01 31 32"
src="https://github.com/go-gitea/gitea/assets/115237/82d1b9f7-4fad-47bd-948a-04e1e7e006e6">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 0328f31fdc9b82efe7110cd2107628c2004e5be4)
2024-06-03 17:41:13 +02:00
Giteabot 4e233dd190
Fix the possible migration failure on 286 with postgres 16 (#31209) (#31218)
Backport #31209 by @lunny

Try to fix #31205

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 68e405cf0b00e475c089d8b94cc076d269ab9bb9)
2024-06-03 09:51:27 +02:00
Giteabot 4ad7c599e7
Fix branch order (#31174) (#31193)
Backport #31174 by @lunny

Fix #31172

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit c6176ee59f4a25607dcfbc00757121f705101101)
2024-06-03 09:49:40 +02:00
Lunny Xiao d462b6d495
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
(cherry picked from commit 62448bfb93)
(cherry picked from commit e8c776c79384c1c0a4d707ce5084b27347703848)
2024-06-03 09:47:51 +02:00
Earl Warren 4d0a5ea317 Merge pull request '[v7.0/forgejo] fix(hook): repo admins are wrongly denied the right to force merge' (#3997) from earl-warren/forgejo:wip-7.0-admin-protection into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3997
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-06-03 04:51:53 +00:00
Earl Warren 2df082393e
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
(cherry picked from commit 09f3518069)
2024-06-02 22:05:16 +02:00
Earl Warren baec3dc6b9
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.

(cherry picked from commit 05f0007437)
2024-06-02 22:05:16 +02:00
Earl Warren bad8e72bcd
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.

(cherry picked from commit 793421bf59)

Conflicts:
	tests/integration/pull_merge_test.go
	trivial context conflict
2024-06-02 22:05:08 +02:00
Earl Warren 6827a4a669
test(integration): add protected file to doBranchProtect
A protected file pushed to a protected branch branch is not allowed.

(cherry picked from commit e0eba21ab7)
2024-06-02 22:00:40 +02:00
Earl Warren e0cd813927
test(integration): refactor doBranchProtectPRMerge
* group test cases to clarify their purpose
* remove pull request branch protection tests, they are redundant
  with TestPullMergeBranchProtect

(cherry picked from commit 0d8478b82e)

Conflicts:
	tests/integration/git_test.go
	trivial context conflict
2024-06-02 22:00:18 +02:00
Earl Warren 9b17f6fd24
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

(cherry picked from commit 20591d966e)
2024-06-02 21:53:46 +02:00
Earl Warren 9cd730a063
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.

(cherry picked from commit 49aea9879b)
2024-06-02 21:53:46 +02:00
Earl Warren 68d803aae4
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.

(cherry picked from commit 70aa294cc1)
2024-06-02 21:53:46 +02:00
Earl Warren b4d792d2a2
test(integration): add t.Helper() to reduce stack polution
Without the a testify stack is likely to not show the relevant test.

(cherry picked from commit 4c2ed3c35d)
2024-06-02 21:53:46 +02:00
Earl Warren 2f9be3e824 Merge pull request '[v7.0/forgejo] Add multiple missed return after an error condition' (#3960) from earl-warren/forgejo:wip-v7.0-missed-return into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3960
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-02 16:25:10 +00:00
Earl Warren 3b7ad8ef9e Merge pull request '[v7.0/forgejo] add missed return in POST /repos/{owner}/{repo}/push_mirrors' (#3994) from bp-v7.0/forgejo-166bb28-5747951-ba37b9e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3994
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 16:23:19 +00:00
Earl Warren 4cbfd383e9 tests(api): POST /repos/{owner}/{repo}/push_mirrors coverage
(cherry picked from commit 166bb2861f)
2024-06-02 15:45:31 +00:00
Earl Warren d900842fd7 test(mock): DeletePushMirrors & AddPushMirrorRemote
make them into variables that can be mocked

(cherry picked from commit 5747951cc7)
2024-06-02 15:45:31 +00:00
Lunny Xiao bcb473dd2a Add missed return after ctx.ServerError (#31130) (partial)
Only routers/api/v1/repo/mirror.go

(cherry picked from commit b6f15c7948ac3d09977350de83ec91d5789ea083)
(cherry picked from commit ba37b9e577)
2024-06-02 15:45:31 +00:00
Earl Warren 089afd4086 Merge pull request 'Revert "Fix error on renaming merged PRs (#3840)"' (#3987) from 0ko/forgejo:revert-bug-causing-bug into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3987
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 15:27:35 +00:00
Earl Warren 8da2acff43 Merge pull request '[v7.0/forgejo] test(util): MockProtect when mocking multiple times' (#3993) from bp-v7.0/forgejo-884b3c0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3993
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-06-02 15:26:59 +00:00
Earl Warren 35d5ef0649 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

(cherry picked from commit 884b3c0f4b)
2024-06-02 14:32:00 +00:00
Earl Warren 8fc16691e0 Merge pull request '[v7.0/forgejo] Cleanup & add missing options to app.example.ini (#3983)' (#3986) from Mai-Lapyst/forgejo:backport-cleanup-app-example-ini-3983 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3986
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-02 13:13:12 +00:00
0ko e3dc128776 Merge pull request '[v7.0/forgejo] [I18N] Translations update from Weblate' (#3990) from bp-v7.0/forgejo-ebabb96 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3990
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-06-02 12:42:54 +00:00
Codeberg Translate cb481411b7 [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>
(cherry picked from commit ebabb96ce0)
2024-06-02 12:02:27 +00:00
0ko af49331f38 Revert "Fix error on renaming merged PRs (#3840)"
This reverts commit 0b01434aa3.
2024-06-02 13:38:00 +05:00
Mai-Lapyst 42d4c16c37
Cleanup & add missing options to app.example.ini
(cherry picked from commit c3d60ed9f7)
2024-06-02 09:40:05 +02:00
Giteabot 7bd9597803
Missed return on error part of: Fix bug on avatar (#31008) (#31019)
Backport #31008 by @lunny

Extract from #30995

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 8446caa813f676398411d3544cc05a42fd708cd1)
2024-05-31 14:56:16 +02:00
Giteabot 3bdf9eae01
Add missed return after ctx.ServerError (#31130) (#31133)
Backport #31130 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit e6bacf1fed57e33fcbbb7d57782bfc5daa8f2fee)
2024-05-31 14:35:19 +02:00
Earl Warren ebf1ba683b Merge pull request '[gitea] week 2024-22-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#3942) from earl-warren/wcp/2024-22-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3942
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-30 20:01:42 +00:00
Earl Warren 4af90387d4 Merge pull request '[v7.0/forgejo] Add an immutable tarball link to archive download headers for Nix' (#3946) from bp-v7.0/forgejo-6631f56 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3946
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-29 19:22:14 +00:00
Jade Lovelace 900381d6e9 Add an immutable tarball link to archive download headers for Nix
This allows `nix flake metadata` and nix in general to lock a *branch*
tarball link in a manner that causes it to fetch the correct commit even
if the branch is updated with a newer version.

For further context, Nix flakes are a feature that, among other things,
allows for "inputs" that are "github:someuser/somerepo",
"https://some-tarball-service/some-tarball.tar.gz",
"sourcehut:~meow/nya" or similar. This feature allows our users to fetch
tarballs of git-based inputs to their builds rather than using git to
fetch them, saving significant download time.

There is presently no gitea or forgejo specific fetcher in Nix, and we
don't particularly wish to have one. Ideally (as a developer on a Nix
implementation myself) we could just use the generic tarball fetcher and
not add specific forgejo support, but to do so, we need additional
metadata to know which commit a given *branch* tarball represents, which
is the purpose of the Link header added here.

The result of this patch is that a Nix user can specify `inputs.something.url =
"https://forgejo-host/some/project/archive/main.tar.gz"` in flake.nix
and get a link to some concrete tarball for the actual commit in the
lock file, then when they run `nix flake update` in the future, they
will get the latest commit in that branch.

Example of it working locally:

 » nix flake metadata --refresh 'http://localhost:3000/api/v1/repos/jade/cats/archive/main.tar.gz?dir=configs/nix'
Resolved URL:  http://localhost:3000/api/v1/repos/jade/cats/archive/main.tar.gz?dir=configs/nix
Locked URL:    804ede182b.tar.gz?dir=configs
/nix&narHash=sha256-yP7KkDVfuixZzs0fsqhSETXFC0y8m6nmPLw2GrAMxKQ%3D
Description:   Computers with the nixos
Path:          /nix/store/s856c6yqghyan4v0zy6jj19ksv0q22nx-source
Revision:      804ede182b6b66469b23ea4d21eece52766b7a06
Last modified: 2024-05-02 00:48:32

For details on the header value, see:
56763ff918/doc/manual/src/protocols/tarball-fetcher.md

(cherry picked from commit 6631f56ebf)
2024-05-29 18:50:14 +00:00
Earl Warren 6d9fe1db67 Merge pull request '[v7.0/forgejo] migrations: Map non-existant external users to Ghost' (#3936) from bp-v7.0/forgejo-ade7304 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3936
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-05-29 18:20:04 +00:00
silverwind def21375b7
Change --border-radius-circle to --border-radius-full (gitea#30936)
Cherry-pick of 2ced31e81d adapted to Forgejo releases UI.

Percentage-based `border-radius` [creates undesirable
ellipse](https://jsfiddle.net/silverwind/j9ko5wnt/4/) on non-square
content. Instead, use pixel value and use same wording `full` like
tailwind does, but increast to 99999px over their 9999px.

(cherry picked from commit 2ced31e81dd9e45659660c1abff529d0192fd8ed)
Adapted by @0ko

(cherry picked from commit afa1380672)
(cherry picked from commit 7b7318255e68ee7e4d0f5b1b8e5ef91cd72a59e5)
2024-05-29 13:52:42 +02:00
Kemal Zebari 43303922a8
Sync up deleted branches & action assets related cleanup documentation (#31022)
Syncs up docs associated to actions and deleted branch cleanup i.e. in
custom/app.example.ini and the config cheat sheet.

(cherry picked from commit c9eac519961ecd5d0e1d6ee856ab532e8c16c65d)

Conflicts:
	docs/content/administration/config-cheat-sheet.en-us.md
	docs do not exist here in Forgejo
(cherry picked from commit d6e454c320)
(cherry picked from commit 7d5ac68bc45d21464aa02f186ea36b62338d3585)
2024-05-29 13:44:21 +02:00
Gergely Nagy acbd44a186 migrations: Map non-existant external users to Ghost
When performing migrations, and need to remap external users to local
ones, when no local mapping is possible, map the external user to Ghost,
rather than the user who initiated the migration.

Mapping the external user to the migration initiator has the potential
of breaking assumptions elsewhere, like only having one review per pull
request per user. Mapping these migrated, locally unavailable users to
Ghost makes sure these - often hidden - assumptions do not break.

Fixes #3860.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit ade7304eea)
2024-05-28 16:44:23 +00:00
forgejo-backport-action 9a7df535da [v7.0/forgejo] [I18N] Fixes and improvements to English locale (#3914)
**Backport:** c3ffa30e7a [forgejo#3912](https://codeberg.org/forgejo/forgejo/pulls/3912)

Mostly cap fixes and a few improvements.

As for `activity.active_prs_count_`, it currently looks like this in the UI, I fixed it:
![image](/attachments/5d2dc089-519e-4655-8f8b-f78964ff179a)

Although I'm also the person who [introduced](4c1af0d9a6) the inconsistency.

`send_reset_mail` is a button, removed redundant word from it. It would be good to refactor such keys, but it will be an impossibly long process. Anyway, key refactors are done in separate PRs for easier merges.

Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3914
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-26 11:39:48 +00:00
Earl Warren 215160ced6 Merge pull request '[v7.0/forgejo] [I18N] Translations update from Weblate' (#3907) from 0ko/forgejo:i18n-20240525 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3907
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-25 21:16:38 +00:00
0ko 3861a2c70c [v7.0/forgejo] [I18N] Translations update from Weblate (#3851)
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: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: Anonymous <anonymous@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: NameLessGO <NameLessGO@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3851
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-05-25 23:40:44 +05:00
Earl Warren 16debbc792 Merge pull request '[v7.0/forgejo] fix(services): set SendNotificationEmailOnNewUser' (#3906) from bp-v7.0/forgejo-ff2a3f4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3906
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-25 15:58:01 +00:00
Earl Warren a215e9db30
fix(services): set SendNotificationEmailOnNewUser
regression from 767e9634d3. It changed
the parsing of the [admin] section from being derived from the content
of each key with mustMapSetting(rootCfg, "admin", &Admin) to
explicitly listing all keys in the code.

SEND_NOTIFICATION_EMAIL_ON_NEW_USER was not added and therefore
ignored. As a consequence notifications of newly registered users were
never sent.

(cherry picked from commit ff2a3f4e3a)

Conflict:
   modules/setting/admin_test.go
   EXTERNAL_USER_DISABLE_FEATURES does not exist in v7.0
2024-05-25 17:32:52 +02:00
Earl Warren 60ee476b57 Merge pull request '[v7.0/forgejo] fix(cli): add missing quote in storage help' (#3902) from bp-v7.0/forgejo-84bc466 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3902
2024-05-25 08:30:01 +00:00
Earl Warren 5a0059afd1 fix(cli): add missing quote in storage help
(cherry picked from commit 84bc4662c2)
2024-05-25 07:50:18 +00:00
Earl Warren 6bb1b001f9 Merge pull request '[gitea] week 2024-21-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#3859) from earl-warren/wcp/2024-21-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3859
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-05-24 19:59:51 +00:00
Earl Warren 4db698ce24 Merge pull request '[v7.0/forgejo] gitea#30342: Fix label-list rendering in timeline, decrease gap #3242' (#3877) from fnetx/fix-issue-label-display into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3877
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-24 15:23:14 +00:00
Earl Warren 75554579a6 Merge pull request '[v7.0/forgejo] mysql: faster user deletion (hook_task query) for mariadb 10' (#3888) from bp-v7.0/forgejo-4ffda65-bb165fa into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3888
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-24 13:45:38 +00:00
Earl Warren 1890eda1b7 Merge pull request '[v7.0/forgejo] Fix expand diff in pull requests being 404 (port of gitea#31013)' (#3887) from bp-v7.0/forgejo-fd9ee19-a62a887 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3887
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-24 13:31:41 +00:00
wxiaoguang 1fd1100ac9
Simplify mirror repository API logic (#30963)
Fix #30921

(cherry picked from commit 821d2fc2a3cc897f21d707455850177077b72410)
(cherry picked from commit 50b4e7f26e)

Equivalent to the Gitea v1.22 commit
(cherry picked from commit 8eac16de217978c1f7034f8e360f54d8d638e95e)
2024-05-24 15:15:07 +02:00
silverwind 50ef4ecefe
Upgrade tqdm dependency (#30996)
Result of `make update-py`

Fixes: https://github.com/go-gitea/gitea/security/dependabot/65
(cherry picked from commit a73e3c6a696029541ebd423f4eb2fec1ba151f79)
(cherry picked from commit 87def3837b)

Equivalent to the Gitea v1.22 commit
(cherry picked from commit f0e74da71929196dfdcab48616303d8b1c2c30da)
2024-05-24 15:15:07 +02:00
Lunny Xiao 6e17262567
Remove unnecessary double quotes on language file (#30977)
The double quotes and the prefix/suffix space are unnecessary.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 5b6f80989fbd0574ca188ab683389ff7659de30d)
(cherry picked from commit a20e924ee7)

Equivalent to the Gitea v1.22 commit
(cherry picked from commit cb52eb639e5d9b36794e46ec2e09d633c23c7322)
2024-05-24 15:15:07 +02:00
wxiaoguang 37228ea080
Always load or generate oauth2 jwt secret (#30942)
Fix #30923

(cherry picked from commit effb405cae88474c27f5c8322a2627019af1cf64)
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>

Conflicts:
	- modules/setting/oauth2.go
	  Conflicted due to different ways of logging. Since the log
	  message is removed anyway, resolved by removing it.
	- modules/setting/oauth2_test.go
	  Manually copied the test added by Gitea.
	- routers/install/install.go
	  Not a conflict per se, but adjusted to use NewJwtSecret().
(cherry picked from commit 193ac67176)

Equivalent to the Gitea v1.22 commit
(cherry picked from commit 5b7e54f72f7b85b3394d7af20b27152d26e26256)
2024-05-24 15:15:07 +02:00
oliverpool 8f99d82cf2 mysql: use inner join for hook_task deletion
Attempt to fix #3678

(cherry picked from commit 4ffda656e8)
2024-05-24 12:46:33 +00:00
oliverpool cef84d7abf test: check hook_task deletion
move test to integration to ensure Sqlite + MySQL testing

(cherry picked from commit bb165fadf6)
2024-05-24 12:46:33 +00:00
Gergely Nagy 9ac51ddeb7 tests: Add a test for code expansion on PRs
This adds a new test case to `TestCompareCodeExpand` to exercise the
case where we're viewing a PR's diff.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit fd9ee1901b)
2024-05-24 12:45:35 +00:00
wxiaoguang d3b4f9d326 Fix incorrect "blob excerpt" link when comparing files (#31013)
When comparing files between the base repo and forked repo, the "blob
excerpt" link should point to the forked repo, because the commit
doesn't exist in base repo.

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit f48cc501c46a2d34eb701561f01d888d689d60d5)

Conflicts:
	- templates/repo/diff/section_split.tmpl
	- templates/repo/diff/section_unified.tmpl
          Resolved the conflict by picking Gitea's change over ours, and
	  porting it.
	- tests/integration/compare_test.go
	  Kept our test, but picked the "compare all of the relevant
	  links" part of the Gitea test.
(cherry picked from commit a62a887649)
2024-05-24 12:45:35 +00:00
Earl Warren 391e311bbe [v7.0/forgejo] docs(release-notes): 7.0.3 (#3884)
Backport: https://codeberg.org/forgejo/forgejo/pulls/3858
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3884
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2024-05-24 12:40:26 +00:00
Earl Warren 09b08bcf7c Merge pull request '[v7.0/forgejo] [BUG] Fix SourceHut Builds webhook with triggers field' (#3881) from bp-v7.0/forgejo-0e479f3-1f6f909-c9f38e2-7b47cb4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3881
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-05-24 07:56:48 +00:00
oliverpool 2459145150 add release-notes
(cherry picked from commit 0e479f3502)
2024-05-24 00:26:20 +00:00
oliverpool 1c99c289f6 refactor: sourcehut_builds ignore unused fields
(cherry picked from commit 1f6f909b2e)
2024-05-24 00:26:19 +00:00
oliverpool 287253ff7d fix: sourcehut_builds preserve unused fields
Fix #3820

(cherry picked from commit c9f38e2813)
2024-05-24 00:26:19 +00:00
oliverpool 855f95f7a2 test: sourcehut_builds trigger
(cherry picked from commit 7b47cb43c1)
2024-05-24 00:26:19 +00:00
silverwind 269f7b76e0 [PORT] gitea#30342: Fix label-list rendering in timeline, decrease gap
Not sure exactly when this regressed, but has been a while I think.

Before:

<img width="895" alt="Screenshot 2024-04-08 at 22 46 50"
src="https://github.com/go-gitea/gitea/assets/115237/9b1788f8-017e-4fe1-8ab9-938e0d76fb41">

After:

<img width="689" alt="Screenshot 2024-04-08 at 23 00 58"
src="https://github.com/go-gitea/gitea/assets/115237/90193df9-5c24-4a1a-96fe-3d4e8392063c">

Co-authored-by: Giteabot <teabot@gitea.io>

---
Conflict resolution: none

(cherry picked from commit 8d14266269f1b4fd5e13d701830919c1a1613444)
2024-05-24 01:45:38 +02:00
Earl Warren b5c49a19d2 Merge pull request 'Revert "Prevent automatic OAuth grants for public clients (#30790) (#30836)"' (#3867) from earl-warren/forgejo:wip-oauth-revert into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3867
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-05-22 15:06:48 +00:00
Earl Warren 6771312133
Revert "Prevent automatic OAuth grants for public clients (#30790) (#30836)"
This reverts commit 248a5b8d7a.

This commit introduces a regression descrdibed at

https://github.com/go-gitea/gitea/pull/30790#issuecomment-2118812426

There is a commit to try and fix it, but it is similarly
untested. Let's not accumulate regressions and wait until it is either
field tested by humans in Gitea or a test is written.

https://github.com/go-gitea/gitea/pull/31015/files
2024-05-22 16:37:00 +02:00
Earl Warren 07ad7dd8f6 Merge pull request 'fix: Forgejo 7.0 is compatible with Gitea v1.21.11' (#3857) from earl-warren/forgejo:wip-gitea-compatibility into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3857
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-05-21 13:43:05 +00:00
Earl Warren 6a472f90f8
fix: Forgejo 7.0 is compatible with Gitea v1.21.11 2024-05-21 15:01:37 +02:00
0ko f00123b893 [v7/forgejo][I18N] Translations update from Weblate (#3852)
Manual backport of #3759 with MSSQL removal conflict resolved in zh-TW `require_db_desc`.

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Fitik <Fitik@users.noreply.translate.codeberg.org>
Co-authored-by: b1nar10 <b1nar10@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Mumulhl <mumulhl@duck.com>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3852
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-21 03:15:55 +00:00
Earl Warren 0f61cb389a Merge pull request '[v7.0/forgejo] Fix error on renaming merged PRs' (#3842) from bp-v7.0/forgejo-3351ce2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3842
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-20 14:08:11 +00:00
Earl Warren cbdef1792f Merge pull request '[v7.0/forgejo] badges: Relax the default workflow badge conditions' (#3846) from bp-v7.0/forgejo-d6915f4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3846
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-20 11:44:22 +00:00
Gergely Nagy ef4c6abbb9 badges: Relax the default workflow badge conditions
Previously, if no branch was explicitly specified for a workflow, it
defaulted to the default branch of the repo. This worked fine for
workflows that were triggered on push, but it prevented showing badges
for workflows that only run on tags, or on schedule - since they do not
run on a specific branch.

Thus, relax the conditions, and if no branch is specified, just return
the latest run of the given workflow. If one is specified, *then*
restrict it to said branch.

Fixes #3487.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit d6915f4d5f)
2024-05-20 10:47:25 +00:00
0ko 0b01434aa3 Fix error on renaming merged PRs (#3840)
Closes https://codeberg.org/forgejo/forgejo/issues/3743.

This is a simple fix for https://codeberg.org/forgejo/forgejo/issues/3743, based on changes in [gitea#30990](https://github.com/go-gitea/gitea/pull/30990), which was not included in https://codeberg.org/forgejo/forgejo/pulls/3838 due to large code differences.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3840
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
(cherry picked from commit 3351ce2bc5)
2024-05-19 18:20:50 +00:00
Otto 487b2129aa Merge pull request '[v7.0/forgejo] Suppress Monaco JavaScript errors in Safari' (#3833) from bp-v7.0/forgejo-e4c3c03 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3833
Reviewed-by: Otto <otto@codeberg.org>
2024-05-19 12:56:18 +00:00
David Davies-Payne b9674b3ee9 Suppress Monaco JavaScript errors in Safari (#3805)
Fix #3638

This is a manual Forgejo-specific version of the Gitea PR https://github.com/go-gitea/gitea/pull/30862. The weekly Forgejo PR #3772 could not cherry-pick this commit due to conflicts (eg subsequent CodeSpell changes).

Only occurs with Webkit in Safari over eg `http://192..`. (not localhost).
See https://webkit.org/blog/10855/async-clipboard-api/

---
**Before**
![Before.jpg](/attachments/c570d030-fcce-48ea-ac96-06b624541c7b)

**After**
![After.jpg](/attachments/1a9132ab-f7f3-43a5-b3ea-37b6f2b671c4)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3805
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: David Davies-Payne <d2p@me.com>
Co-committed-by: David Davies-Payne <d2p@me.com>
(cherry picked from commit e4c3c039be)
2024-05-18 21:20:48 +00:00
0ko a5776cc883 Merge pull request '[v7.0/forgejo] Fix overflowing titles in project columns' (#3827) from beowulf/bp-v7.0/forgejo-853f005 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3827
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-18 14:13:17 +00:00
Beowulf 972dd76eeb
fixed overflow of projects column title
This fixes that titles of project columns can overflow and push the
action menu out of the card, so that interaction is no longer possible.

Addition to the cherry pick:
In v7.0, `min-width: 0` is additionally applied to the title of the
project column, as this is missing for the .ui.label in contrast to v8.0.

Fixes #3717

(cherry picked from commit 853f005180)
2024-05-18 09:36:51 +02:00
Earl Warren af32e3c09a Merge pull request '[v7.0/forgejo] [I18N] Some English decap and other fixes' (#3825) from bp-v7.0/forgejo-1b12ca8 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3825
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-18 07:35:38 +00:00
0ko ceb9d543b3 [I18N] Some English decap and other fixes
(cherry picked from commit 1b12ca80ec)
2024-05-18 07:02:14 +00:00
Earl Warren 0d06f3c2dd Merge pull request '[v7.0/forgejo] Fix contrast for issue count in projects columns' (#3814) from bp-v7.0/forgejo-82e0066 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3814
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-17 11:10:21 +00:00
Beowulf b898370a04 Fixed contrast for issue count in projects column
Regression introduced by 9934931f1f

See #3772

(cherry picked from commit 82e0066ed4)
2024-05-17 10:36:05 +00:00
Earl Warren 7eb54dbfca Merge pull request '[v7.0/forgejo] Update dependency mermaid to v10.9.1' (#3802) from earl-warren/forgejo:wip-v7.0-mermaid into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3802
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-05-16 17:07:15 +00:00
Renovate Bot 055a403781
Update dependency mermaid to v10.9.1
(cherry picked from commit 03e2aed969)

Conflicts:
	package-lock.json
	package.json
	trivial context conflict
2024-05-16 18:12:23 +02:00
Earl Warren f7e9db75c4 Merge pull request '[v7.0/forgejo] Port: Fix some UI problems (install) (gitea#30854)' (#3799) from bp-v7.0/forgejo-c16ae1a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3799
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
2024-05-16 15:39:08 +00:00
Earl Warren 4ecbb2ef1b Merge pull request '[gitea] week 2024-20-v7.0 cherry pick (release/v1.22 -> v7.0/forgejo)' (#3772) from earl-warren/wcp/2024-20-v7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3772
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-05-16 15:36:08 +00:00
forgejo-backport-action 7a8b2d8eb8 [v7.0/forgejo] Improve base locale related to settings and accounts (#3742)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3733

- general English improvements
- separated the header of Language part in user settings into a new string for better translatability
- made that header contain "Default", just like the theme one, because this is how this actually works: the bottom selector saves the language temporarily, the selector in the settings saves it permanently. Not many users know about this difference. This clarification will help some
- removed some of "Manage" from the headers where they aren't really needed. This improves the consistency with some other headers

Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3742
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-16 14:15:33 +00:00
Earl Warren 6bf1bcab57 Merge pull request '[v7.0/forgejo] test: add more sha256 repositories tests' (#3798) from bp-v7.0/forgejo-67effd6-df8aaeb-348182f-e3e82d0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3798
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 13:54:37 +00:00
wxiaoguang 4feb183d91 Fix some UI problems (install) (#30854)
(cherry picked from commit ce8b11ae131bef6cd7df0849ed39da7984953a4b)
(cherry picked from commit c16ae1ab39)
2024-05-16 13:22:15 +00:00
Earl Warren 0f10d15dfa Merge pull request '[v7.0/forgejo] template: label fix correct input id' (#3796) from bp-v7.0/forgejo-208eed0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3796
Reviewed-by: Otto <otto@codeberg.org>
2024-05-16 13:15:23 +00:00
oliverpool d877f18092 test-sha256: APICreateFile
(cherry picked from commit 67effd6985)
2024-05-16 13:07:14 +00:00
oliverpool 32a0e1e2b4 test-sha256: APICreateBranch
(cherry picked from commit df8aaeb1d5)
2024-05-16 13:07:14 +00:00
oliverpool ab4570d0cb test-sha256: PushDeployKeyOnEmptyRepo
(cherry picked from commit 348182f4b3)
2024-05-16 13:07:14 +00:00
oliverpool 7c40672ddf test: useless duplication
(cherry picked from commit e3e82d02ad)
2024-05-16 13:07:14 +00:00
Frank Villaro-Dixon aefe770255 template: label fix correct input id
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
(cherry picked from commit 208eed05ff)
2024-05-16 10:16:28 +00:00
Earl Warren 40b639d2a0 Merge pull request '[v7.0/forgejo] fix: hook post-receive for sha256 repos' (#3788) from bp-v7.0/forgejo-5e73c67-2ac3dcb into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3788
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-05-16 06:59:56 +00:00
oliverpool 3f9f6f1350 fix: hook post-receive for sha256 repos
(cherry picked from commit 5e73c67d67)
2024-05-15 21:08:15 +00:00
oliverpool 6de1f714f3 test: hook post-receive for sha256 repos
failing push-to-create for sha256 will be fixed in a followup PR

(cherry picked from commit 2ac3dcbd43)
2024-05-15 21:08:15 +00:00
Earl Warren fa448e2293 Merge pull request '[v7.0/forgejo] gitea#30535: Refactor and fix archive link bug' (#3760) from algernon/forgejo:backport/3696-to-7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3760
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-14 22:25:07 +00:00
Earl Warren 161fca9007 Merge pull request '[v7.0/forgejo] Replace reply with a forked version to fix the cut-off of the incoming mail text' (#3753) from beowulf/fix-inline-attachments-body-cut-off-bp7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3753
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-14 15:21:25 +00:00
Earl Warren 08894a9335
[DEADCODE] update 2024-05-14 16:47:37 +02:00
Giteabot 56642554d1
Move reverproxyauth before session so the header will not be ignored even if user has login (#27821) (#30948)
Backport #27821 by @lunny

When a user logout and then login another user, the reverseproxy auth
should be checked before session otherwise the old user is still login.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 14dc00ae01c35ad51a3982a5725777bbeabe2b78)
2024-05-14 16:17:23 +02:00
Giteabot 10a9b6b806
Fix some UI regressions for commit list (#30920) (#30937)
Backport #30920 by wxiaoguang

Close #30919

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 94c5a30c8bd2ae78ffd7bd3b39bee019c531e1e7)
2024-05-14 16:14:38 +02:00
silverwind 6917b25ad3
Fix and tweak pull request commit list (#30528)
Fixes https://github.com/go-gitea/gitea/issues/30493, regression from
https://github.com/go-gitea/gitea/pull/30374.

Also did the flexbox convertion as suggested by the existing comment.

<img width="850" alt="Screenshot 2024-04-16 at 22 28 48"
src="https://github.com/go-gitea/gitea/assets/115237/e8905944-620a-4211-b5c5-53ed3b3ee23e">

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 311f5261cdb23b46d3f510e40fd4e2ac06e376c0)
(cherry picked from commit eea7ea9d0a)
2024-05-14 16:14:14 +02:00
yp05327 37fc6cdaf6
Fix incorrect default branch when adopt a repository (#30912) (#30928)
Backport #30912

ps: removed useless `u *user_model.User` for `adoptRepository`
(cherry picked from commit 2200c41ffd7dc84faa1de61941603af11b3412f2)
2024-05-14 16:09:33 +02:00
Zettat123 65529bd334
Update issue indexer after merging a PR (#30715)
Fix #30684

(cherry picked from commit f09e68ec33262d5356779572a0b1c66e6e86590f)

Conflicts:
	tests/integration/pull_merge_test.go
	trivial context conflict
(cherry picked from commit 8f0f6bf89c)

(cherry picked from commit df5513978a630355a28b6b42fcc63fe5d70652d8)
2024-05-14 16:00:57 +02:00
Lunny Xiao d91839692f
Fix various problems around projects board view (#30696)
The previous implementation will start multiple POST requests from the
frontend when moving a column and another bug is moving the default
column will never be remembered in fact.

- [x] This PR will allow the default column to move to a non-first
position
- [x] And it also uses one request instead of multiple requests when
moving the columns
- [x] Use a star instead of a pin as the icon for setting the default
column action
- [x] Inserted new column will be append to the end
- [x] Fix #30701 the newly added issue will be append to the end of the
default column
- [x] Fix when deleting a column, all issues in it will be displayed
from UI but database records exist.
- [x] Add a limitation for columns in a project to 20. So the sorting
will not be overflow because it's int8.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit a303c973e0264dab45a787c4afa200e183e0d953)

Conflicts:
	routers/web/web.go
	e91733468ef726fc9365aa4820cdd5f2ddfdaa23 Add missing database transaction for new issue (#29490) was not cherry-picked
	services/issue/issue.go
	fe6792dff3 Enable/disable owner and repo projects independently (#28805) was not cherry-picked
(cherry picked from commit 7d3ca90dfe)

(cherry picked from commit 084bec89ed7ae0816fc2d8db6784ad22523d1fc4)
2024-05-14 15:51:15 +02:00
silverwind 9934931f1f
[PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs
1. The previous color contrast calculation function was incorrect at
least for the `#84b6eb` where it output low-contrast white instead of
black. I've rewritten these functions now to accept hex colors and to
match GitHub's calculation and to output pure white/black for maximum
contrast. Before and after:
<img width="94" alt="Screenshot 2024-04-02 at 01 53 46"
src="https://github.com/go-gitea/gitea/assets/115237/00b39e15-a377-4458-95cf-ceec74b78228"><img
width="90" alt="Screenshot 2024-04-02 at 01 51 30"
src="https://github.com/go-gitea/gitea/assets/115237/1677067a-8d8f-47eb-82c0-76330deeb775">

2. Fix project-related issues:

- Expose the new `ContrastColor` function as template helper and use it
for project cards, replacing the previous JS solution which eliminates a
flash of wrong color on page load.
- Fix a bug where if editing a project title, the counter would get
lost.
- Move `rgbToHex` function to color utils.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>

---
Conflict resolution: Trivial.
(cherry picked from commit 36887ed3921d03f1864360c95bd2ecf853bfbe72)
(cherry picked from commit f6c0c39f1a)
2024-05-14 15:50:47 +02:00
Yarden Shoham c6d2c18052
Remove jQuery class from the project page (#30183)
- Switched from jQuery class functions to plain JavaScript `classList`
- Tested the edit column modal functionality and it works as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit b535c6ca7b9e8c4bcf5637091ee5ad6d9c807c31)
(cherry picked from commit 702f112602)
2024-05-14 15:50:31 +02:00
Giteabot 8f8d85da47
Fix wrong transfer hint (#30889) (#30900)
Backport #30889 by @lunny

Fix #30187

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 271e8748a2035ebc836cc2d1e03f4e68b063697e)
2024-05-14 15:45:03 +02:00
Lunny Xiao 7e81775184
Move database operations of merging a pull request to post receive hook and add a transaction (#30805)
Merging PR may fail because of various problems. The pull request may
have a dirty state because there is no transaction when merging a pull
request. ref
https://github.com/go-gitea/gitea/pull/25741#issuecomment-2074126393

This PR moves all database update operations to post-receive handler for
merging a pull request and having a database transaction. That means if
database operations fail, then the git merging will fail, the git client
will get a fail result.

There are already many tests for pull request merging, so we don't need
to add a new one.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit ebf0c969403d91ed80745ff5bd7dfbdb08174fc7)

Conflicts:
	modules/private/hook.go
	routers/private/hook_post_receive.go
	trivial conflicts because
	  263a716cb5 * Performance optimization for git push (#30104)
	was not cherry-picked and because of
	  998a431747 Do not update PRs based on events that happened before they existed
(cherry picked from commit eb792d9f8a)

(cherry picked from commit ec3f5f9992d7ff8250c044a4467524d53bd50210)
2024-05-14 15:37:32 +02:00
6543 99bd29f02f
Repository explore alphabetically order respect owner name (#30882)
similar to #30784 but only for the repo explore page

is covered by #30876 for the main branch

(cherry picked from commit d410e2acce22e5b3518a9bf64a9152b32a91fe18)
2024-05-14 15:31:36 +02:00
Giteabot e5f9482745
Fix missing migrate actions artifacts (#30874) (#30886)
Backport #30874 by @lunny

The actions artifacts should be able to be migrate to the new storage
place.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 216c8eada3c0727288dc5565ae9fdd798b17c463)
2024-05-14 15:31:14 +02:00
Giteabot 220594bacc
Make "sync branch" also sync object format and add tests (#30878) (#30880)
Backport #30878 by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit ad5a8d043c6818c0c496ebae2f5ea9373219bcd6)
2024-05-14 15:28:38 +02:00
Giteabot 1582b1e83a
Get repo list with OrderBy alpha should respect owner too (#30784) (#30875)
Backport #30784 by @6543

instead of:
- zowner/gcode
- awesome/nul
- zowner/nul
- zowner/zzz

we will get:
- awesome/nul
- zowner/gcode
- zowner/nul
- zowner/zzz

Co-authored-by: 6543 <6543@obermui.de>
(cherry picked from commit cfe6779d4eb2f3869357768fe58863642f79c5a9)
2024-05-14 15:27:25 +02:00
Giteabot dbecdd2be2
Have time.js use UTC-related getters/setters (#30857) (#30869)
Backport #30857 by kemzeb

Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
Co-authored-by: Sam Fisher <fisher@3echelon.local>
(cherry picked from commit 2252a7bf84c26aee0dfa1b1b826dba148f507a3a)
2024-05-14 15:25:52 +02:00
Earl Warren 98afc8fcdb Merge pull request '[v7.0/forgejo] Expand code diffs against the commits repo' (#3767) from bp-v7.0/forgejo-220c3fe into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3767
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-14 12:42:18 +00:00
0ko 679010f079 Merge pull request '[v7.0/forgejo] Translation updates from Weblate' (#3749) from bp-v7.0/forgejo-61643a6 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3749
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-14 12:20:19 +00:00
forgejo-backport-action 0dc681ed13 [v7.0/forgejo] Improve translatability of "Transfer ownership" (#3750)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3739

This text can have different forms in other languages depending on context.

The commit also contains a change to .editorconfig to prevent EoF changes when mass-replacing strings, as that causes unintentional merge conflicts with Weblate.

Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3750
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-14 12:14:36 +00:00
Gergely Nagy dc13eecc04 Expand code diffs against the commits repo
When expanding code diffs, the expansion should search for more context
in the commits repo, rather than in the repo in context, because the
commit may not be available in the base repo. For example, when
previewing a pull request, the commit is not in the target repo yet -
it's in the fork.

Fixes #3746.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 220c3fe3b3)
2024-05-14 12:06:44 +00:00
Earl Warren 8a8718be4d Merge pull request '[v7.0/forgejo] Rename Str2html to SanitizeHTML and clarify its behavior (followup) (take 2)' (#3751) from bp-v7.0/forgejo-337f4f9 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3751
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-14 10:55:07 +00:00
Gergely Nagy 50ac410e35
[backport]: backport applyElemsCallback
Lifted out from 1983226581.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-14 08:39:59 +02:00
wxiaoguang cbdf32126f
Refactor and fix archive link bug (#30535)
Regression of #29920
Fixes: #30569

Also this is a rewriting to eliminate the remaining jQuery usages from code.

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit d0e07083559180b124a08359fcc72f9ef695e723)

Conflicts:
	- web_src/js/features/repo-common.js
	  Conflict resolved in favour of Gitea.
2024-05-14 08:34:46 +02:00
Beowulf 1f08add260
Replace reply with a forked version to fix the cut-off of the incoming mail text (#3747)
replace reply with forgejos forked version

If plain text is selected as the message format in e.g. Apple Mail, the inline attachments are no longer at the end of the mail, but instead directly where they are in the mail. When parsing the mail, these inline attachments are replaced by "--". The new reply version no longer cuts the text at the first "--".

Tests for this are present in reply (7dc5750c6d).

Fixes https://codeberg.org/forgejo/forgejo/issues/3496#issuecomment-1798416

---

Additionally, I reduced the allocations for the inline attachments.
2024-05-13 23:51:40 +02:00
Earl Warren 8b86b6f1a0 Rename Str2html to SanitizeHTML and clarify its behavior (followup) (take 2)
In
  801792e4dc Rename Str2html to SanitizeHTML and clarify its behavior (followup)
the replacement was incorrect because
  c9d0e63c20  Remove unnecessary "Str2html" modifier from templates
was not applied and Str2html should have not been present in the first
place.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3554
(cherry picked from commit 337f4f9d87)
2024-05-13 18:38:48 +00:00
0ko 564183bbbd Translation updates from Weblate (#3748)
This is not the usual Weblate PR. I did not reset Weblate after squash-merging https://codeberg.org/forgejo/forgejo/pulls/3637, so Weblate failed to rebase and locked. These are manually cherry-picked commits that Weblate produced after that PR was merged. We need to squash-merge them too before resetting Weblate, so the new translations don't get lost.

Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: Cwpute <Cwpute@users.noreply.translate.codeberg.org>
Co-authored-by: Mylloon <Mylloon@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: owofied <furry@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3748
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
(cherry picked from commit 61643a698c)
2024-05-13 18:18:32 +00:00
Earl Warren 9d6974d1f8 Merge pull request '[v7.0/forgejo] [I18N] Translations update from Weblate' (#3740) from bp-v7.0/forgejo-010cccd into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3740
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-13 12:45:16 +00:00
Codeberg Translate 92867c76a7 [I18N] Translations update from Weblate (#3637)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: enricpineda <enricpineda@users.noreply.translate.codeberg.org>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: nmmr <nmmr@users.noreply.translate.codeberg.org>
Co-authored-by: VioletLul <VioletLul@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: Nifou <Nifou@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3637
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>
(cherry picked from commit 010cccd33e)
2024-05-13 11:55:57 +00:00
Earl Warren 186cb13b26 Merge pull request 'Port "Fix project name wrapping, remove horizontal margin on header"' (#3730) from 0ko/forgejo:wrappp into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3730
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-12 13:46:38 +00:00
0ko 9673355bf3 Port "Fix project name wrapping, remove horizontal margin on header"
Port of 370b1bdb37.
2024-05-12 17:37:36 +05:00
Earl Warren 0bba3e2158 Merge pull request '[v7.0/forgejo] Add class tw-break-anywhere' (#3720) from bp-v7.0/forgejo-b45fbe1 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3720
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-12 10:48:49 +00:00
0ko 6334a48043 Add class tw-break-anywhere
very partial port of 9946353282 (diff-38f10be6b48c74bcacbf9f6e15cc8582a45b7a6cbd1cdd8efec8e592575290c5) to fix a few picked areas where lack of it causes bugs.

(cherry picked from commit b45fbe1dcc)
2024-05-11 18:13:28 +00:00
Earl Warren ba1f73f550 Merge pull request '[v7.0/forgejo] templates: Be more forgiving about missing package metadata' (#3705) from bp-v7.0/forgejo-ac4d535 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3705
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-05-10 18:47:36 +00:00
Gergely Nagy 00cfe9aef9 templates: Be more forgiving about missing package metadata
When rendering templates for packages, be more forgiving about missing
metadata. For some repository types - like maven - metadata is uploaded
separately. If that upload fails, or does not happen, there will be no
metadata.

In that case, Forgejo should handle it gracefully, and render as much of
the information as possible, without erroring out. Rendering without
metadata allows one to delete a partial package, while if we throw
errors, that becomes a whole lot harder.

This patch adjusts the generic metadata template, and also the maven
template. There may be more cases of the same problem lying around.

Fixes #3663.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit ac4d535dbf)
2024-05-10 18:10:25 +00:00
Earl Warren d8fda28dfc Merge pull request '[v7.0/forgejo] Fix some 7.0 missing variables' (#3688) from bp-v7.0/forgejo-0dc35c9 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3688
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-09 19:30:27 +00:00
Earl Warren 7afee47817 Merge pull request '[v7.0/forgejo] Teach activities.GetFeeds() how to avoid returning duplicates' (#3687) from bp-v7.0/forgejo-9cb2aa9 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3687
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-09 19:29:39 +00:00
0ko 887c050ea3 [THEME] Fix some 7.0 missing variables
(cherry picked from commit 0dc35c9df9)
2024-05-09 18:52:33 +00:00
Gergely Nagy 9ba48419ba Teach activities.GetFeeds() how to avoid returning duplicates
Before explaining the fix itself, lets look at the `action` table, and
how it is populated. Data is only ever inserted into it via
`activities_model.NotifyWatchers`, which will:

- Insert a row for each activity with `UserID` set to the acting user's
  ID - this is the original activity, and is always inserted if anything
  is to be inserted at all.
- It will insert a copy of each activity with the `UserID` set to the
  repo's owner, if the owner is an Organization, and isn't the acting
  user.
- It will insert a copy of each activity for every watcher of the repo,
  as long as the watcher in question has read permission to the repo
  unit the activity is about.

This means that if a repository belongs to an organizations, for most
activities, it will have at least two rows in the table. For
repositories watched by people other than their owner, an additional row
for each watcher.

These are useful duplicates, because they record which activities are
relevant for a particular user. However, for cases where we wish to see
the activities that happen around a repository, without limiting the
results to a particular user, we're *not* interested in the duplicates
stored for the watchers and the org. We only need the originals.

And this is what this change does: it introduces an additional option to
`GetFeedsOptions`: `OnlyPerformedByActor`. When this option is set,
`activities.GetFeeds()` will only return the original activities, where
the user id and the acting user id are the same. As these are *always*
inserted, we're not missing out on any activities. We're just getting
rid of the duplicates. As this is an additional `AND` condition, it can
never introduce items that would not have been included in the result
set before, it can only reduce, not extend.

These duplicates were only affecting call sites where `RequestedRepo`
was set, but `RequestedUser` and `RequestedTeam` were not. Both of those
call sites were updated to set `OnlyPerformedByActor`. As a result,
repository RSS feeds, and the `/repos/{owner}/{repo}/activities/feeds`
API end points no longer return dupes, only the original activities.

Rather than hardcoding this behaviour into `GetFeeds()` itself, I chose
to implement it as an explicit option, for the sake of clarity.

Fixes Codeberg/Community#684, and addresses gitea#20986.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 9cb2aa989a)
2024-05-09 18:37:30 +00:00
Earl Warren 283b678146 Merge pull request '[v7.0/forgejo] Fix an incorrect form submission in repo-issue.js' (#3677) from bp-v7.0/forgejo-f4dd53d into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3677
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-05-08 21:49:06 +00:00
Gergely Nagy b6be9fb901 Fix an incorrect form submission in repo-issue.js (#3675)
This fixes `initRepoPullRequestAllowMaintainerEdit()` to submit the form correctly (as a web form, rather than as JSON payload).

Fixes #3618, cherry picked from gitea#30854.

Co-Authored-By: wxiaoguang <wxiaoguang@gmail.com>

---

Manual testing steps:

- Open a PR against any repository, with the "Allow edits from maintainers" option checked.
- Open the developer console (`Ctrl-Shift-I` on Firefox), and look at the Network tab.
- Visit the PR, find the "Allow edits from maintainers" checkbox, and click it.
- See the developer console, and check that the response says the setting is false.
- Refresh the page *completely* (`Ctrl-Shift-R` on Firefox)
- Observe that the setting is off.
- Click the box again to enable it.
- See the developer console, and check that the response says the setting is true.
- Reload without cache again (`Ctrl-Shift-R` on Firefox)
- Observe that the setting is now on.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3675
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Co-committed-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit f4dd53d79d)
2024-05-08 21:16:08 +00:00
Earl Warren 767d292c83 Merge pull request '[v7.0/forgejo] Cumulative English improvements (May 2024)' (#3674) from bp-v7.0/forgejo-b11eddf into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3674
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-08 19:16:24 +00:00
0ko 8d3c6251a7 [I18N] English improvements (May 2024)
- `editor.commit_id_not_matching` was reported by https://codeberg.org/kita. I confirmed the meaning on next.forgejo.org.
- `additional_repo_units_hint` was suggested by https://codeberg.org/leana8959.

(cherry picked from commit b11eddfaa8)
2024-05-08 17:09:24 +00:00
Earl Warren 94ce24cf92 Merge pull request '[v7.0/forgejo] fix(security): CVE-2024-24788 malformed DNS message' (#3673) from bp-v7.0/forgejo-f3045f0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3673
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-08 17:02:19 +00:00
Earl Warren 696ed328fb fix(security): CVE-2024-24788 malformed DNS message
Refs: https://pkg.go.dev/vuln/GO-2024-2824
(cherry picked from commit f3045f0519)
2024-05-08 14:47:59 +00:00
Earl Warren dd3487dbbf Merge pull request '[v1.22/gitea] week 2024-19 cherry pick v7.0' (#3659) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3659
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-05-07 22:48:50 +00:00
Earl Warren 18249e58be Merge pull request '[v7.0/forgejo] Update module gitea.com/go-chi/binding to v0.0.0-20240430071103-39a851e106ed' (#3660) from earl-warren/forgejo:wip-v7.0-chi-binding into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3660
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-05-07 08:56:40 +00:00
Earl Warren f8a3482cdb
Update module gitea.com/go-chi/binding to v0.0.0-20240430071103-39a851e106ed
(cherry picked from commit 58bf120eba)

Conflicts: trivial context conflicts
2024-05-07 08:35:25 +01:00
yp05327 da993b09ad
Fix no edit history after editing issue's title and content (#30814)
Fix #30807

reuse functions in services

(cherry picked from commit a50026e2f30897904704895362da0fb12c7e5b26)

Conflicts:
	models/issues/issue_update.go
	routers/api/v1/repo/issue.go
	trivial context conflict because of 'allow setting the update date on issues and comments'
(cherry picked from commit 6a4bc0289d)
2024-05-07 08:21:38 +01:00
Kemal Zebari 6ae15bc15e
Don't only list code-enabled repositories when using repository API (#30817)
We should be listing all repositories by default.

Fixes #28483.

(cherry picked from commit 9f0ef3621a3b63ccbe93f302a446b67dc54ad725)

Conflict:
   -		if ctx.IsSigned && ctx.Doer.IsAdmin || permission.UnitAccessMode(unit_model.TypeCode) >= perm.AccessModeRead {
   +		if ctx.IsSigned && ctx.Doer.IsAdmin || permission.HasAccess() {
   because of https://codeberg.org/forgejo/forgejo/pulls/2001
(cherry picked from commit e388822e9d)
2024-05-07 08:17:35 +01:00
Giteabot f30c648037
Ignore useless error message "broken pipe" (#30801) (#30842)
Backport #30801 by wxiaoguang

Fix #30792

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit ab2ef1ae49bc5e81d0debac85aee687a64fde8b3)
2024-05-07 08:15:36 +01:00
Giteabot 248a5b8d7a
Prevent automatic OAuth grants for public clients (#30790) (#30836)
Backport #30790 by archer-321

This commit forces the resource owner (user) to always approve OAuth 2.0
authorization requests if the client is public (e.g. native
applications).

As detailed in [RFC 6749 Section
10.2](https://www.rfc-editor.org/rfc/rfc6749.html#section-10.2),

> The authorization server SHOULD NOT process repeated authorization
requests automatically (without active resource owner interaction)
without authenticating the client or relying on other measures to ensure
that the repeated request comes from the original client and not an
impersonator.

With the implementation prior to this patch, attackers with access to
the redirect URI (e.g., the loopback interface for
`git-credential-oauth`) can get access to the user account without any
user interaction if they can redirect the user to the
`/login/oauth/authorize` endpoint somehow (e.g., with `xdg-open` on
Linux).

Fixes #25061.

Co-authored-by: Archer <archer@beezig.eu>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 6d83f5eddc0f394f6386e80b86a3221f6f4925ff)
2024-05-07 08:14:22 +01:00
Kemal Zebari 5678e9ab20
Catch and handle unallowed file type errors in issue attachment API (#30791)
Before, we would just throw 500 if a user passes an attachment that is
not an allowed type. This commit catches this error and throws a 422
instead since this should be considered a validation error.

(cherry picked from commit 872caa17c0a30d95f85ab75c068d606e07bd10b3)

Conflicts:
	tests/integration/api_comment_attachment_test.go
	tests/integration/api_issue_attachment_test.go
	trivial context conflict because of 'allow setting the update date on issues and comments'
(cherry picked from commit 9cd0441cd3)
2024-05-07 08:12:34 +01:00
silverwind a7124df0c5
Add hover outline to heatmap squares (#30828)
Makes it easier to use because you see which square is currently
hovered:

<img width="314" alt="Screenshot 2024-05-02 at 15 38 20"
src="https://github.com/go-gitea/gitea/assets/115237/3a15dad1-2259-4f28-9fae-5cf6ad3d8798">

I did try a `scoped` style for this, but that did not work for some
reason.

(cherry picked from commit 6f89d5e3a0886d02ead732005f593ae003f78f78)
2024-05-07 08:09:44 +01:00
wxiaoguang abf40ee957
Skip gzip for some well-known compressed file types (#30796)
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit be112c1fc30f87a248b30f48e891d1c8c18e8280)

Conflicts:
	routers/web/web.go
	trivial conflict because of https://codeberg.org/forgejo/forgejo/pulls/1533
(cherry picked from commit 4e35e5b8ae)
2024-05-07 07:59:45 +01:00
Earl Warren 7be345f88e Merge pull request '[v7.0/forgejo] Improve repo filter names' (#3641) from bp-v7.0/forgejo-82f7308 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3641
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-05 14:49:03 +00:00
0ko 8b1d84797f [I18N] Improve repo filter names
(cherry picked from commit 82f7308e1b)
2024-05-05 12:15:56 +00:00
Earl Warren ba0ed5823c Merge pull request '[UI] Fix commit messages breaking out of event history' (#3640) from 0ko/forgejo:ui-fix-break-out into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3640
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-05 12:12:09 +00:00
0ko e59f92dec8 [UI] Fix commit messages breaking out of event history
Regression of 8b54d38cbe.
This is 7.0 specific path for the issue. The design of this area is not compatible with 8.0, and thus there's no startightforward way to make it look like on 8.0.
2024-05-05 15:40:25 +05:00
forgejo-backport-action 10b919d3ca [v7.0/forgejo] [I18N] Translations update from Weblate (#3631)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3508

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3631
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-04 19:24:41 +00:00
Earl Warren f45a6cb3b7 Merge pull request '[v7.0/forgejo] FIX gogs migration if gogs is hosted at a subpath' (#3588) from bp-v7.0/forgejo-4a2959b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3588
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-03 17:17:00 +00:00
Otto 5b6a375d05 Merge pull request '[v7.0/forgejo] Fix text selection color' (#3611) from bp-v7.0/forgejo-787b16a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3611
Reviewed-by: Otto <otto@codeberg.org>
2024-05-02 22:06:17 +00:00
Earl Warren ac34a68a93 Merge pull request 'Port Fix checkbox field markup' (#3592) from 0ko/forgejo:a-commit into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3592
Reviewed-by: Otto <otto@codeberg.org>
2024-05-02 18:10:20 +00:00
Earl Warren fcf85b12af Merge pull request '[v7.0/forgejo] UI: Actions: Replace runs list description semicolon' (#3582) from bp-v7.0/forgejo-870a1c8 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3582
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-02 18:01:28 +00:00
Earl Warren 2949bbcad1 Merge pull request '[v7.0/forgejo] Show repo count in blocked users tab' (#3609) from bp-v7.0/forgejo-d50efa6 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3609
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-02 17:49:17 +00:00
0ko b23d4ec4bb [THEME] fix text selection color
regression of c2280a2009

(cherry picked from commit 787b16a7be)
2024-05-02 17:46:07 +00:00
Panagiotis "Ivory" Vasilopoulos d758633c91 UI: Actions: Replace runs list description semicolon
The current format makes the text look somewhat like this:

```
testing.yml #15065 :Commit 103306f00c pushed by n0toose
```

This looks wrong. We will have to work on that list at a later point
in time anyways, as well as make the way that we separate information
in subheaders in lists like this one more consistent.

However, this should do for now.

This change should make each entry look like this instead:

```
testing.yml #15065 - Commit 103306f00c pushed by n0toose
```

(cherry picked from commit 870a1c85c7)
2024-05-02 17:10:28 +00:00
JakobDev d449fcff0a Show repo count in blocked users tab (#3601)
Fixes #3595

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3601
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: JakobDev <jakobdev@gmx.de>
Co-committed-by: JakobDev <jakobdev@gmx.de>
(cherry picked from commit d50efa626a)
2024-05-02 17:10:06 +00:00
Earl Warren a7400b1812 Merge pull request 'Upgrade github.com/editorconfig-checker/editorconfig-checker to v2.8.0' (#3610) from earl-warren/forgejo:wip-lint-editorconfig into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3610
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: thefox <thefox@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-05-02 17:09:33 +00:00
Earl Warren a6d31a30a2
Upgrade github.com/editorconfig-checker/editorconfig-checker to v2.8.0
Manual backport: https://codeberg.org/forgejo/forgejo/pulls/3181
because it conflicts with a number of evolutions in how the tools are
upgraded in the development branch.
2024-05-02 17:38:26 +01:00
forgejo-backport-action 4b79a98910 Fix inconsistent required field (#3591)
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3591
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-01 19:05:43 +00:00
silverwind b917571d81 Fix checkbox field markup (#30666)
Fixes https://github.com/go-gitea/gitea/issues/30664.

Previous use was not a supported way by fomantic and the misuse only
became visible after the checkbox migration.

(cherry picked from commit 1a2ae64b16f10b8d1e17197d18b9eb373faf58db)
2024-05-01 23:31:42 +05:00
varp0n c91f7d3599 FIX gogs migration if gogs is hosted at a subpath (#3572)
Also add a test for GogsDownloaderFactory.New() to make sure
that the URL of the source repository is parsed correctly.

When the source gogs instance is hosted at a subpath like `https://git.example.com/gogs/<username>/<reponame>` the migration fails.
This PR fixes that.

Co-authored-by: hecker <tomas.hecker@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3572
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: varp0n <tom@gkstn.de>
Co-committed-by: varp0n <tom@gkstn.de>
(cherry picked from commit 4a2959b3ec)
2024-05-01 16:32:17 +00:00
Earl Warren 9d1ffeaf8d Merge pull request '[skip ci] [v7.0/forgejo] docs(release-notes): 7.0.2' (#3586) from earl-warren/forgejo:wip-release-notes-v7.0.2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3586
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-01 14:35:52 +00:00
Earl Warren 9db70035b1
[skip ci] docs(release-notes): 7.0.2
(cherry picked from commit a050b546b9)
2024-05-01 15:05:28 +02:00
Earl Warren ad0b97c7c2 Merge pull request '[v1.22/gitea] week 2024-18 cherry pick v7.0 (take 2)' (#3580) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3580
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-05-01 12:36:57 +00:00
Earl Warren 61230e72b5 Merge pull request '[v7.0/forgejo] Fix Issue watching / unwatching on the web ui' (#3585) from algernon/forgejo:backport/v7.0/3562 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3585
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 12:26:04 +00:00
forgejo-backport-action 50b7009603 [v7.0/forgejo] Add inline attachments to comments and prevent double handling of mails (#3566)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3504

If incoming email is configured and an email is sent, inline attachments are currently not added to the comment if it has the `Content-Disposition: inline` instead of `Content-Disposition: attachment` as e.g. with Apple Mail.

This adds inline attachments (`Content-Disposition: inline`) that *have a filename* as attachment to the comment. Other elements with `Content-Disposition: inline` are not attached as attachment to the comment.

In addition, a check has been added to prevent mails from being processed twice.

Fixes #3496

Co-authored-by: Beowulf <beowulf@beocode.eu>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3566
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-01 12:19:38 +00:00
Gergely Nagy 36b8e68eee
Add a test case for unsubscribing from an issue
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy f83ae0fad2
tests: Support creating a declarative repo without AutoInit
To be able to easily test cases where the repository does not have any
code, where the git repo itself is completely uninitialized, lets
support a case where the `AutoInit` property is false.

For the sake of backwards compatibility, if the option is not set either
way, it will default to `true`.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy 6f35a5ab90
Fix Issue watching / unwatching on the web ui
When subscribing or unsubscribing to/from an issue on the web ui, the
request was posted to a route handled by `repo.IssueWatch`. This
function used `ctx.Req.PostForm.Get()`, erroneously.

`request.PostForm` is *only* available if `request.ParseForm()` has been
called before it. The function in question did not do that. Under some
circumstances, something, somewhere did end up calling `ParseForm()`,
but not in every scenario.

Since we do not need to check for multiple values, the easiest fix here
is to use `ctx.Req.PostFormValue`, which will call `ParseForm()` if
necessary.

Fixes #3516.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy 0da02b9213
tests: Let CreateDeclarativeRepoWithOptions create a Wiki too
Add a new member to `DeclarativeRepoOptions`: `WikiBranch`. If
specified, create a Wiki with the given branch, and a single "Home"
page.

This will be used by an upcoming test.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:30:32 +02:00
Gergely Nagy 13892121e6
tests: Refactor CreateDeclarativeRepo
Lets introduce a new helper function,
`CreateDeclarativeRepoWithOptions`! This is almost the same as the
existing `CreateDeclarativeRepo` helper, but instead of taking a list of
random parameters the author thought of at the time of its introduction,
it takes a `DeclarativeRepoOptions` struct, with optional members.

This makes it easier to extend the function, as new members can be added
without breaking or having to update existing callsites, as long as the
newly added members default to compatible values.

`CreateDeclarativeRepo` is then reimplemented on top of the new
function. Callsites aren't updated yet, we can do that organically,
whenever touching code that uses the older function.

No new functionality is introduced just yet, this is merely a refactor.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:29:21 +02:00
Earl Warren ad7bf760ac Merge pull request '[v7.0/forgejo] [I18N] Fix tepository->repository typo' (#3581) from bp-v7.0/forgejo-5ed3ffc into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3581
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-01 07:36:46 +00:00
proton-ab d6597b8f7a [I18N] Fix tepository->repository typo
Signed-off-by: proton-ab <proton_ab@tuta.io>
(cherry picked from commit 5ed3ffc0c8)
2024-05-01 07:00:09 +00:00
Earl Warren 6069fcced6 Merge pull request '[v7.0/forgejo] Fix SQL command with too many placeholders' (#3578) from bp-v7.0/forgejo-33cd844-0d029eb into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3578
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 06:50:49 +00:00
Zettat123 4fa80332e9
Fix duplicate status check contexts (#30660) (#30779)
Backport #30660.

Caused by #30076.

There may be some duplicate status check contexts when setting status
checks for a branch protection rule. The duplicate contexts should be
removed.

Before:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/97f4de2d-4868-47a3-8a99-5a180f9ac0a3"
width="600px" />

After:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/ff7289c5-9793-4090-ba31-e8cb3c85f8a3"
width="600px" />

(cherry picked from commit 99e89e57bc4d2b3a3cd6c3068f818a0c7e8cec28)
2024-05-01 08:34:29 +02:00
6543 2da615c37c
Get repo assignees and reviewers should ignore deactivated users (#30770) (#30782)
Backport  #30770

If an user is deactivated, it should not be in the list of users who are
suggested to be assigned or review-requested.

old assignees or reviewers are not affected.

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit 022eac4ac8e59f861237cc1e02f7ef117eaf8e30)

Conflicts:
	models/repo/user_repo_test.go
	because there is one less fixture user compared to Gitea
2024-05-01 08:31:47 +02:00
wxiaoguang 78517f80bb
Fix nil dereference on error (#30740) (#30746)
Backport #30740 manually

Co-authored-by: Chongyi Zheng <git@zcy.dev>
(cherry picked from commit d07019f539c475466748fbf730d7f270a92fdb8b)
2024-05-01 08:14:16 +02:00
Earl Warren 16e7af48bd Merge pull request '[v7.0/forgejo] Fix user mention processing' (#3567) from bp-v7.0/forgejo-9a01062 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3567
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 05:37:13 +00:00
Gergely Nagy 275f5326a1 Performance improvement for FindReposLastestCommitStatuses
If `commitstatus_service.FindReposLastestCommitStatuses` receives no
repos in its params, short-circuit, and return early, without performing
any potentially expensive work.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 33cd8446d3)
2024-05-01 05:36:50 +00:00
Gergely Nagy dd8d3f5ebe Fix git_model.FindBranchesByRepoAndBranchName
When a logged in user with no repositories visits their dashboard, it will
display a search box that lists their own repositories.

This is served by the `repo.SearchRepos` handler, which in turn calls
`commitstatus_service.FindReposLastestCommitStatuses()` with an empty
repo list.

That, in turn, will call `git_model.FindBranchesByRepoAndBranchName()`,
with an empty map. With no map, `FindBranchesByRepoAndBranchName()` ends
up querying the entire `branch` table, because no conditions were set
up.

Armed with a gazillion repo & commit shas, we return to
`FindReposLastestCommitStatuses`, and promptly call
`git_model.GetLatestCommitStatusForPairs`, which constructs a monstrous
query with so many placeholders that the database tells us to go
somewhere else, and flips us off. At least on instances the size of
Codeberg. On smaller instances, it will eventually return, and throw
away all the data, and return an empty set, having performed all this
for naught.

We fix this by short-circuiting `FindBranchesByRepoAndBranchName`, and
returning fast if our inputs are empty.

A test case is included.

Fixes #3521.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 0d029ebe6d)
2024-05-01 05:36:50 +00:00
Otto 04ce562f62 Merge pull request 'Backport: Cumulative English locale improvements' (#3568) from 0ko/forgejo:i18n-backport-20240430 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3568
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: crystal <crystal@noreply.codeberg.org>
2024-04-30 22:38:06 +00:00
0ko 3178f1614a [I18N] Cumulative English locale improvements
- decap wiki UI
- decap release UI
- fix cap of self visibility toggle button on org member list
- simplify `release.add_tag`
- simplify `admin_indexer_commit_sha` (we got multiple hash types now, but this referes to commit)
- some improvements to admin dashboard
- fnetX suggestions: [[1]](https://codeberg.org/forgejo/forgejo/pulls/3266#issuecomment-1795685), [[2]](https://codeberg.org/forgejo/forgejo/pulls/3266#issuecomment-1795734)
2024-04-30 20:05:42 +05:00
Earl Warren a64e000e42 Merge pull request '[v7.0/forgejo] Fix colour contrast issues in forms' (#3553) from bp-v7.0/forgejo-03c1c88 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3553
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 14:07:35 +00:00
Earl Warren 86251afec6 Merge pull request '[v7.0/forgejo] UI: Disable internal wiki options when enabling external wiki' (#3550) from bp-v7.0/forgejo-103306f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3550
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
2024-04-30 14:06:37 +00:00
Earl Warren cfbc52921e Merge pull request '[v7.0/forgejo] fix: webhook: send short ref on gitea create/delete payload' (#3560) from bp-v7.0/forgejo-0d3a9e6-cb0f361 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3560
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:51:43 +00:00
Earl Warren 8915d65aa1 Merge pull request '[v7.0/forgejo] fix: webhook getPayloadBranch' (#3557) from bp-v7.0/forgejo-df06904-79380c2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3557
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:45:26 +00:00
Earl Warren f874c5e978 Merge pull request '[v7.0/forgejo] Choose better icon for Add more repo units suggestion' (#3552) from bp-v7.0/forgejo-a8211e0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3552
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 12:42:08 +00:00
Gergely Nagy 75aa4c28f0 Fix user mention processing
When mentioning a user, the markup post-processor did not handle the
case where the mentioned user did not exist well: it tried to skip to
the next node, which in turn, ended up skipping the rest of the line.

To fix this, lets skip just the mentioned, but non-existing user, and
continue processing the current node from there.

Fixes #3535.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 9a01062ae2)
2024-04-30 12:28:49 +00:00
Earl Warren c3e5e9ffb8 Merge pull request '[v7.0/forgejo] Fix toggling WIP state in PR footer' (#3551) from bp-v7.0/forgejo-900bf43 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3551
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 09:47:54 +00:00
oliverpool e97ffdae6f webhook: send short ref on gitea create/delete payload
(cherry picked from commit 0d3a9e6491)
2024-04-30 09:12:11 +00:00
oliverpool 67647d5f39 test: webhook gitea tag creation ref
(cherry picked from commit cb0f361171)
2024-04-30 09:12:10 +00:00
oliverpool b15d2a6bc7 webhook: fix getPayloadBranch
(cherry picked from commit df06904f4a)
2024-04-30 08:17:11 +00:00
oliverpool cd77a78a93 test: webhook fix branch filter tests
(cherry picked from commit 79380c209d)
2024-04-30 08:17:10 +00:00
Otto Richter a1496ec0bc Fix colour contrast issues
(cherry picked from commit 03c1c88b5b)
2024-04-30 05:49:30 +00:00
Codeberg Build Maintainers f69fc18980 CB/tmpl: Modify icon for add more button
(cherry picked from commit a8211e07d8)
2024-04-30 05:48:40 +00:00
Otto Richter 1241ac9da5 Fix PR WIP toggle prefixes
When the variable was renamed, this occurence was missed.

(cherry picked from commit 900bf43a8a)
2024-04-30 05:37:30 +00:00
Panagiotis "Ivory" Vasilopoulos 023cd2ee90 UI: Disable internal wiki options when enabling external wiki
Using "data-target", it is possible to set a value to a target element
that can enable it or disable it. Using "data-context" lets us perform
the opposite action on a different target.

Before, only the #external_wiki_box target was used, which was enabled
or disabled depending on whether the user has chosen to use the internal
wiki or the external wiki. If the user chooses to use the internal wiki,
they will disable the box that lets them enter a link pointing to an
external wiki, and vice versa. Although it is not possible to use, say,
boolean operations, we can introduce a target that is
called #globally_writeable_checkbox that gets enabled when
the #external_wiki_box box is disabled, and vice versa.

This makes the box's behavior more consistent with the behavior in the
"Issues" section. To keep things consistent with that section, a new
property was assigned to the "globally_writeable_checkbox" that makes
the box go a bit further in (`tw-pl-4`).

(cherry picked from commit 103306f00c)
2024-04-30 05:33:31 +00:00
Otto 54f875df46 Merge pull request '[v7.0/forgejo] Show repo activities even if only code unit active or git repo is empty but issue is active' (#3514) from bp-v7.0/forgejo-c54896b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3514
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
2024-04-29 21:41:09 +00:00
Earl Warren b7efd1e1da Merge pull request '[v7.0/forgejo] Fixes that the settings button moves in the overflow menu when the add more button is shown' (#3529) from bp-v7.0/forgejo-fb5e36b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3529
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
2024-04-29 12:15:33 +00:00
Beowulf 0b7e2ba549 Fixes that the settings button moves in the overflow menu
and the add more button is on the right

This fix moves the settings button back to the right and the add more
button back to the left.

(cherry picked from commit fb5e36bc6f)
2024-04-29 10:54:39 +00:00
Earl Warren f4a61b3299 Merge pull request '[v7.0/forgejo] replaced link to gitea docu' (#3515) from bp-v7.0/forgejo-10cd0f3 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3515
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-28 15:43:38 +00:00
Robin Kloppe 9df576d7b7 replaced link to gitea docu
(cherry picked from commit 10cd0f3992)
2024-04-28 14:27:11 +00:00
Beowulf 135764f244 Show repo activities even if only code unit active or git repo is empty but issue is active (#3455)
When all repository units are deactivated except for the code unit, the activity tab will not be shown.
Since the activities tab also shows contributing stats, it would be good to show the activities tab also when only code is active.
This commit changes the behavior when the activities tab is shown.
Previous it would only be shown when Issues, Pull-Requests or Releases are activated. Now it would additionally be shown when the code unit is activated.

Refs: #3429

| Before (Code + Issues - Owner) | Before (Code - Viewer) | After (Code + Issues - Owner) | After (Code - Viewer) |
| -- | -- | -- | -- |
| ![image](/attachments/2af997bc-1f38-48c6-bdf3-cfbd7087b220)  | ![image](/attachments/ef1797f0-5c9a-4a1a-ba82-749f3ab4f403) | ![image](/attachments/fd28a96c-04ca-407e-a70d-d28b393f223d) | ![image](/attachments/2cd0d559-a6de-4ca0-a736-29c5fea81b5a) |
|  | `/activity` returns 404 for everyone | ![image](/attachments/e0e97d8f-48cb-4c16-a505-1fafa46c4b8e)  | - |

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3455
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>
(cherry picked from commit c54896ba70)
2024-04-28 13:50:45 +00:00
Earl Warren 0160acbc05 Merge pull request '[v7.0/forgejo] Move settings button back to the right in repo and org header' (#3507) from bp-v7.0/forgejo-f9628f8 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3507
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-28 08:14:43 +00:00
Beowulf 5f5d66624e Move settings button back to the right in repo and org header
This will move the settings button back to the right, like known from
older versions.
For this, the overflow-menu was changed when a setting button is
available. If no settings button is available, the behavior will not
change.

Fixes #3301

(cherry picked from commit f9628f883d)
2024-04-28 06:21:47 +00:00
Earl Warren 6a3b0d1fc8 Merge pull request '[v7.0/forgejo] RELEASE Version Link Interface customization' (#3501) from bp-v7.0/forgejo-df8b1b5 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3501
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-27 21:01:17 +00:00
Robin Kloppe 7857b80373 RELEASE Version Link
(cherry picked from commit df8b1b5dd2)
2024-04-27 20:14:07 +00:00
Earl Warren 57cde25958 Merge pull request 'Backport translations update from Weblate (#3359)' (#3497) from 0ko/forgejo:i18n-backport-20240427 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3497
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-27 19:52:15 +00:00
Codeberg Translate 79a214668c [I18N] Translations update from Weblate (#3359)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: SteffoSpieler <SteffoSpieler@users.noreply.translate.codeberg.org>
Co-authored-by: Mylloon <Mylloon@users.noreply.translate.codeberg.org>
Co-authored-by: lucasmz <lucasmz@users.noreply.translate.codeberg.org>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: FunctionalHacker <FunctionalHacker@users.noreply.translate.codeberg.org>
Co-authored-by: owofied <furry@users.noreply.translate.codeberg.org>
Co-authored-by: Xinayder <Xinayder@users.noreply.translate.codeberg.org>
Co-authored-by: kecrily <kecrily@users.noreply.translate.codeberg.org>
Co-authored-by: ZilloweZ <ZilloweZ@users.noreply.translate.codeberg.org>
Co-authored-by: toasterbirb <toasterbirb@users.noreply.translate.codeberg.org>
Co-authored-by: Pi-Cla <Pi-Cla@users.noreply.translate.codeberg.org>
Co-authored-by: sinsky <sinsky@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@users.noreply.translate.codeberg.org>
Co-authored-by: 747 <747@users.noreply.translate.codeberg.org>
Co-authored-by: Quitaxd <Quitaxd@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3359
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-04-27 21:40:53 +05:00
Earl Warren 35790985d2 Merge pull request '[v1.22/gitea] week 2024-18 cherry pick v7.0' (#3483) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3483
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-27 10:13:24 +00:00
Earl Warren 554f3697fc Merge pull request '[v7.0/forgejo] docs(release-notes): 7.0.1' (#3489) from bp-v7.0/forgejo-a5df622 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3489
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-27 04:49:54 +00:00
Earl Warren 5793e8687f docs(release-notes): 7.0.1
(cherry picked from commit a5df622099)
2024-04-26 22:44:03 +00:00
Lunny Xiao 5fc96c0356
Fix wrong table name (#30557) (#30651)
Backport #30557

The table name should be `oauth2_application` but `o_auth2_application`

Caused by

https://github.com/go-gitea/gitea/pull/21316/files#diff-9610efbc608a41f1f2eaff5790423f0a187906f6ff0beb23a5e8d18366cc2ccfR38
(cherry picked from commit 5c12e794455fc2378d034addd9ee3581b55e6709)
2024-04-26 14:39:47 +02:00
Earl Warren af372ba127 Merge pull request '[v7.0/forgejo] fix: git.ComputeHash did not consider the content' (#3481) from bp-v7.0/forgejo-5247fd5-3dfa5ba into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3481
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-26 11:27:52 +00:00
Earl Warren 4288238b1e Merge pull request '[v7.0/forgejo] fix(lfs): gogit /settings/lfs/find 500 error' (#3479) from bp-v7.0/forgejo-c31ae1a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3479
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-26 11:01:07 +00:00
oliverpool fd59a255e6 fix: git.ComputeHash did not write the content
(cherry picked from commit 5247fd50db)
2024-04-26 10:27:01 +00:00
oliverpool a7570ce5ac test: LFS gc should not delete all metadata objects
and ComputeBlobHash should depend on the blob content (not only the
length)

(cherry picked from commit 3dfa5ba43a)
2024-04-26 10:27:01 +00:00
Earl Warren 8e304659c5 Merge pull request '[v7.0/forgejo] services/convert: Convert a Repository's ObjectFormatName too' (#3478) from bp-v7.0/forgejo-2385f3c into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3478
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-26 10:07:58 +00:00
Earl Warren e072201830 fix(lfs): gogit /settings/lfs/find 500 error (#3472)
Refs: https://codeberg.org/forgejo/forgejo/pulls/3448
Refs: https://codeberg.org/forgejo/forgejo/issues/3438
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3472
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
(cherry picked from commit c31ae1a651)
2024-04-26 09:48:22 +00:00
Earl Warren d58b74d368 Merge pull request '[v7.0/forgejo] [FIX] Set max fuzziness to 2 for bleve' (#3477) from bp-v7.0/forgejo-a641ebf into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3477
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-26 09:36:09 +00:00
Gergely Nagy 9860af7f39 services/convert: Convert a Repository's ObjectFormatName too
When converting a `repo_model.Repository` to `api.Repository`, copy the
`ObjectFormatName` field too.

Fixes #3458.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 2385f3c9db)
2024-04-26 08:55:40 +00:00
Shiny Nematoda 966975a3e0 [FIX] Set max fuzziness to 2 for bleve (#3444)
closes #3443

regression from ab5f0b7558

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3444
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
(cherry picked from commit a641ebf221)
2024-04-26 08:29:21 +00:00
Earl Warren 9cd8cd4874 Merge pull request '[v7.0/forgejo] docs: contributing: avoid information duplication' (#3457) from bp-v7.0/forgejo-ad9872d into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3457
Reviewed-by: Otto <otto@codeberg.org>
2024-04-26 06:55:37 +00:00
Earl Warren 1040683676 Merge pull request 'docs(release-notes): 7.0.0 LFS garbage collection and workaround' (#3471) from earl-warren/forgejo:wip-release-notes-v7.0.1 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3471
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-26 06:44:51 +00:00
Earl Warren a37836f228
docs(release-notes): 7.0.0 LFS garbage collection and workaround
Refs: https://codeberg.org/forgejo/forgejo/issues/3438
2024-04-26 08:09:04 +02:00
Earl Warren 5083ea72fb [v7.0/forgejo] fix(ui): /settings/lfs/find 500 error (#3451)
When in the repository settings, visiting

- `LFS` to `/{owner}/{repo}/settings/lfs`
- `Find pointer files` to `/{owner}/{repo}/settings/lfs/pointers`
- `Find commits` to `/{owner}/{repo}/settings/lfs/find?oid=...`

failed with an error 500 because of an incorrect evaluation of the
template.

Regression introduced by
cbf923e87b

A test is added to visit the page and guard against future
regressions.

Refs: https://codeberg.org/forgejo/forgejo/issues/3438
(cherry picked from commit 078229a5e4)

Also has a backport of https://codeberg.org/forgejo/forgejo/pulls/3465/files to ensure the test fails.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3451
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2024-04-25 21:46:25 +00:00
Nicolas CARPi f2628f91fe docs: contributing: avoid information duplication (#3454)
The file CONTRIBUTING.md contains a list of links that points to
different parts of the developer documentation.

Unfortunately, this list is now incomplete and contains a dead link for the
Developer Workflow.

Given that a more complete similar list is present at:
https://forgejo.org/docs/latest/developer/, this patch removes the
duplication of information, which leads to dead links and
maintenance burden, and replaces the list with simply a link to the page
that has all the current links.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3454
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Nicolas CARPi <nico-git@deltablot.email>
Co-committed-by: Nicolas CARPi <nico-git@deltablot.email>
(cherry picked from commit ad9872d884)
2024-04-25 19:13:36 +00:00
Earl Warren 5f0ae00efc Merge pull request '[v7.0/forgejo] Fix Repository icon, name and label not centered vertically' (#3453) from bp-v7.0/forgejo-a278e92 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3453
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-25 17:15:20 +00:00
Beowulf cbc9567f1d Fix Repository icon, name and label not centered vertically
Readded correct tailwind class for vertical centering

Regression introduced by 65e190ae8b

Fixes #3428.

(cherry picked from commit a278e925a1)
2024-04-25 16:23:36 +00:00
Earl Warren 7e3ff68ba9 Merge pull request '[v7.0/forgejo] fix(cli): admin user create first user never require a password change' (#3435) from bp-v7.0/forgejo-ec33423-b9424e6-eb74846 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3435
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-24 23:19:39 +00:00
Earl Warren a1f29d9a0e fix(cli): admin user create first user never require a password change
Fixes: https://codeberg.org/forgejo/forgejo/issues/3399
(cherry picked from commit ec334239e0)
2024-04-24 22:26:37 +00:00
Earl Warren 21a853aac7 test(cli): admin user change-password --must-change-password
(cherry picked from commit b9424e634f)
2024-04-24 22:26:37 +00:00
Earl Warren 8b4ca4501a test(cli): admin user create and must change password value
(cherry picked from commit eb74846d7d)
2024-04-24 22:26:37 +00:00
Earl Warren c932519946 Merge pull request '[v7.0/forgejo] fix(docs): v7.0.0 admin user create regression (take2)' (#3420) from bp-v7.0/forgejo-b127b24 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3420
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-24 22:06:46 +00:00
0ko b248181a99 Merge pull request '[v7.0/forgejo] UI: fix rounding of vertical menus on /issues, /pulls' (#3422) from bp-v7.0/forgejo-0956415 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3422
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-04-24 18:44:39 +00:00
0ko 87545c721b UI: fix rounding of vertical menus on /issues, /pulls
(cherry picked from commit 0956415707)
2024-04-24 15:39:52 +00:00
Earl Warren b47f7a80cf fix(docs): v7.0.0 admin user create regression (take2)
The scope of the regression is limited to the first created user when
it is not an admin.

Refs: https://codeberg.org/forgejo/forgejo/issues/3399
(cherry picked from commit b127b24f02)
2024-04-24 15:05:42 +00:00
Earl Warren d01fc3e2f5 Merge pull request '[v7.0/forgejo] fix(docs): v7.0.0 admin user create regression' (#3417) from bp-v7.0/forgejo-4b57362 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3417
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-24 15:04:12 +00:00
Earl Warren bdfca7c00d fix(docs): v7.0.0 admin user create regression
The tests in Forgejo extensively rely on admin user create to create
the first admin user. This regression was not noticed because it
is an exception and a password change will not be required.

Refs: https://codeberg.org/forgejo/forgejo/issues/3399
(cherry picked from commit 4b57362056)
2024-04-24 14:05:12 +00:00
Earl Warren f341942feb Merge pull request '[v7.0/forgejo] feat(docs): 7.0.1 release notes template' (#3408) from bp-v7.0/forgejo-a760278 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3408
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-24 08:18:47 +00:00
Earl Warren 85a73553c9 feat(docs): 7.0.1 release notes template
so that individual commits can include additions to the release notes
when relevant.

(cherry picked from commit a7602781c4)
2024-04-24 07:26:20 +00:00
Earl Warren a134c0f172 Merge pull request 'fix(docs): backport v7.0.0 release notes' (#3405) from earl-warren/forgejo:wip-release-notes-v7.0.1 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3405
2024-04-24 07:17:11 +00:00
Earl Warren f5d9d8cbd4
fix(docs): backport v7.0.0 release notes
The v7.0 branch should have the v7.0 release notes.
2024-04-24 08:24:28 +02:00
Earl Warren 73c190af4c Merge pull request '[v7.0/forgejo] Fix the WIP prefix toggling on the sidebar' (#3390) from bp-v7.0/forgejo-a93a99e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3390
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-23 08:42:03 +00:00
Gergely Nagy e947fa7acc Fix the WIP prefix toggling on the sidebar
The WIP prefix toggling link on the sidebar only supported toggling
the *first* prefix specified in
`[repository.pullrequest].WORK_IN_PROGRESS_PREFIXES`. If the pull
request had a title with any other prefix, the first prefix listed in
the config was added (and then removed on toggling it off).

This little change makes all of the prefixes available for the
JavaScript function that does the toggling, and changes said function to
find the used prefix first, and toggle that.

When adding the prefix, it will still default to adding the first one
listed in the configuration, but it will happily remove any others if
those are present.

Fixes #3377.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit a93a99eef3)
2024-04-23 08:01:58 +00:00
Earl Warren bbd204c30c Merge pull request '[v7.0/forgejo] fix(incoming): allow replies to comments' (#3382) from bp-v7.0/forgejo-5428531 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3382
2024-04-22 23:46:52 +00:00
Earl Warren f58e0d8617 fix(incoming): allow replies to comments
- allow attachments to code comments
- incoming mails from issue comments are now identified as comments

Fixes: https://codeberg.org/forgejo/forgejo/issues/3374
(cherry picked from commit 54285319f6)
2024-04-22 22:43:16 +00:00
Earl Warren 9eaabc077a Merge pull request '[v7.0/forgejo] Fix dropdown text ellipsis (#30628) (#30633)' (#3373) from bp-v7.0/forgejo-112df5a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3373
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-22 20:12:25 +00:00
wxiaoguang 196cef0221 Fix dropdown text ellipsis (#30628)
Follow
https://github.com/go-gitea/gitea/pull/30547#discussion_r1573866519

Fix #30624

The Fomantic UI Dropdown wasn't designed to work that way, its "text"
element might contain images. So the "overflow" shouldn't be added to
any general dropdown text.

![image](https://github.com/go-gitea/gitea/assets/2114189/f6ceaabd-bc89-4bf2-baa2-a6f0324c1962)

(cherry picked from commit 1e4867730b261352d63098b85cf53ca05867c8c2)
(cherry picked from commit 112df5a3fe)
2024-04-22 19:31:26 +00:00
Earl Warren 8859a7f1a7 Merge pull request '[v7.0/forgejo] Accessibility improvements to code review' (#3368) from bp-v7.0/forgejo-87d4746-187e10d into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3368
Reviewed-by: Otto <otto@codeberg.org>
2024-04-22 17:00:42 +00:00
Earl Warren 7316f23265 Merge pull request '[v7.0/forgejo] s/Gitea/Forgejo in various log messages and comments' (#3367) from bp-v7.0/forgejo-469c214 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3367
2024-04-22 15:37:10 +00:00
Otto Richter 4eefb64b12 Rename button to "Finish Review"
Motivation: The meaning of the button is apparent from the visual
position and the number icon. This is not exposed to a screenreader.
Naming it to "Finish Review" helps with to provide the meaning of the
button as well as the number in the label.

(cherry picked from commit 87d4746f5e)
2024-04-22 14:54:19 +00:00
Otto Richter 81cc944cda Fix unlabelled button in code review
(cherry picked from commit 187e10d8c9)
2024-04-22 14:54:19 +00:00
0ko c7ba51518c s/Gitea/Forgejo in various log messages and comments
(cherry picked from commit 469c214ec8)
2024-04-22 14:41:17 +00:00
Earl Warren 4433cd9793 Merge pull request '[v1.22/gitea] week 2024-17 cherry pick v7.0' (#3354) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3354
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-22 09:55:54 +00:00
Earl Warren 792764456c Merge pull request '[v7.0/forgejo] [PORT] gitea#30546: Add form field id generation, remove duplicated ids' (#3362) from bp-v7.0/forgejo-a01387f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3362
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-22 08:15:26 +00:00
silverwind 2072ff75e8 Add form field id generation, remove duplicated ids (#30546)
Fixes: https://github.com/go-gitea/gitea/issues/30384

On repo settings page, there id `repo_name` was used 5 times on the same
page, some in modal and such. I think we are better off just
auto-generating these IDs in the future so that labels link up with
their form element.

Ideally this id generation would be done in backend in a subtemplate,
but seeing that we already have similar JS patches for checkboxes, I
took the easy path for now.

I also checked that these `#repo_name` were not in use in JS and the
only case where this id appears in JS is on the migration page where
it's still there.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit d4ec6b3d16496ce3b479d5a08f79823122dc2b7b)

Conflicts:
	- templates/repo/settings/options.tmpl
	  Conflict resolved by manually removing all `id` and `for`
	  attributes from elements that had `repo_name` as their id.
(cherry picked from commit a01387f5b1)
2024-04-22 07:46:30 +00:00
Earl Warren eefa820874
[DEADCODE] update 2024-04-21 18:44:11 +02:00
Giteabot 4777ba210f
Fix package list performance (#30520) (#30616)
Backport #30520 by @KN4CK3R

Fixes #28255

The new query uses the id field to sort by "newer". This most not be
correct (usually it is) but it's faster (see #28255).
If someone has a better idea, please propose changes.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit ea2ea8ef28b6a2207ec00bafaf42d428612d69eb)
2024-04-21 18:19:06 +02:00
yp05327 0a9bbdcfef
Use action user as the trigger user of schedules (#30581)
Follow https://github.com/go-gitea/gitea/pull/30357

When user push to default branch, the schedule trigger user will be the
user.
When disable then enable action units in settings, the schedule trigger
user will be action user.
When repo is a mirror, the schedule trigger user will be action user. (
before it will return error, fixed by #30357)

As scheduled job is a cron, the trigger user should be action user from
Gitea, not a real user.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit cb6814adad4dc81a683b50826a211ce7bce731d7)

Conflicts:
	- services/actions/notifier_helper.go
	  Conflict resolved by keeping Forgejo's version of the line.
(cherry picked from commit 829c3c6838)
2024-04-21 18:17:35 +02:00
Giteabot d802a8c0cf
Fix HEAD method for robots.txt (#30603) (#30605)
Backport #30603 by @wxiaoguang

Fix #30601

```
~$ curl --head localhost:3000/robots.txt
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 5
Content-Type: text/plain; charset=utf-8
Last-Modified: Wed, 19 Jul 2023 04:56:12 GMT
X-Gitea-Debug: RUN_MODE=dev
Date: Fri, 19 Apr 2024 12:59:44 GMT
```

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 7eaf7907d7f71e103baced018e6eeb271085789d)
2024-04-21 18:16:38 +02:00
Giteabot 0412657132
Avoid importing modules/web/middleware in modules/session (#30584) (#30589)
Backport #30584 by @wolfogre

Related to #30375.

It doesn't make sense to import `modules/web/middleware` and
`modules/setting` in `modules/web/session` since the last one is more
low-level.

And it looks like a workaround to call `DeleteLegacySiteCookie` in
`RegenerateSession`, so maybe we could reverse the importing by
registering hook functions.

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit 199397a852ec2d45524cefcc3c119fce4710560e)
2024-04-21 18:16:09 +02:00
Giteabot f31879069f
Improve "Reference in new issue" modal (#30547) (#30574)
Backport #30547 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/29994

Also some misc enhancements done to the form in the modal.

<img width="840" alt="Screenshot 2024-04-17 at 23 02 55"
src="https://github.com/go-gitea/gitea/assets/115237/e71fba55-55cd-4e48-a497-6b1025c36a43">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 42019677e6cce6ae44a922e68b91d2a002450fa0)
2024-04-21 18:15:19 +02:00
Jerry Jacobs 6ad7758117
Fixup app.example.ini for task section, which is now queue.task (#30555)
Config section `[task]` has been deprecated in favor of `[queue.task]`

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 86d4c8a4662e9ab49888569d77529d2d22292e6b)

Conflicts:
	- docs/content/administration/config-cheat-sheet.en-us.md
	- docs/content/administration/config-cheat-sheet.zh-cn.md
	  Removed, they're Gitea specific.
(cherry picked from commit 5271792666)
2024-04-21 18:14:45 +02:00
Giteabot 1d8316f278
Fix border-radius on view, blame and code search (#30545) (#30560)
Backport #30545 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/30540

1. Fix all these boxes by adding `bottom attached` and removing a
problematic CSS rule:

<img width="1319" alt="Screenshot 2024-04-17 at 22 25 31"
src="https://github.com/go-gitea/gitea/assets/115237/346445a4-4944-4003-a1ef-6f5b0eda624e">
<img width="643" alt="Screenshot 2024-04-17 at 22 21 18"
src="https://github.com/go-gitea/gitea/assets/115237/10f17ed3-9ad6-48de-92fa-bac6621815b9">

2. Change the "last commit" box to `ui segment` which has correct
border-radius. Also included is a tiny tweak to make author name ellipse
instead of wrap.

<img width="1331" alt="Screenshot 2024-04-17 at 22 23 23"
src="https://github.com/go-gitea/gitea/assets/115237/285fbd45-ced0-4d33-abe3-7384ffa03188">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit b4a38318c333519b1008d03fd01e14a803363498)
2024-04-21 18:11:36 +02:00
Giteabot cb4246ed57
Disable enter key for accepting code completion in Monaco (#30548) (#30559)
Backport #30548 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit c9633f2d74490211ffd9fd6b3a17180e86fa1fb9)
2024-04-21 18:11:02 +02:00
Giteabot f436cb86d4
Fix branch_protection api shows users/teams who has no readAccess (#30291) (#30544)
Backport #30291 by @edwardzhanged

Add some logic in `convert.ToBranchProtection` to return only the names
associated with readAccess instead of returning all names. This will
ensure consistency in behavior between the frontend and backend.
Fixes: #27694

Co-authored-by: Edward Zhang <45360012+edwardzhanged@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: wenzhuo.zhang <wenzhuo.zhang@geely.com>
(cherry picked from commit d88958bb99eabc07dead6965e396755e7b6d947f)
2024-04-21 18:10:34 +02:00
silverwind d6689b88a8
Run go generate and go vet on all packages (#30529)
Fixes: https://github.com/go-gitea/gitea/issues/30512

I think this does mean those tools would run on a potential `vendor`
directory, but I'm not sure we really support vendoring of dependencies
anymore.

`release` has a `vendor` prerequisite so likely the source tarballs
contain vendor files?

(cherry picked from commit 8e12ef911a1d10dedb03e3127c42ca76f9850aca)

Conflicts:
	- Makefile
	  Manually adjusted the changes.
(cherry picked from commit 3918db10c8)
2024-04-21 18:09:48 +02:00
Giteabot 141efd58df
Fix install page checkboxes and dropdown width (#30526) (#30538)
Backport #30526 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/30523

1. Fix checkbox rendering:

<img width="406" alt="Screenshot 2024-04-16 at 21 37 03"
src="https://github.com/go-gitea/gitea/assets/115237/42df99b0-58c7-47d1-b99d-0c15250560c7">

2. Fix width of selection dropdowns (was too small):

<img width="826" alt="Screenshot 2024-04-16 at 21 37 09"
src="https://github.com/go-gitea/gitea/assets/115237/e006d0d6-ac3d-4804-94de-b2c3c8a5900d">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit caeed3af6ea239541d0f319c1f2da8233e04b173)
2024-04-21 18:08:51 +02:00
Giteabot 6724373288
Tweak and fix toggle checkboxes (#30527) (#30531)
Backport #30527 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/30524. Slightly restyled
them so that the "knob" is contained inside the background.

<img width="179" alt="Screenshot 2024-04-16 at 21 58 09"
src="https://github.com/go-gitea/gitea/assets/115237/be94517b-9cb7-46e2-ae96-fcf6767ce4ba">
<img width="187" alt="Screenshot 2024-04-16 at 21 58 50"
src="https://github.com/go-gitea/gitea/assets/115237/c13a1959-5c5a-4e88-9225-e5f6fb72e3e0">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit d5525b714322bf8a39334b045dffe368c6207e01)
2024-04-21 18:08:18 +02:00
Giteabot 9de4bebbf7
Fix empty field login_name in API response JSON when creating user (#30511) (#30516)
Backport #30511 by @yp05327

Fix #30508

ps: if `sourceID` is not set, `LoginName` will be ignored

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit f9a025f6a358aa6e34408743a59f5081f397d47c)
2024-04-21 18:07:51 +02:00
Giteabot c044cb2de3
Fix various overflows on actions view (#30344) (#30505)
Backport #30344 by @silverwind

Fix a number of text overflow issues in actions view and run list. Also
improve mobile view of run list.

Fixes: https://github.com/go-gitea/gitea/issues/30328

<img width="782" alt="Screenshot 2024-04-08 at 23 10 16"
src="https://github.com/go-gitea/gitea/assets/115237/3d9f9f88-3eab-44a0-8144-30c2b58b24cb">
<img width="935" alt="Screenshot 2024-04-08 at 23 17 46"
src="https://github.com/go-gitea/gitea/assets/115237/581d73ea-a31d-416b-be3a-47313b879b12">
<img width="1008" alt="Screenshot 2024-04-08 at 23 49 05"
src="https://github.com/go-gitea/gitea/assets/115237/c5d10565-f285-477f-8659-1caf94797647">
<img width="397" alt="Screenshot 2024-04-08 at 23 55 30"
src="https://github.com/go-gitea/gitea/assets/115237/368aaa75-1903-4058-9d75-d1fe91c564d6">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 00179f637d9add4e42edf6185cd641eb98115970)
2024-04-21 18:07:00 +02:00
Giteabot 889469fb74
Convert max file name length to 255 (#30489) (#30504)
Backport #30489 by @yp05327

Quick/Partly fix #29907

In Linux and MacOS, by default the max file name length is 255.
In windows, it depends on the version and settings, and has no file name
length limitation, but has path length limitation.
By default it is 260, considering path length is longer than filename,
so I think it is ok to do this.

For Windows, see
https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
For Linux, see
https://github.com/torvalds/linux/blob/master/include/uapi/linux/limits.h#L12-L13
For MacOS, see
https://discussions.apple.com/thread/254788848?sortBy=best

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit f52b1db305f887c917e6c875b8ac4f8b784b825b)
2024-04-21 18:06:23 +02:00
Lunny Xiao 05523fc96f
Fix commit status cache which missed target_url (#30426) (#30444)
Fix #30421
Backport #30426

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit 7ffc0acc424b3116e1a478962b3ea51611c710e3)

Conflicts:
	services/repository/commitstatus/commitstatus.go
	resolved in the same way as https://codeberg.org/forgejo/forgejo/pulls/3245/files#diff-1122f6e98dabe36f18c4ec06bce75fc9a799d83c
2024-04-21 18:02:50 +02:00
Giteabot ce31e611e2
Fix overflow on issue dependency (#30484) (#30494)
Backport #30484 by @silverwind

Small tweak here to prevent this and likely other events from
overflowing in the timeline:

<img width="895" alt="Screenshot 2024-04-14 at 22 53 17"
src="https://github.com/go-gitea/gitea/assets/115237/001b4f6b-f649-44ff-b2f0-c8e0dedeb384">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 2efc81d200106cd8707dae1a1bf50ea586b4c846)
2024-04-21 17:45:36 +02:00
wxiaoguang 55447525f6
Improve "must-change-password" logic and document (#30472)
Unify the behaviors of "user create" and "user change-password".

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 4c6e2da088cf092a9790df5c84b7b338508fede7)

Conflicts:
	- cmd/admin_user_create.go
          Resolved by favoring Gitea's version of the conflicting areas.
	- docs/content/administration/command-line.en-us.md
          Removed, Gitea specific.
(cherry picked from commit b122c6ef8b)
2024-04-21 17:44:11 +02:00
Giteabot 65ba5b924f
fix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30469)
Backport #30375 by @jtran

Cookies may exist on "/subpath" and "/subpath/" for some legacy reasons
(eg: changed CookiePath behavior in code). The legacy cookie should be
removed correctly.

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Kyle D <kdumontnu@gmail.com>
(cherry picked from commit e64926c5193e9ccc30b34f187d96c74d104179ae)
2024-04-21 17:39:14 +02:00
0ko b4ccfe1bc5 Merge pull request 'Backport Translations update from Weblate (#3244)' (#3352) from 0ko/forgejo:i18n-backport-20240421 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3352
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-21 14:51:35 +00:00
Codeberg Translate 2c6fa1efd0 [I18N] Translations update from Weblate (#3244)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Justman10000 <Justman10000@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: fnetX <otto@codeberg.org>
Co-authored-by: EssGeeEich <EssGeeEich@users.noreply.translate.codeberg.org>
Co-authored-by: Zughy <Zughy@users.noreply.translate.codeberg.org>
Co-authored-by: Xinayder <Xinayder@users.noreply.translate.codeberg.org>
Co-authored-by: m0s <m0s@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3244
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-04-21 19:19:54 +05:00
Earl Warren f569f4f5dc Merge pull request '[v7.0/forgejo] cleanup(tests): remove manual testing submodule' (#3348) from bp-v7.0/forgejo-69c6141 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3348
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-21 09:15:30 +00:00
Earl Warren a1f56a159b cleanup(tests): remove manual testing submodule
It is not effective, a different approach is needed

(cherry picked from commit 69c614162f)
2024-04-21 08:46:56 +00:00
Earl Warren b349f82a62 Merge pull request '[v7.0/forgejo] Fix some edge cases with permalink rendering' (#3341) from bp-v7.0/forgejo-acfae43-e9eacde-5b6b3f3 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3341
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-20 11:09:20 +00:00
Mai-Lapyst 9641273b2b Fix panic where now a third link breaks everything
(cherry picked from commit acfae43253)
2024-04-20 10:24:54 +00:00
Mai-Lapyst ae0615561a Fix issue where rendering stops after the first invalid parmalink
(cherry picked from commit e9eacdecd2)
2024-04-20 10:24:54 +00:00
Mai-Lapyst 9c81060eb9 Fix some edge cases; closes #3232
- Fixes wrong usage of AppURL
- Fixes wrong rendering with extra path segments when AppSubURL is empty
- Now also renders all links when 2+ permalinks are present

(cherry picked from commit 5b6b3f3fb3)
2024-04-20 10:24:54 +00:00
Earl Warren 25ddcd4b40 Merge pull request '[v7.0/forgejo] hooks: Harden when we accept push options that change repo settings' (#3338) from bp-v7.0/forgejo-8eba631 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3338
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-20 10:17:49 +00:00
Gergely Nagy aacc13fca8 hooks: Harden when we accept push options that change repo settings
It is possible to change some repo settings (its visibility, and
template status) via `git push` options: `-o repo.private=true`, `-o
repo.template=true`.

Previously, there weren't sufficient permission checks on these, and
anyone who could `git push` to a repository - including via an AGit
workflow! - was able to change either of these settings. To guard
against this, the pre-receive hook will now check if either of these
options are present, and if so, will perform additional permission
checks to ensure that these can only be set by a repository owner or
an administrator. Additionally, changing these settings is disabled for
forks, even for the fork's owner.

There's still a case where the owner of a repository can change the
visibility of it, and it will not propagate to forks (it propagates to
forks when changing the visibility via the API), but that's an
inconsistency, not a security issue.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Signed-off-by: Earl Warren <contact@earl-warren.org>
(cherry picked from commit 8eba631f8d)
2024-04-20 05:58:39 +00:00
Earl Warren 67232bd44e Merge pull request '[backport] gitea#30406: Check the token's owner and repository when registering a runner' (#3262) from algernon/forgejo:backport/3257-to-7.0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3262
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-19 15:41:18 +00:00
Earl Warren 129e91956e Merge pull request '[v7.0/forgejo] services: Use proper Message-IDs for release mails' (#3326) from bp-v7.0/forgejo-b0c0167 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3326
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-19 15:40:20 +00:00
Earl Warren bc1f64e3bf Merge pull request '[v7.0/forgejo] [TEST] cancel all processes on PrepareTestEnv' (#3130) from bp-v7.0/forgejo-8ffaa08-aba99ab into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3130
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-19 15:39:36 +00:00
Earl Warren 2f54b76c5c
fix(tests): 30s to cancel processes to avoid false negatives
on slower machines it can take more than 1 second to cancel leftover
tasks

(cherry picked from commit 6316e21be2)
2024-04-19 17:04:53 +02:00
0ko 59cfbf2070 Merge pull request '[v7.0/forgejo] Remove EasyMDE from various areas' (#3331) from bp-v7.0/forgejo-089e370-703aee4-f5c7cca into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3331
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-19 14:25:39 +00:00
0ko ae128c617b Add integration test for EasyMDE button
(cherry picked from commit 089e37026f)
2024-04-19 13:49:21 +00:00
0ko 99effab1eb Remove EasyMDE from various areas
Ref https://codeberg.org/forgejo/forgejo/issues/2831

Removed from:
- form for creating comment
- form for updating comment
- popup reviewing form
- line reviewing form
- I did not check the use of textarea.tmpl but I belive its used for issue templates, so also removed
- I did not check the use of box.tmpl, could not get any comments on compare

EasyMDE is left for these pages:
- release notes editor
- wiki editor

(cherry picked from commit 703aee4cad)
2024-04-19 13:49:20 +00:00
0ko 4b0e8f227d Make display of EasyMDE in UI optional to template
This commit adds EasyMDE field to combomarkdowneditor, as well as to all its calls.

(cherry picked from commit f5c7ccaeff)
2024-04-19 13:49:20 +00:00
Earl Warren 7784a6c331 Merge pull request '[v7.0/forgejo] Fix release published actions not triggering for releases created from existing tags' (#3273) from bp-v7.0/forgejo-8506dbe-46977b0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3273
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-04-19 12:51:01 +00:00
Gergely Nagy 405162178b services: Use proper Message-IDs for release mails
When sending notification emails about a release, use a properly
formatted, RFC-compliant message id, rather than the release's HTML URL
wrapped in angle brackets (which would not be compliant).

Fixes #3105.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit b0c0167c54)
2024-04-19 08:42:18 +00:00
Earl Warren 4db1b2fb96 Merge pull request '[v7.0/forgejo] fix(release): add missing ARG RELEASE_VERSION' (#3292) from bp-v7.0/forgejo-97189d4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3292
2024-04-17 16:48:51 +00:00
Earl Warren c8017a2853 fix(release): add missing ARG RELEASE_VERSION
The ARG RELEASE_VERSION set in the build-env image does not propagate
to the images that follow. As a result the value of the version label
is always empty.

This should have been caught by the test in the CI but although it
notified the problem in the output, it did not fail. Upgrade to the
forgejo-build-publish version that fixes this false positive.

(cherry picked from commit 97189d41f3)
2024-04-17 16:06:43 +00:00
Earl Warren d81a814fe5 Merge pull request '[v7.0/forgejo] Allow admins to fork repos even when creation limits are exhausted' (#3282) from bp-v7.0/forgejo-ea4071c into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3282
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-17 10:17:50 +00:00
Earl Warren 8956825bac Merge pull request '[v7.0/forgejo] feat(release): add OCI labels to container images' (#3281) from bp-v7.0/forgejo-028d19c into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3281
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-17 06:33:31 +00:00
Gergely Nagy 261fc87673 Allow admins to fork repos even when creation limits are exhausted (#3277)
This is a continuation of #2728, with a test case added.

Fixes #2633.

I kept @zareck 's commit as is, because I believe it is correct. We can't move the check to `owner.CanForkRepo()`, because `owner` is the future owner of the forked repo, and may be an organization. We need to check the admin permission of the `doer`, like in the case of repository creation.

I verified that the test fails without the `ForkRepository` change, and passes with it.

Co-authored-by: Cassio Zareck <cassiomilczareck@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3277
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Co-committed-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit ea4071ca9f)
2024-04-17 06:06:48 +00:00
Earl Warren 989d35d748 feat(release): add OCI labels to container images
(cherry picked from commit 028d19c0fe)
2024-04-17 05:48:38 +00:00
Laura Hausmann 145cac0865 Add tests for webhook release events
Co-authored-by: oliverpool <git@olivier.pfad.fr>
(cherry picked from commit 8506dbe2e5)
2024-04-16 18:28:54 +00:00
Laura Hausmann ee500dacd0 Fix release published actions not triggering for releases created from existing tags
(cherry picked from commit 46977b0f01)
2024-04-16 18:28:53 +00:00
0ko 515d71bffa Merge pull request '[v7.0/forgejo] [BUG] Escape editor.add_tmpl translation' (#3272) from bp-v7.0/forgejo-a0f47b8 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3272
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-16 18:04:47 +00:00
Gusted 0f72cd8508 [BUG] Escape editor.add_tmpl translation
- Previously translations were escaped, but now translations are
accepted as-is and will be rendered as HTML. Use `TrString` to escape
the translation value.
- Adds integration test.
- Regression of 65248945c9.
- Resolves #3260

(cherry picked from commit a0f47b8de7)
2024-04-16 16:23:25 +00:00
Earl Warren 430083ba46 Merge pull request '[v7.0/forgejo] [BUG] Fix styling of close button' (#3271) from bp-v7.0/forgejo-7fcb9c3 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3271
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-16 16:18:56 +00:00
Gusted a1bba9c547 [BUG] Fix styling of close button
- This is a partial revert of c2280a2009,
it was already fixed upstream, but not for the `.basic` variant.
- Resolves #3252

(cherry picked from commit 7fcb9c3636)
2024-04-16 15:20:43 +00:00
Zettat123 1173663f17
Check the token's owner and repository when registering a runner (#30406)
Fix #30378

(cherry picked from commit 0fe9f93eb4c94d55e43b18b9c3cc6d513a34c0b5)

Conflicts:
	- models/organization/org.go
	- services/repository/delete.go
	- services/user/delete.go
	In all three cases, conflicts were resolved by manually adding
        the lines added by the Gitea patch, keeping the Forgejo code
        surrounding them.
2024-04-16 11:43:08 +02:00
Earl Warren 335abbbc9d Merge pull request '[v1.22/gitea] week 16 cherry pick to v7.0' (#3235) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3235
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-16 09:31:46 +00:00
Earl Warren 3fb1036156 Merge pull request '[v7.0/forgejo] [BUG] Use correct empty commit ID' (#3255) from bp-v7.0/forgejo-eeaef55 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3255
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-16 08:42:47 +00:00
Earl Warren 9f192dc2e5 Merge pull request '[v7.0/forgejo] [BUG] Fix archive button on release page' (#3254) from bp-v7.0/forgejo-39c3295 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3254
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-16 08:42:05 +00:00
Earl Warren f83e55b1ca Merge pull request '[v7.0/forgejo] Some NuGet package enhancements' (#3256) from bp-v7.0/forgejo-2e613ad into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3256
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-04-16 08:41:03 +00:00
oliverpool 8f06a99c2c
[TEST] make the indexer and pull tasks cancellable (without shutdown)
See
https://codeberg.org/forgejo/forgejo/pulls/3130#issuecomment-1763440
for the conflict resolution.

(cherry picked from commit d79690ce18)
2024-04-16 10:37:59 +02:00
Earl Warren ec6b255c2c
[TESTS] disable test failure on log.Error for now (part 2)
Fixes: https://codeberg.org/forgejo/forgejo/issues/3153
(cherry picked from commit fd62033b98)
2024-04-16 10:28:48 +02:00
oliverpool dd474b72df
add missing defer
(cherry picked from commit 8ffaa08b04)
2024-04-16 10:28:48 +02:00
oliverpool 569b73e495
[TEST] cancel all processes on PrepareTestEnv
(cherry picked from commit aba99ab8fc)
2024-04-16 10:28:48 +02:00
Michael Kriese a1716fcdfc Some NuGet package enhancements
- https://github.com/go-gitea/gitea/pull/30280

(cherry picked from commit 2e613ad5e7)
2024-04-16 06:54:35 +00:00
Gusted ef0ce374a5 [BUG] Use correct empty commit ID
- `RemoveFilesFromIndex` used an hardcoded empty commit ID for the SHA1
object format, this would result in an error if the repository was
initialized to use the sha256 object format. Get the object format of
the Git repository and use that to get the empty commit id.
- Adds unit test.
- Resolves #3184

(cherry picked from commit eeaef556c2)
2024-04-16 06:47:31 +00:00
Gusted 757b7bd462 [BUG] Fix archive button on release page
- Add another selector to the list, which corresponds to the container
of the archive buttons on the release page of an repository.
- Seems like that 8d2b764607 missed
another case.
- Resolves #3180

(cherry picked from commit 39c3295f68)
2024-04-16 06:24:39 +00:00
0ko 2879c15858 Merge pull request '[v7.0/forgejo] Improve English locale' (#3241) from bp-v7.0/forgejo-3b23633 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3241
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-16 04:49:37 +00:00
0ko a0a6eb6c5c Merge pull request '[v7.0/forgejo] Translations update from Weblate' (#3240) from 0ko/forgejo:v7-backport-weblate-240415 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3240
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-16 04:47:56 +00:00
Earl Warren ee749c7916 Merge pull request '[v7.0/forgejo] fix(actions): call automerge service on successful commit state' (#3238) from bp-v7.0/forgejo-36f4732 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3238
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-04-15 17:52:36 +00:00
0ko 74bc9e666f [I18N] Improve English locale
- user settings/profile: renamed Description fild of biography to Biography

(cherry picked from commit 3b23633721)
2024-04-15 17:50:01 +00:00
Codeberg Translate 487242e043 [I18N] Translations update from Weblate (#3138)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: WithLithum <WithLithum@users.noreply.translate.codeberg.org>
Co-authored-by: EssGeeEich <EssGeeEich@users.noreply.translate.codeberg.org>
Co-authored-by: rguards <rguards@users.noreply.translate.codeberg.org>
Co-authored-by: kecrily <kecrily@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3138
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-04-15 22:30:11 +05:00
Earl Warren e982f5f63b Merge pull request '[v7.0/forgejo] [PORT] gitea#30430: Fix rename branch 500 when the target branch is deleted but exist in database' (#3236) from bp-v7.0/forgejo-db39b8f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3236
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-15 17:23:51 +00:00
Michael Kriese f49402273f fix(actions): call automerge service on successful commit state
- Backport of https://github.com/go-gitea/gitea/pull/30225

(cherry picked from commit 36f4732e6a)
2024-04-15 16:51:22 +00:00
Gusted fe09c8860a [PORT] gitea#30430: Fix rename branch 500 when the target branch is deleted but exist in database
Fix https://github.com/go-gitea/gitea/issues/30428

---

Conflict resolution: trivial and move test to own subtest run directly
after `Normal`.

(cherrypicked commit 9466fec879f4f2c88c7c1e7a5cffba319282ab66)

(cherry picked from commit db39b8f4a7)
2024-04-15 15:52:24 +00:00
Giteabot 46f77eaf2b
Fix JS error when opening to expanded code comment (#30463) (#30470)
Backport #30463 by silverwind

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit dd128610115c62c96bd1f9df09aae32603c17c17)
2024-04-15 16:44:34 +02:00
Giteabot fb91390b48
Fix network error when open/close organization/individual projects and redirect to project page (#30387) (#30465)
Backport #30387 by @yp05327

Follow #27734

![image](https://github.com/go-gitea/gitea/assets/18380374/02ed6b9a-cbb6-4f49-a54a-ca76a0d052a9)

Updated:
Redirect to project page instead of project list page.

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 3735797b3366c983de5b199a50f4c1015e8cb807)
2024-04-15 16:44:14 +02:00
Giteabot 4fe72284fc
Avoid losing token when updating mirror settings (#30429) (#30464)
Backport #30429 by @wolfogre

Fix #30416.

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of
f9fdac9809/services/migrations/dump.go (L99)

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit 92f4cd9461949940427f789a345a3a51b2de02bf)
2024-04-15 16:43:34 +02:00
Giteabot fa1b0d46c7
Fix mirror error when mirror repo is empty (#30432) (#30455)
Backport #30432 by @yp05327

Fix #30424

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 764878f050f92002b1941b044babbad356f4490a)
2024-04-15 16:42:17 +02:00
Giteabot 70b0c30def
Fix admin notice view-detail (#30450) (#30458)
Backport #30450 by @silverwind

Fix https://github.com/go-gitea/gitea/issues/30434, regression from
https://github.com/go-gitea/gitea/pull/30115.

I also removed the date insertion into the modal which was also broken
since that date was switched to `absolute-date` because I see no real
purpose to putting that date into the modal.

Result:

<img width="1038" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/aa2eb8b4-73dc-4d98-9b80-3f276f89d9e5">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit fd2184e2343842e158f5b12e3d2e5b88effea2fd)
2024-04-15 16:41:44 +02:00
Giteabot b25f2cf859
Change the default maxPerPage for gitbucket (#30392) (#30425)
Backport #30392 by @jam7

This patch improves the migration from gitbucket to gitea.

The gitbucket uses it's own internal perPage value (= 25) for paging and
ignore per_page arguments in the requested URL. This cause gitea to
migrate only 25 issues and 25 PRs from gitbucket repository. This may
not happens on old gitbucket. But recent gitbucket 4.40 or 4.38.4 has
this problem.

This patch change to use this internally hardcoded perPage of gitbucket
as gitea's maxPerPage numer when migrating from gitbucket. There are
several perPage values in gitbucket like 25 for Isseus/PRs and 10 for
Releases. Some of those API doesn't support paging yet. It sounds
difficult to implement, but using the minimum number among them worked
out very well. So, I use 10 in this patch.

Brief descriptions of problems and this patch are also available in
https://github.com/go-gitea/gitea/issues/30316.

In addition, I'm not sure what kind of test cases are possible to write
here. It's a test for migration, so it requires testing gitbucket server
and gitea server, I guess. Please let me know if it is possible to write
such test cases here. Thanks!

Co-authored-by: Kazushi (Jam) Marukawa <jam@pobox.com>
(cherry picked from commit b941d7485b53e5dd093a1cce3c9ff47c91d4fc58)
2024-04-15 16:41:09 +02:00
Giteabot 31ebee203b
Fix the spacing issue in the Project view (#30415) (#30423)
Backport #30415 by @HEREYUA

**fix**:  [#30388](https://github.com/go-gitea/gitea/issues/30388)

**before**

![image](https://github.com/go-gitea/gitea/assets/37935145/52ca7311-dca4-4430-9a37-3c45b08fe3dd)

**after**

![image](https://github.com/go-gitea/gitea/assets/37935145/6b75ce69-4423-4ea4-99a1-d7234287c5c0)

Co-authored-by: HEREYUA <37935145+HEREYUA@users.noreply.github.com>
(cherry picked from commit 358b28cec0086ff1c7517a69db64f34fcc897008)
2024-04-15 16:40:01 +02:00
Giteabot eeaf51ab1d
Avoid user does not exist error when detecting schedule actions when the commit author is an external user (#30357) (#30409)
Backport #30357 by @yp05327

![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76)

When repo is a mirror, and commit author is an external user, then
`GetUserByEmail` will return error.

reproduce/test:
- mirror Gitea to your instance
- disable action and enable it again, this will trigger
`DetectAndHandleSchedules`

ps: also follow #24706, it only fixed normal runs, not scheduled runs.

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 69cc79173ddbf7662c4d7246b6161b9351038d16)
2024-04-15 16:36:33 +02:00
silverwind 8b54d38cbe
Various improvements for long file and commit names (#30374)
Fixes: https://github.com/go-gitea/gitea/issues/29438

This contains numerous enhancements for how large commit messages and
large filenames render. Another notable change is that the file path is
no longer cut off by backend at 30 chars, but rendered in full with
wrapping.

<img width="1329" alt="Screenshot 2024-04-09 at 21 53 57"
src="https://github.com/go-gitea/gitea/assets/115237/5ccbb3d6-643a-4f60-ba79-3572b36d5182">
<hr>
<img width="711" alt="Screenshot 2024-04-09 at 21 44 24"
src="https://github.com/go-gitea/gitea/assets/115237/6ffe8fbb-407c-4aa7-b591-3d80daea7d57">
<hr>
<img width="439" alt="Screenshot 2024-04-09 at 21 19 03"
src="https://github.com/go-gitea/gitea/assets/115237/1ec7f6e9-2fd8-4841-87eb-6ca02ab9cd61">
<hr>
<img width="444" alt="Screenshot 2024-04-09 at 21 18 52"
src="https://github.com/go-gitea/gitea/assets/115237/70931b9e-5841-477e-b3bc-98f8d2662964">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 50099d7af436785daf66a3a9f27bd5c009f90684)

Conflicts:
	- templates/repo/diff/box.tmpl
          Picked Gitea's version, because it appears we missed a
          gt-gap-1 => tw-gap-1 conversion
	- web_src/css/repo.css
          Conflict due to tag signature highlighting, resolved by
          adding the Gitea changes on top of ours manually.
(cherry picked from commit 28170b517914f00449dbce8ba91e02fa1f0f84e5)
2024-04-15 16:33:51 +02:00
Giteabot 01129b593f
Fix line height on inline code preview (#30372) (#30385)
Backport #30372 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/30353.

I don't know what causes `code-inner` to not inherit `line-height` from
its direct parent `.lines-code` but instead from grandparent `.markup`
even thought MDN tells me it's
[inherited](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#formal_definition).
This causes no negative impact on other code views, so I think it's the
best solution.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 88b3d192a0663bd5f25ffa07af45179bac755150)
2024-04-15 16:32:19 +02:00
Giteabot d4d3e89f18
Fix ambiguous id when fetch Actions tasks (#30382) (#30383)
Backport #30382 by @wolfogre

Fix regression of #30331.

```txt
time="2024-04-10T02:23:49Z" level=error msg="failed to fetch task" func="[fetchTask]" file="[poller.go:91]" error="unknown: rpc error: code = Internal desc = pick task: CreateTaskForRunner: Error 1052 (23000): Column 'id' in field list is ambiguous"
```

I have tested it in my local env, and it should work now.

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit 189cfc1be1015367ca20c655ab6a5fd9847c527f)
2024-04-15 16:25:23 +02:00
Giteabot 952f4befa9
Reduce checkbox size to 15px (#30346) (#30347)
Backport #30346 by @silverwind

16 seems to big, 14 too small. Let's do 15. Alignment:

<img width="181" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/f2988611-dee2-492e-a18f-dc5ab3a1cd6c">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 4c8c10b3dff864c935f02df8796937e2594ecd5e)
2024-04-15 16:22:17 +02:00
Giteabot 6ad8ed5da1
Fix missed doer (#30231) (#30343)
Backport #30231 by @lunny

Fix #29879

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit e0b9638191508180a3e5da916550d00c76dd7eaa)
2024-04-15 16:21:45 +02:00
Giteabot fb028c37b5
Avoid running action when action unit is disabled after workflows detected (#30331) (#30338)
Backport #30331 by @yp05327

Fix #30243

We only checking unit disabled when detecting workflows, but not in
runner `FetchTask`.
So if a workflow was detected when action unit is enabled, but disabled
later, `FetchTask` will still return these detected actions.

Global setting: repo.ENABLED and repository.`DISABLED_REPO_UNITS` will
not effect this.

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 52bdeb4d45d44756e28dda7f3f899bb57eed1aad)
2024-04-15 16:21:21 +02:00
Giteabot 7dfe3fe2cb
Add --page-spacing variable, fix admin dashboard notice (#30302) (#30323)
Backport #30302 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/30293 and introduce the
`--page-spacing` variable which holds the spacing between the elements
on the page. This is working vertically for all pages, including ones
that have fomantic grid, and horizontally for all that use
`flex-container`.

The `.page-content > :first-child:not(.secondary-nav)` selector uses
margin which in some cases enables to adjacent margins to overlap, which
is nice.

<img width="1320" alt="Screenshot 2024-04-06 at 01 35 19"
src="https://github.com/go-gitea/gitea/assets/115237/3e81e707-e9ff-4b7f-a211-3d98f4f85353">
---
<img width="1327" alt="Screenshot 2024-04-06 at 01 35 45"
src="https://github.com/go-gitea/gitea/assets/115237/aad196c0-9e21-4c06-ae59-7e33a76c61e1">
---
<img width="1321" alt="Screenshot 2024-04-06 at 01 35 31"
src="https://github.com/go-gitea/gitea/assets/115237/785f6c5d-08b6-4e66-aa16-aeca7cfed3ad">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit db370c47a69b2fb17d8b16c8025451efde5c33b6)
2024-04-15 16:16:37 +02:00
Giteabot 3f6f134260
Action view mobile improvements and fixes (#30309) (#30320)
Backport #30309 by @silverwind

Fix the action issue in https://github.com/go-gitea/gitea/issues/30303,
specifically:

- Use opaque step header hover background to avoid transparency issue
- Un-sticky the `action-view-left` on mobile, it would otherwise overlap
into right view
- Improve commit summary, let it wrap
- Fix and comment z-indexes
- Tweak width for run-list-item-right so it wastes less space on desktop
- Synced latest changes to console colors from dark to light theme

<img width="467" alt="Screenshot 2024-04-06 at 18 58 15"
src="https://github.com/go-gitea/gitea/assets/115237/8ad26b72-6cd9-4522-8ad1-6fd86b2d0d53">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 10d83ae6435134177253569a2f244935c2bb708c)
2024-04-15 16:13:18 +02:00
Giteabot deeb268e5d
Fix checkboxes on mobile view, remove some dead css (#30308) (#30319)
Backport #30308 by @silverwind

Fix the checkbox issues in
https://github.com/go-gitea/gitea/issues/30303 which were existing
problems with these selectors, but made visible with
https://github.com/go-gitea/gitea/pull/30162.

There is a lot of dead/useless CSS in `form.css`, I only fixed the two
problems and remove CSS that was definitely not in use or needed.

<img width="369" alt="Screenshot 2024-04-06 at 18 00 08"
src="https://github.com/go-gitea/gitea/assets/115237/720f178b-1b22-48d4-8704-becb8ce66129">
<img width="405" alt="Screenshot 2024-04-06 at 18 00 28"
src="https://github.com/go-gitea/gitea/assets/115237/61c0f8ec-34af-46c5-a3fa-7c5c4d30c7d2">

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit d26ec5f2eb74a6437f998ab0af2ae058a64e06a2)
2024-04-15 16:12:52 +02:00
wxiaoguang c5d6cb5b52
Clean up log messages (#30313)
`log.Xxx("%v")` is not ideal, this PR adds necessary context messages.
Remove some unnecessary logs.

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 83f83019ef3471b847a300f0821499b3896ec987)

Conflicts:
	- modules/util/util.go
          Conflict resolved by picking `util.Iif` from 654cfd1dfbd3f3f1d94addee50b6fe2b018a49c3
(cherry picked from commit 492d116b2a468991f44d6d37ec33f918ccbe4514)

Conflicts:
	modules/util/util.go
	trivial context conflict as the commit is picked from https://codeberg.org/forgejo/forgejo/pulls/3212
2024-04-15 16:11:14 +02:00
Earl Warren 78944bb709 Merge pull request '[v7.0/forgejo] fix(actions): the trigger user of a schedule is the action user' (#3216) from bp-v7.0/forgejo-c3e2c25 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3216
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-14 18:34:20 +00:00
Earl Warren 35b129e984 fix(actions): the trigger user of a schedule is the action user
The user that caused the notification to re-evaluates the
schedules is not the one that will trigger the workflows. They are
background tasks that are authored by the action user (id -2).

Such a mis-assignment is problematic when the user that caused the
notification is deleted.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3211
(cherry picked from commit c3e2c25359)
2024-04-14 17:36:48 +00:00
forgejo-backport-action 1b8fd7b17b [v7.0/forgejo] [BUG] Fix code search in explore reporting as git grep even with indexer enabled (#3204)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3173

regression caused in porting #2813 🫣

see https://codeberg.org/forgejo/forgejo/pulls/2688#issuecomment-1692750

Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3204
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-04-14 14:21:31 +00:00
0ko ef0ab3cdaf Merge pull request 'Fix box rounding on dashboard (F7.0)' (#3202) from 0ko/forgejo:box-dash-v7 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3202
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-13 07:17:33 +00:00
0ko 5420b630f5 Fix box rounding on dashboard (F7.0)
Regression of 4711d3311b (diff-1daf5eae3896bddcde764fc8a88dc3fd0c0ea21a).
2024-04-13 10:44:19 +05:00
Earl Warren f075579c95 Merge pull request '[v7.0/forgejo] Fix inline permalinks across repo; closes #2965' (#3198) from bp-v7.0/forgejo-1d1c013 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3198
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-12 23:40:43 +00:00
Earl Warren 88b6164f84 Merge pull request '[v7.0/forgejo] [BUG] Fix for PyPi Registry PEP 503 Compliance' (#3197) from bp-v7.0/forgejo-14badb3-303b95a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3197
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-12 23:07:36 +00:00
Mai-Lapyst dbf1d06ff6 Fix inline permalinks across repo; closes #2965 (#3042)
This PR fixes the possible ambiguity of rendered inline permalinks across repos by adding it as a suffix to the title element if the permalink refers to a file not inside the current repository. Closes #2965

![grafik](/attachments/e70e37b8-24c7-4f7b-ab52-92f1e8dfb009)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3042
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
(cherry picked from commit 1d1c0131bb)
2024-04-12 22:38:57 +00:00
Zottelchen bb7b211c0c Update tests/integration/api_packages_pypi_test.go
(cherry picked from commit 14badb37fe)
2024-04-12 22:23:58 +00:00
Zottelchen aad193c4a6 Update templates/api/packages/pypi/simple.tmpl
(cherry picked from commit 303b95a1c1)
2024-04-12 22:23:58 +00:00
Earl Warren caa6b4a34d Merge pull request '[v7.0/forgejo] Fix the settings tab highlighting' (#3195) from bp-v7.0/forgejo-65ed86e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3195
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-12 22:19:16 +00:00
Earl Warren 9656408102 Merge pull request '[v7.0/forgejo] [BUG] Render correct label link' (#3196) from bp-v7.0/forgejo-7a97c05 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3196
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-12 22:18:59 +00:00
Gusted 0c71afea31 [BUG] Render correct label link
- Render the correct label for pull requests, it should link to the pull
requests list and not the issue list.
- Add unit test.
- Resolves https://codeberg.org/forgejo/forgejo/issues/3183

(cherry picked from commit 7a97c05206)
2024-04-12 20:47:23 +00:00
Gergely Nagy fd5abfd244 Fix the settings tab highlighting
When visiting a repos `/settings/units` page, highlight the active tab
properly: "Add more..." if the tab is displayed, or "Settings"
otherwise.

Fixes #3188.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 65ed86e396)
2024-04-12 20:46:24 +00:00
Earl Warren 89d751ef1b Merge pull request '[v7.0/forgejo] Update forgejo/forgejo-build-publish action to v5' (#3186) from bp-v7.0/forgejo-d7ae60a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3186
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-12 13:55:47 +00:00
Renovate Bot ce2b1643f9 Update forgejo/forgejo-build-publish action to v5
(cherry picked from commit d7ae60ae91)
2024-04-12 12:23:15 +00:00
Earl Warren e4f160eed2 Merge pull request '[v7.0/forgejo] Do not update PRs based on events that happened before they existed' (#3164) from earl-warren/forgejo:wip-v7.0-superfluous into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3164
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-12 09:14:02 +00:00
Earl Warren 50822f361e
Do not update PRs based on events that happened before they existed
* Split TestPullRequest out of AddTestPullRequestTask
* A Created field is added to the Issue table
* The Created field is set to the time (with nano resolution) on creation
* Record the nano time repo_module.PushUpdateOptions is created by the hook
* The decision to update a pull request created before a commit was
  pushed is based on the time (with nano resolution) the git hook
  was run and the Created field

It ensures the following happens:

* commit C is pushed
* the git hook queues AddTestPullRequestTask for processing and returns with success
* TestPullRequest is not called yet
* a pull request P with commit C as the head is created
* TestPullRequest runs and ignores P because it was created after the commit was received

When the "created" column is NULL, no verification is done, pull
requests that were created before the column was created in the
database cannot be newer than the latest call to a git hook.

Fixes: https://codeberg.org/forgejo/forgejo/issues/2009
(cherry picked from commit 998a431747)

Conflicts:
	models/forgejo_migrations/migrate.go
	see https://codeberg.org/forgejo/forgejo/pulls/3165#issuecomment-1755941
	services/pull/pull.go
	trivial conflicts
2024-04-12 10:41:19 +02:00
Earl Warren ce8bfa25fb Merge pull request '[v7.0/forgejo] [BUG] Handle bigger files in git grep' (#3168) from bp-v7.0/forgejo-668709a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3168
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-11 19:48:58 +00:00
0ko 5ab76ec570 Merge pull request '[v7.0/forgejo] Remove unused translation' (#3174) from bp-v7.0/forgejo-f7aca6e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3174
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-11 16:12:59 +00:00
Gusted 62a925b758 Remove unused translation
- Remove `enable_update_checker_helper` translation key which became
obsolete with #278

(cherry picked from commit f7aca6ed21)
2024-04-11 15:07:08 +00:00
0ko fa06bf5e81 Merge pull request 'Backport Translations update from Weblate (#3064)' (#3169) from 0ko/forgejo:backport-translations-2024-04-v7 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3169
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-11 14:53:53 +00:00
Gusted b203e535e5 [BUG] Handle bigger files in git grep
- The parser of `git grep`'s output uses `bufio.Scanner`, which is a good
choice overall, however it does have a limit that's usually not noticed,
it will not read more than `64 * 1024` bytes at once which can be hit in
practical scenarios.
- Use `bufio.Reader` instead which doesn't have this limitation, but is
a bit harder to work with as it's a more lower level primitive.
- Adds unit test.
- Resolves https://codeberg.org/forgejo/forgejo/issues/3149

(cherry picked from commit 668709a33f)
2024-04-11 13:32:01 +00:00
Codeberg Translate fbaba7ed54 [I18N] Translations update from Weblate (#3064)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: WithLithum <WithLithum@users.noreply.translate.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: adaaa <adaaa@users.noreply.translate.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: Panagiotis \"Ivory\" Vasilopoulos <git@n0toose.net>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: Anonymous <anonymous@users.noreply.translate.codeberg.org>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: Xinayder <Xinayder@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3064
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-04-11 18:31:56 +05:00
Gusted db56ccf993 Merge pull request '[v7.0/forgejo] [BUG] Store JSON in contributors commit cache' (#3161) from bp-v7.0/forgejo-4c8b67c into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3161
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-11 13:12:11 +00:00
Gusted d60152587c [BUG] Store JSON in contributors commit cache
- The code that gets contributor stats tried to store an
`map[string]*ContributorData` type in the cache, this works for the
memory cache but not for other caches such as Redis.
- The cache implementation for Redis would convert this map via
`fmt.Sprintf` to an string, which would simply print the pointer and not
the value of the pointer. Storing pointers is a no-go as this will get
GC-ed eventually within a few minutes. Therefore store everything with
json, that does properly store the value of the pointers.
- Adds unit test that verifies JSON is being used.
- Resolves https://codeberg.org/forgejo/forgejo/issues/3158

(cherry picked from commit 4c8b67c4b2)
2024-04-11 12:06:19 +00:00
Earl Warren b519ae39d7 Merge pull request '[v7.0/forgejo] [BUG] Fix tooltip for 1000+ stars/forks' (#3148) from bp-v7.0/forgejo-3e9a97b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3148
Reviewed-by: Otto <otto@codeberg.org>
2024-04-11 05:11:12 +00:00
Gusted 3344ef3511 [BUG] Fix tooltip for 1000+ stars/forks
- The tooltip attribute should be inside the `<a>` element not outside of it.
- Regression of 854164f40b

(cherry picked from commit 3e9a97b9ce)
2024-04-10 22:35:21 +00:00
Earl Warren 60e28c9dda Merge pull request '[v7.0/forgejo] Update checker setting updates' (#3146) from bp-v7.0/forgejo-e498069 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3146
2024-04-10 21:44:39 +00:00
0ko 71efe9b8fc Update checker setting updates
- revert c53f802778
- enable by default on install page
- save checkbox state between form submissions

Resolves https://codeberg.org/forgejo/forgejo/issues/2859

(cherry picked from commit e498069fd5)
2024-04-10 20:55:35 +00:00
Earl Warren f1016e8ddd Merge pull request '[v7.0/forgejo] Remove redundant / deadcode error check' (#3145) from bp-v7.0/forgejo-9862f28 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3145
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-10 18:51:08 +00:00
Gusted 711838a4df Remove error check
- This error check was made redudant by 375fd15fbf

(cherry picked from commit 9862f28ac5)
2024-04-10 17:43:57 +00:00
Earl Warren 666432d15b Merge pull request '[v1.22/gitea] week 15 cherry pick to v7.0' (#3113) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3113
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-10 05:00:07 +00:00
Earl Warren c63b347a0b Merge pull request '[v7.0/forgejo] [BUG] webhook: fix admin-hooks and add more tests' (#3131) from bp-v7.0/forgejo-9a94019-e0b5f2d-c1f7c49-7d95cf6 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3131
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-09 23:01:34 +00:00
oliverpool 01dc275a19 webhook: add admin-hooks tests
(cherry picked from commit 9a94019db4)
2024-04-09 21:57:34 +00:00
oliverpool 660e450e6d webhook: fix admin-hooks new dropdowns
(cherry picked from commit e0b5f2d59b)
2024-04-09 21:57:34 +00:00
oliverpool 457370bfce webhook: add admin-hooks new list test
(cherry picked from commit c1f7c49804)
2024-04-09 21:57:34 +00:00
oliverpool 373200e986 webhook: add org tests
(cherry picked from commit 7d95cf6472)
2024-04-09 21:57:34 +00:00
Earl Warren f3a4134049 Merge pull request '[v7.0/forgejo] Made "no key to sign this commit with" error clearer' (#3117) from bp-v7.0/forgejo-53dadee into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3117
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-08 20:29:48 +00:00
Laxystem a752d000ff Made "no key to sign this commit with" error more clear
(cherry picked from commit 53dadee350)
2024-04-08 19:08:39 +00:00
Earl Warren 4732cc82be Merge pull request '[v7.0/forgejo] [PORT] Refactor dropzone (#30232)' (#3112) from bp-v7.0/forgejo-c1ac3e5 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3112
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-08 10:22:34 +00:00
Earl Warren 9811e363bd Merge pull request '[v7.0/forgejo] [PORT] gitea#29953: Fix:the rounded corners of the folded file are not displayed correctly' (#3111) from bp-v7.0/forgejo-43122ca into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3111
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-08 10:16:01 +00:00
Giteabot 82b2b9790e
Add gap to commit status details (#30284) (#30290)
Backport #30284 by @silverwind

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit d09ddb52501a0342cc07df8ae312b847ebd98d96)
2024-04-08 11:51:51 +02:00
Giteabot 8a9b57500c
Commit-Dropdown: Show Author of commit if available (#30272) (#30285)
Backport #30272 by @sebastian-sauer

As in commits page we show the author of the commit in the commits
dropdown and not the committer.

Commits Page:
![Screenshot from 2024-04-03
22-34-41](https://github.com/go-gitea/gitea/assets/1135157/1c7c5c19-6d0a-4176-8a87-7bca6a0c6dc8)

and the same contents in our dropdown:

![image](https://github.com/go-gitea/gitea/assets/1135157/aa094af2-c369-47ac-9c27-ca208d1d03f0)

fixes #29588

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
(cherry picked from commit c8570b73afb443f8e4f07f0a26939f1ab5c18f94)
2024-04-08 11:51:15 +02:00
wxiaoguang 294cb4f19b [PORT] Refactor dropzone (#30232)
Simplify code and use `.files` elements

(cherry picked from commit ca297a90fb1fec5b270fad1a3e575916510e7385)

Conflicts:
	web_src/js/features/repo-legacy.js
(cherry picked from commit c1ac3e5891)
2024-04-08 09:50:53 +00:00
Giteabot e83b6c7cd2
Close file in the Upload func (#30262) (#30270)
Co-authored-by: guangwu <guoguangwu@magic-shield.com>
(cherry picked from commit f45df3e3f9255e5adc68f14c4e18c1e26a301a64)
2024-04-08 11:50:17 +02:00
Giteabot 39bc868092
Fixes #27605: inline math blocks can't be preceeded/followed by alphanumerical characters (#30175) (#30251)
Backport #30175 by @jmlt2002

- Inline math blocks couldn't be preceeded or succeeded by
alphanumerical characters due to changes introduced in PR #21171.
Removed the condition that caused this (precedingCharacter condition)
and added a new exit condition of the for-loop that checks if a specific
'$' was escaped using '\' so that the math expression can be rendered as
intended.
- Additionally this PR fixes another bug where math blocks of the type
'$xyz$abc$' where the dollar sign was not escaped by the user, generated
an error (shown in the screenshots below)
- Altered the tests to accomodate for the changes

Former behaviour (from try.gitea.io):

![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235)

Fixed behaviour (from my local build):

![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d)

(Edit) Source code for the README.md file:
```
$x$ -$x$ $x$-

a$xa$ $xa$a 1$xb$ $xb$1

$a a$b b$

a$b $a a$b b$

$a a\$b b$
```

Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt>
Co-authored-by: João Tiago <114936010+jmlt2002@users.noreply.github.com>
(cherry picked from commit ac65aeecbd42ed30cc0838b3fad12b58daadf3ad)
2024-04-08 11:49:51 +02:00
KN4CK3R d9442b09b5
Fix missing 0 prefix of GPG key id (#30245)
Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

(cherry picked from commit eb505b128c7b9b2459f2a5d20b5740017125178b)

Conflicts:
	- models/asymkey/gpg_key_commit_verification.go
          Ported the change to models/asymkey/gpg_key_object_verification.go
(cherry picked from commit 63904e2f97)
2024-04-08 11:46:40 +02:00
Giteabot e40ab6d0bd
Fix spacing in issue navbar (#30238) (#30242)
Backport #30238 by @silverwind

Create a new `issue-navbar` class specifically for this bar, previous
class used in many places and I thought I had them all removed, but not
this one.

Fixes: https://github.com/go-gitea/gitea/issues/30226

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 39322d9fc4644d2ede3efe3a9c4efee2e493d4cd)
2024-04-08 11:44:09 +02:00
Giteabot b310027e55
Remove scheduled action tasks if the repo is archived (#30224) (#30230)
Backport #30224 by @Zettat123

Fix #30220

Co-authored-by: Zettat123 <zettat123@gmail.com>
(cherry picked from commit 895d2795abe79cc2e87b35d39cb7d09b9234b06d)
2024-04-08 11:41:39 +02:00
Giteabot 94fc99c217
Prevent flash of dropdown menu on labels list (#30215) (#30216)
Backport #30215 by @silverwind

On the labels list, This `left` class caused the dropdown content to
flash on page load until JS had hidden it. Remove it as I see no purpose
to it.

<img width="215" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/9e1de97f-dd89-41e0-9229-5c4a786ba762">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 3ff4a6936b5ee05b3df945c466285de47ea87ef2)
2024-04-08 11:39:53 +02:00
wxiaoguang 704df1ff28
Fix home topic edit form layout (#30213)
The UI has been refactored by #30191 , so here are 2 choices:

1. Backport #30191
2. Apply this quick fix

Before:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/0db583cf-8ce8-4fdb-9e4d-8c93fe6766c7)

</details>

After:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/0e732c4c-d28d-4c04-b328-72b9efd7daa9)

</details>

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit e579ddc31f6d6d0406f1c5330f2a31b9707fb3e2)
2024-04-08 11:35:30 +02:00
Giteabot 89a748b368
Fix GPG subkey verify (#30193) (#30203)
Backport #30193 by @KN4CK3R

Fixes #30189

Can't verify subkeys if they are not loaded.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit e581efe238d1f735787b5dbdfcce9a1d73384ef3)
2024-04-08 11:31:31 +02:00
Giteabot d573c22a98
Fix unclickable checkboxes (#30195) (#30199)
Backport #30195 by @silverwind

Fix https://github.com/go-gitea/gitea/issues/30185, regression from
https://github.com/go-gitea/gitea/pull/30162.

The checkboxes were unclickable because the label was positioned over
the checkbox with `padding`. Now it uses `margin` so the checkbox itself
will be clickable in all cases.

Secondly, I changed the for/id linking to also add missing `for`
attributes when `id` is present. The other way around (only `for`
present) is currently not handled and I think there are likey no
occurences in the code and introducing new non-generated `id`s might
cause problems elsewhere if we do, so I skipped on that.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 9d38c4d60ef5bd015e1430386e38d9f32e050f8f)
2024-04-08 11:30:27 +02:00
Giteabot f4a2f439a9
Include encoding in signature payload (#30174) (#30182)
Backport #30174 by @KN4CK3R

Fixes #30119

Include the encoding in the signature payload.

before

![grafik](https://github.com/go-gitea/gitea/assets/1666336/01ab94a3-8af5-4d6f-be73-a10b65a15421)

after

![grafik](https://github.com/go-gitea/gitea/assets/1666336/3a37d438-c70d-4d69-b178-d170e74aa683)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 19443a28b7eb74016c956ff74f85c9b0ce162ed5)
2024-04-08 11:30:08 +02:00
HEREYUA b912e26e5f Fix:the rounded corners of the folded file are not displayed correctly (#29953)
Fix:    [#29933](https://github.com/go-gitea/gitea/issues/29933)

**Before**

![image](https://github.com/go-gitea/gitea/assets/37935145/71ec80f6-5896-4e4a-b686-4d792c11ebe2)

**After**

![image](https://github.com/go-gitea/gitea/assets/37935145/81348a61-946a-4562-881d-8d873e50228f)

---------

Co-authored-by: silverwind <me@silverwind.io>
Conflicts:
	- web_src/css/modules/segment.css
	  Ported by adding the new selector with a larger radius,
          keeping the existing one with ours.
(cherry picked from commit 43122ca984)
2024-04-08 09:29:21 +00:00
Giteabot 7ac46f1151
Remove fomantic checkbox module (#30162) (#30168)
Backport #30162 by @silverwind

CSS is pretty slim already and the `.ui.toggle.checkbox` sliders on
admin page also still work. The only necessary JS is the one that links
`input` and `label` so that it can be toggled via label. All checkboxes
except the markdown ones render at `--checkbox-size: 16px` now.

<img width="174" alt="Screenshot 2024-03-28 at 22 15 10"
src="https://github.com/go-gitea/gitea/assets/115237/3455c1bb-166b-47e4-9847-2d20dd1f04db">

<img width="499" alt="Screenshot 2024-03-28 at 21 00 07"
src="https://github.com/go-gitea/gitea/assets/115237/412be2b3-d5a0-478a-b17b-43e6bc12e8ce">

<img width="83" alt="Screenshot 2024-03-28 at 22 14 34"
src="https://github.com/go-gitea/gitea/assets/115237/d8c89838-a420-4723-8c49-89405bb39474">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit 591759fdfae43bc87323b644919cc9581bff1d81)
2024-04-08 11:28:31 +02:00
Earl Warren c98d61710e Merge pull request '[v7.0/forgejo] [PORT] gitea#30282: Markup color and font size fixes' (#3104) from bp-v7.0/forgejo-ff1744c into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3104
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-04-08 05:48:31 +00:00
silverwind 033f2a4a17 [PORT] gitea#30282: Markup color and font size fixes
1. Distinguish inline an block code with new CSS variable
`--color-markup-code-inline`
2. Various color tweaks, better contrast from background

(cherry picked from commit 662eb4b0852f9ce2c161e7fea5ac66bf912fc9f6)

---

- Revert the changes of #2874.
- Add more contrast to the inline block for light and dark theme.

(cherry picked from commit 662eb4b0852f9ce2c161e7fea5ac66bf912fc9f6)
(cherry picked from commit ff1744cbbc)
2024-04-07 19:53:55 +00:00
Gusted f7cc76598d Merge pull request '[v7.0/forgejo] [BUG] Fix unblock action' (#3103) from bp-v7.0/forgejo-a3f1249 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3103
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-07 17:16:25 +00:00
Gusted 0af1418e6e [BUG] Fix unblock action
- At some point the unblock button was transformed into being handled by
Javascript, however the endpoint didn't yet respond in JSON.
- Ref: https://codeberg.org/kita/.profile/raw/branch/main/img/G94IqS9.png

(cherry picked from commit a3f1249f0a)
2024-04-07 15:35:31 +00:00
Gusted 730c667122 Merge pull request '[v7.0/forgejo] [BUG] Fix tone of callout boxes for Forgejo dark' (#3092) from bp-v7.0/forgejo-515ccaa into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3092
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-07 13:07:13 +00:00
Gusted 7c23dfba46 [BUG] Fix tone of callout boxes for Forgejo dark
- Adjust the warning and success text to be more representive (make them
more green and yellow). They still confirm to AAA contrast.
- For important, note and caution callout boxes make use of the light
variants for the colors colors rather than the dark variant.
- Resolves #3084

(cherry picked from commit 515ccaacd9)
2024-04-07 11:50:27 +00:00
Gusted de440f8b93 Merge pull request '[v7.0/forgejo] [BUG] Fix admin layout' (#3088) from bp-v7.0/forgejo-c2d0f64 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3088
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-07 10:42:05 +00:00
Gusted 7bbb93b3b1 [BUG] Fix admin layout
- Fix the layout of admin pages, it previously was full-width and had
the alert at the incorrect place and within an container.
- Make the placement of the alert consistent with other pages, inside
`flex-container-main` and not wrapped around a container.
- We have to revert 145bebc829, as this
expected that the page contain provided padding, this was provided by
the incorrect placement of the alert. As well isn't consistent with how
other pages are being shown, non-full width. The solution to the
described problem isn't optimal and should rather be fixed with the tables.
- Reverts 145bebc829
- Resolves #3082

(cherry picked from commit c2d0f64340)
2024-04-06 20:48:09 +00:00
Earl Warren 572019129e Merge pull request '[v7.0/forgejo] [FEAT] Support Include/Exclude Filters for Grep' (#3080) from bp-v7.0/forgejo-baac15f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3080
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-06 20:44:26 +00:00
Earl Warren da1810b12c Merge pull request '[v7.0/forgejo] Add unit tests for update git hook' (#3083) from bp-v7.0/forgejo-dad799f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3083
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-06 20:40:15 +00:00
Gusted d4a4b4b4e3 Add unit tests for update git hook
- Add unit tests.
- Handle the 'impossible' case of not enough arguments.
- Ref: https://codeberg.org/forgejo/forgejo/pulls/2834

(cherry picked from commit dad799fa46)
2024-04-06 17:39:03 +00:00
Shiny Nematoda 328f694a33 [FEAT] Support Include/Exclude Filters for Grep (#3058)
fixes `TestRepoSearch` failing occasionally

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3058
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
(cherry picked from commit baac15f316)
2024-04-06 17:38:32 +00:00
Gusted 52d217ec50 Merge pull request '[v7.0/forgejo] Sort BuiltinApplicationsClientIDs() in test' (#3079) from bp-v7.0/forgejo-eea2590 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3079
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-06 14:09:20 +00:00
forgejo-backport-action 706a7ad41e [v7.0/forgejo] Fix "view file" button in diff compare view (#3077)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3046

This PR fixes an issue in the diff compare view, where when working on a fork that has not the same name as the upstream repo, the "View file" button links to a wrong, often missing, location.

Demonstration of this issue:
- Visit https://next.forgejo.org/mai-lapyst-test-org/upstream/compare/main...Mai-Lapyst/downstream:mai-lapyst-patch-1.
- Click the "View file" button of the patch.
- Get taken to `4fe947d522/README.md` (which does not exist and returns a 404) instead of `4fe947d522/README.md`. Note the different repository name (`upstream` vs `downstream`).

Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3077
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-04-06 13:24:55 +00:00
forgejo-backport-action 5bde9555b1 [v7.0/forgejo] Add optional pronoun field in user settings (#3076)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/1518

An attempt at adding an optional pronoun field for user profiles, as suggested here 3 years ago: https://github.com/go-gitea/gitea/issues/13990

![A Forgejo profile showing pronouns to the right of the user's username](/attachments/2e5ff300-d333-46db-9074-f030f199843c)

I made this for [my own instance](https://git.gay/h) and didn't initially think I'd make a PR because of the previous closed issue, but I thought I'd ask the Forgejo matrix chat to see if there was any support and there was!

I'm told I should make a database migration, some help as to how to do that would be appreciated.

Co-authored-by: hazycora <hazysu@riseup.net>
Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3076
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-04-06 13:23:43 +00:00
Gusted 8d8dce747a Sort BuiltinApplicationsClientIDs() in test
- Ref https://codeberg.org/forgejo/forgejo/pulls/3069#issuecomment-1736290

(cherry picked from commit eea259055e)
2024-04-06 12:55:31 +00:00
Gusted a070f28c81 Merge pull request '[v7.0/forgejo] [BUG] Don't remove builtin OAuth2 applications' (#3069) from bp-v7.0/forgejo-6af8f3a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3069
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-06 12:43:33 +00:00
Earl Warren 1065ee4a60 Merge pull request '[v7.0/forgejo] Fix #3030 add Cache-Control header for health-check' (#3074) from bp-v7.0/forgejo-323d7ad-84f5115-d2ff8f8-b210a3e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3074
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-06 09:55:19 +00:00
Earl Warren 3da5ad9a00 Merge pull request '[v7.0/forgejo] feat: improve nuget nuspec api' (#3073) from bp-v7.0/forgejo-bc72fd7 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3073
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-06 09:50:50 +00:00
Gusted d2a7905d9d Merge pull request '[v7.0/forgejo] Refactor LFS GC functions' (#3072) from bp-v7.0/forgejo-7ffa7f5 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3072
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-06 09:34:01 +00:00
Earl Warren 8e27c91df2 Merge pull request '[v7.0/forgejo] [BUG] fix webhook creation payload ref' (#3070) from bp-v7.0/forgejo-2c85a14-9d29192 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3070
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-06 09:01:19 +00:00
Ada 7aa0999c9f Remove useless t.run
(cherry picked from commit 323d7ad507)
2024-04-06 08:44:23 +00:00
Ada 8ddfd26d97 Add health-check test
(cherry picked from commit 84f5115bd1)
2024-04-06 08:44:23 +00:00
Ada 12c28641ab Remove old proxy backwards compatibility
(cherry picked from commit d2ff8f8720)
2024-04-06 08:44:23 +00:00
Ada 3eab81fdea Fix #3030 add Cache-Control header for health-check
(cherry picked from commit b210a3ebd5)
2024-04-06 08:44:23 +00:00
Michael Kriese 091400b656 feat: improve nuget nuspec api
(cherry picked from commit bc72fd7f46)
2024-04-06 08:32:53 +00:00
Gusted aa7346c007 Refactor LFS GC functions
- Remove options that currently aren't set
on `GarbageCollectLFSMetaObjectsOptions` and
`IterateLFSMetaObjectsForRepoOptions`.
- Simplify `IterateRepositoryIDsWithLFSMetaObjects` and
`IterateLFSMetaObjectsForRepo`.
- `IterateLFSMetaObjectsForRepo` was previously able to get in a
loop (`gc-lfs` doctor check was able to reproduce this) because the code
expected that the records would be updated to not match the SQL query,
but that wasn't the case. Simply enforce that only records higher than
the latest `id` from the previous iteration are allowed.
- For `gc-lfs` doctor check this was because `UpdatedLessRecentlyThan`
option was not set, which caused that records just marked as active in
the iteration weren't being filtered.
- Add unit tests
- Most likely a regression from 2cc3a6381c.
- The bug with `gc-lfs` was found on Codeberg.

(cherry picked from commit 7ffa7f5bce)
2024-04-06 07:41:40 +00:00
oliverpool a2a833c5ac [FIX] webhook creation payload ref
(cherry picked from commit 2c85a1417b)
2024-04-06 07:30:48 +00:00
oliverpool 4a8eb1caa1 [TEST] webhook creation payload ref
(cherry picked from commit 9d2919248b)
2024-04-06 07:30:48 +00:00
Gusted 2236574d50 [BUG] Don't remove builtin OAuth2 applications
- When the database consistency is being run it would check for any
OAuth2 applications that don't have an existing user. However there are
few special OAuth2 applications that don't have an user set, because
they are global applications.
- This was not taken into account by the database consistency checker
and were removed if the database consistency check was being run with
autofix enabled.
- Take into account to ignore these global OAuth2 applications when
running the database consistency check.
- Add unit tests.
- Ref: https://codeberg.org/Codeberg/Community/issues/1530

(cherry picked from commit 6af8f3a3f2)
2024-04-06 07:03:41 +00:00
Earl Warren 7e5fed7e29 Merge pull request '[v7.0/forgejo] [CHORE] Remove Gitea specific files' (#3066) from bp-v7.0/forgejo-396b539 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3066
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-06 07:02:35 +00:00
Gusted 1db55b1754 [CHORE] Remove Gitea specific files
- Removal of `docs`, this contains Gitea documentation which is not used
by Forgejo.
- Removal of `CHANGELOG.md` this contains only Gitea commits of
releases, instead `RELEASE-NOTES.md` should be used instead which also
contains Forgejo commits.

(cherry picked from commit 396b539496)
2024-04-05 20:41:12 +00:00
Earl Warren 7df46a9b34 Merge pull request '[v7.0/forgejo] [FEAT] sourcehut webhooks' (#3065) from bp-v7.0/forgejo-ed9dd0e-04a398a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3065
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-05 20:35:05 +00:00
oliverpool 82b92c3f2c [FEAT] sourcehut webhooks
(cherry picked from commit ed9dd0e62a)
2024-04-05 19:36:04 +00:00
oliverpool 4ad42a4e3f [REFACTOR] webhook shared code to prevent import cycles
(cherry picked from commit 04a398a1af)
2024-04-05 19:36:03 +00:00
Earl Warren be41258d5c Merge pull request '[v7.0/forgejo] Provide plural support for followers/following in user profiles' (#3053) from bp-v7.0/forgejo-ddedcd4-df2a83e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3053
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-05 09:35:25 +00:00
Earl Warren fe8b34b8fc Merge pull request 'Mark deprecation of MSSQL' (#3041) from gusted/forgejo-deprecate-mssql into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3041
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-05 06:46:08 +00:00
Earl Warren f5cd6339a8 Merge pull request '[v7.0/forgejo] Revert "[CI] pin go v1.22.2 version"' (#3051) from bp-v7.0/forgejo-2625335 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3051
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-05 06:43:22 +00:00
0ko 68476e2494 Use people icon instead of person on profiles
(cherry picked from commit ddedcd44b7)
2024-04-05 06:32:11 +00:00
0ko 04ea1aedc5 [I18N] Provide plural support for followers/following in user profiles
(cherry picked from commit df2a83ed20)
2024-04-05 06:32:11 +00:00
Earl Warren 2ed0a56dd4 Merge pull request '[v7.0/forgejo] [I18N] Translations update from Weblate' (#3052) from bp-v7.0/forgejo-2c69ca4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3052
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-05 06:20:40 +00:00
Codeberg Translate 1f0e36f7ae [I18N] Translations update from Weblate (#2982)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: Eriwi <Eriwi@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Co-authored-by: FedericoSchonborn <FedericoSchonborn@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2982
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
(cherry picked from commit 2c69ca43f5)
2024-04-05 04:58:22 +00:00
Earl Warren af797534f8 Merge pull request '[v7.0/forgejo] Fixes regression of issue edit not working' (#3047) from bp-v7.0/forgejo-8c31b78 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3047
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-05 04:56:38 +00:00
Earl Warren 5374cb6608 Revert "[CI] pin go v1.22.2 version"
The golang action now knows about the latest Go version.

This reverts commit 3509242ee6.

(cherry picked from commit 262533570f)
2024-04-05 04:40:24 +00:00
Mai-Lapyst 84d8c8b777 Fixes regression of issue edit not working
(cherry picked from commit 8c31b78630)
2024-04-05 04:03:20 +00:00
Gusted c65b9e0112
Mark depreciation of MSSQL
- Per https://codeberg.org/forgejo/discussions/issues/122
2024-04-04 22:27:56 +02:00
Earl Warren 2024519bb4 Merge pull request '[v7.0/forgejo] [FEAT] Add label filters in organization issues dashboard' (#3038) from bp-v7.0/forgejo-8d13ed4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3038
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-04 19:41:54 +00:00
Earl Warren 279d1a85f0 Merge pull request '[v7.0/forgejo] Plural support for release download count' (#3037) from bp-v7.0/forgejo-2fff6c2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3037
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-04 18:36:48 +00:00
Earl Warren 2c263b2732 Merge pull request '[v7.0/forgejo] feat: add optional storage init to doctor commands' (#3035) from bp-v7.0/forgejo-e226a27 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3035
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-04-04 18:36:03 +00:00
Earl Warren 2bf3723939 Merge pull request '[v7.0/forgejo] [BUG] Fix crash in issue forms' (#3036) from bp-v7.0/forgejo-b0cd0eb into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3036
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-04 18:35:37 +00:00
iminfinity cb0c6b52be add label filters in org/{org_name}/issues
(cherry picked from commit 8d13ed4a8d)
2024-04-04 17:37:56 +00:00
0ko bf275ac92f [I18N] Provide plural support for release download count
Following https://codeberg.org/forgejo/forgejo/pulls/2899 and my review

See https://codeberg.org/forgejo/forgejo/pulls/3031#issuecomment-1733158 for why older strings were dropped

(cherry picked from commit 2fff6c255d)
2024-04-04 17:29:14 +00:00
Gusted aefdf17a75 [BUG] Fix crash in issue forms
- Fix a crash in the issue forms, because `ctx.Ctx` was trying to be
accessed, however this is not set in all contexts thus could result to NPE.
- Adds integration test.
- Resolves #3011

(cherry picked from commit b0cd0ebb91)
2024-04-04 16:57:55 +00:00
Michael Kriese 5b7d454dd8 feat: add optional storage init to doctor commands
(cherry picked from commit e226a27233)
2024-04-04 16:56:55 +00:00
Earl Warren fbaebbd644 Merge pull request '[v7.0/forgejo] [FEAT] Visual separation between types of attachments' (#3029) from bp-v7.0/forgejo-20a3597 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3029
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-04 16:43:39 +00:00
Gusted 139979f25d Merge pull request '[v7.0/forgejo] [BUG] Center icon and callout text' (#3027) from bp-v7.0/forgejo-6ffae46 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3027
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-04 14:59:10 +00:00
Gusted 86d018dffc [FEAT] Visual separation between types of attachments
- Add a visual (but still semantic way) separation between Forgejo's
generated attachments and the user's uploaded ones.
- The styling was first done by `ul` element, but is moved to the
individual list items to have better control over them.
- Add tooltip explaining the attachment was generated by Forgejo.
- Remove the tooltip of the other attachments and 'simplify' them into a text.
- Resolves #2893

Co-authored-by: 0ko <0ko@noreply.codeberg.org>
(cherry picked from commit 20a3597220)
2024-04-04 13:56:55 +00:00
Gusted 06e72e22d5 [BUG] Center icon and callout text
- Wrap the icon and callout into a seperate `<p>` which has `display:
flex; align-items: center` set. To center the icon with the callout text.
- Resolves #3006

(cherry picked from commit 6ffae461d4)
2024-04-04 12:18:32 +00:00
Earl Warren bc873f2e83 Merge pull request '[v7.0/forgejo] Better color for labels/counters' (#3024) from bp-v7.0/forgejo-a245fb5 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3024
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-04 12:08:48 +00:00
0ko 0f2e315b02 [THEME] Use better color for labels/counters
- improves contrast
- looks good
- improves consistency with other label-y elements

(cherry picked from commit a245fb5c83)
2024-04-04 07:55:33 +00:00
Earl Warren 594c9c4570 Merge pull request '[v7.0/forgejo] Port archived labels visual filter' (#3009) from bp-v7.0/forgejo-53dc9f3-1060b7c-cab47bb-4b09dd1 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3009
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-04 07:31:38 +00:00
Earl Warren f97a1ed948 Merge pull request '[v7.0/forgejo] Update dependency go to v1.22.2' (#3020) from bp-v7.0/forgejo-3509242-ded1080-e6da9c6 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3020
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-04 07:29:23 +00:00
Earl Warren 11d50ab72e [CI] pin go v1.22.2 version
Because setup-go fails to pick it up. It usually happens within 24h
and this commit can be reverted then.

(cherry picked from commit 3509242ee6)
2024-04-04 06:09:34 +00:00
Gusted b74c8015f1 [CHORE] Update golang.org/x/net
Per https://pkg.go.dev/vuln/GO-2024-2687

(cherry picked from commit ded1080bc2)
2024-04-04 06:09:34 +00:00
Renovate Bot 149efabe07 Update dependency go to v1.22.2
(cherry picked from commit e6da9c6cd9)
2024-04-04 06:09:34 +00:00
Earl Warren ccc51051c5 Merge pull request '[v7.0/forgejo] fix: set proper go directive' (#3019) from bp-v7.0/forgejo-99efe01 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3019
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-04 06:05:15 +00:00
Michael Kriese f3ea363dd2 fix: set proper go directive
(cherry picked from commit 99efe01a08)
2024-04-04 05:58:09 +00:00
Earl Warren 41d87998d7 Merge pull request '[v7.0/forgejo] [FEAT] Allow non-explicit push options' (#3008) from bp-v7.0/forgejo-f5ad6d4 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3008
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-03 20:23:42 +00:00
0ko 64bbd545a2 Add integration test for (non-)archived label properties
(cherry picked from commit 53dc9f3393)
2024-04-03 20:14:39 +00:00
0ko db1a36673e Add opacity and grayscale to archived labels
Co-authored-by: Gusted <gusted@noreply.codeberg.org>
(cherry picked from commit 1060b7cfa8)
2024-04-03 20:14:39 +00:00
0ko b068d193d0 [I18N] Improve translatability of archived labels
Allow any position and writing style of `(Archived)`.

(cherry picked from commit cab47bbb0e)
2024-04-03 20:14:39 +00:00
0ko 4ef8b139f2 [GITEA] Apply changes to archived labels
This is a squashed result of conflict resolution for the following commits from Gitea:
- 36de5b299b
- 9a93b1816e
- 712e19fa6f
- 83850cc479

It is lacking CSS rule for archived labels, though.

Changes in this commit are authored by:
- 6543
- delvh
- silverwind

(cherry picked from commit 4b09dd11ec)
2024-04-03 20:14:39 +00:00
Earl Warren e3c46541bd Merge pull request '[v7.0/forgejo] Fix primary button background inconsistency' (#3007) from bp-v7.0/forgejo-d44f290 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3007
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-03 20:01:59 +00:00
Earl Warren 0d4daa9455 Merge pull request '[v7.0/forgejo] [THEME] Update variables' (#3003) from bp-v7.0/forgejo-eae9397 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3003
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-03 20:01:25 +00:00
Gusted 5c3dff26d6 [FEAT] Allow non-explicit push options
- Currently the parsing of the push options require that `=` is present
in the value, however we shouldn't be that strict and assume if that's
not set the value is `true`.
- This allow for more natural commands, so become `-o force-push=true`
simply `-o force-push`.
- Add unit test.

(cherry picked from commit f5ad6d4be5)
2024-04-03 19:04:01 +00:00
0ko 3a46a37586 [UI] Fix primary button background inconsistency
Fixes https://codeberg.org/forgejo/forgejo/issues/2947

(cherry picked from commit d44f290750)
2024-04-03 19:03:03 +00:00
Earl Warren 0a086dffc0 Merge pull request '[v7.0/forgejo] Simplify delay writer Close' (#3005) from bp-v7.0/forgejo-6acedb9 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3005
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-03 18:58:03 +00:00
Earl Warren 648da47046 Merge pull request '[v7.0/forgejo] [BUG] Disable 'View at this point in history' for wikis' (#3004) from bp-v7.0/forgejo-8df9100 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3004
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-03 18:57:46 +00:00
Gusted 5fdadbfe08 Simplify delay writer Close
Per https://codeberg.org/forgejo/forgejo/pulls/2983#issuecomment-1730756

(cherry picked from commit 6acedb973a)
2024-04-03 17:30:44 +00:00
Gusted 858fbbaafd [BUG] Disable 'View at this point in history' for wikis
- Don't show the 'View at this point in history' button for wikis as
wikis don't have this feature.
- Adds integration test
- Resolves https://codeberg.org/forgejo/forgejo/issues/2995

(cherry picked from commit 8df9100994)
2024-04-03 17:10:28 +00:00
Gusted 4d2cd6c806 [THEME] Update variables
- Follows a579a0f318
- Remove `--color-code-sidebar-bg`.
- `--color-active-line` -> `--color-highlight-bg`.
- Add `--color-highlight-fg`.
- Resolves #2964

(cherry picked from commit eae9397fa2)
2024-04-03 16:50:58 +00:00
oliverpool 713ac6f5d5 Merge pull request '[v7.0/forgejo] [BUG] Make delay writer actually work' (#2990) from bp-v7.0/forgejo-9320ffd into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2990
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-03 11:49:19 +00:00
Earl Warren 0e2e21b584 Merge pull request '[v7.0/forgejo] [TESTS] pull review deletion (partial port of gitea#29888)' (#2992) from bp-v7.0/forgejo-6b85719 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2992
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-03 08:55:01 +00:00
oliverpool 585e6137f7 [TESTS] pull review deleted from gitea#29888
Instead of db.TruncateBeans(db.DefaultContext, &issues_model.Review{}), reviews are deleted using issue.DeleteReview

(cherry picked from commit 6b857193ff)
2024-04-03 08:13:14 +00:00
Gusted 71e63f541d [BUG] Make delay writer actually work
- Reading the code of this delay writer implemenation, it looks like
that it should only actually write content to the `io.Writer` if x
amount of time has passed by. However in practice it was always printing
the buffer even if the X amount of time didn't pass yet. This is in line
with what was being said in the issue that this was to help with
https://github.com/go-gitea/gitea/issues/9610.
- This was caused by the extra `Close()` calls which in turn caused that
when the second `Close` is called (which is done in a defer already) it
would've printed the buffer anyway. So remove the extra calls to `Close()`.
- Add unit test.

(cherry picked from commit 9320ffd2b5)
2024-04-03 07:34:49 +00:00
Earl Warren c0fb79b436 Merge pull request '[v7.0/forgejo] Adjust the signed tag verification line' (#2981) from bp-v7.0/forgejo-d58143e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2981
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-03 06:32:36 +00:00
Gergely Nagy 6051722460 Adjust the signed tag verification line
Move the signed tag verification line above the release notes, don't
disable the bottom margin, and make sure the verification line's box is
properly rounded like other boxes.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-04-02 22:03:30 +00:00
Earl Warren f3ce65a3fc Merge pull request '[v7.0/forgejo] Allow custom repo size format' (#2980) from bp-v7.0/forgejo-2f38c22 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2980
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-02 18:39:09 +00:00
Earl Warren 96b2ec888a Merge pull request '[v7.0/forgejo] Make pprof labels conformant with prometheus spec' (#2955) from bp-v7.0/forgejo-c8f515d into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2955
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 18:38:41 +00:00
0ko f3b6759ab7 [I18N] Allow custom repo size format
Following https://codeberg.org/forgejo/forgejo/pulls/2528#issuecomment-1721846

- simplify the code
- allow to have custom format in translations
- provide proper Russian translation because test depends on it
2024-04-02 18:04:32 +00:00
Earl Warren 2b8d95c8c2 Merge pull request '[v7.0/forgejo] Data size unit localization' (#2979) from bp-v7.0/forgejo-c2d137d-dae95f4-bba1884-075e0de-29cc80d-7b9c346 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2979
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-02 18:02:15 +00:00
0ko 470886bf52 Rename ByteSize to ReadableSize 2024-04-02 17:29:32 +00:00
0ko d2cd1342bf Deprecate usage of FileSize in templates 2024-04-02 17:29:32 +00:00
0ko e5212c8c96 Add integration test for TrSize 2024-04-02 17:29:32 +00:00
0ko 24552ee9ee Add unit test for TrSize 2024-04-02 17:29:32 +00:00
0ko 7b24b669ed Provide a way to translate data units 2024-04-02 17:29:32 +00:00
0ko 482658a4d0 Add data unit translations 2024-04-02 17:29:32 +00:00
Earl Warren a89e146cb0 Merge pull request '[v7.0/forgejo] [FEAT] Mark database errors in tests as failure' (#2978) from bp-v7.0/forgejo-2dabd20 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2978
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 15:53:23 +00:00
Earl Warren 7befc34e68 Merge pull request '[v7.0/forgejo] [BUG] Use correct template for commitmail error' (#2977) from bp-v7.0/forgejo-27f3904 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2977
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 15:51:31 +00:00
Earl Warren 69d9d66dda Merge pull request '[v7.0/forgejo] [TESTS] fix flacky git check-attr subtest' (#2975) from bp-v7.0/forgejo-cef39b2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2975
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 15:09:14 +00:00
Gusted 11feddc21d [FEAT] Mark database errors in tests as failure
- If the database returns a error in integration tests, it should be
marked as a failure of the test.
- Ref: https://codeberg.org/forgejo/forgejo/issues/2962 (this should
help with logging the SQL that is resulting in the error).
2024-04-02 15:00:58 +00:00
Gusted b4f566fdf5 [BUG] Use correct template for commitmail error
- Use the correct template that was given when there's an error in
retrieving which git identity should be used.
- Remove the error from the exception list.
2024-04-02 14:59:34 +00:00
Earl Warren 5a23ce083d Merge pull request '[v7.0/forgejo] Provide plural support for issue participants' (#2971) from bp-v7.0/forgejo-39b53ef into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2971
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-02 14:49:01 +00:00
Earl Warren ba4f17b1d9 Merge pull request '[v7.0/forgejo] [I18N] Translations update from Weblate (#2937)' (#2970) from earl-warren/forgejo:wip-v7.0-translations into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2970
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-02 14:48:12 +00:00
Earl Warren f25d2ce223 Merge pull request '[v7.0/forgejo] Go and JS dependencies' (#2969) from earl-warren/forgejo:wip-v7.0-dependencies into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2969
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-02 14:44:07 +00:00
oliverpool 57b19874b8 [TESTS] fix flack git check-attr flacky subtest 2024-04-02 14:27:34 +00:00
0ko 46eeb884b4 Provide plural support for issue participants 2024-04-02 11:22:34 +00:00
Codeberg Translate 0abf358c94
[I18N] Translations update from Weblate (#2937)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Mormegil <Mormegil@users.noreply.translate.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2937
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
(cherry picked from commit fc715fb31e)
2024-04-02 12:51:56 +02:00
Earl Warren 2937333e2d
[v7.0/forgejo] Go and JS dependencies 2024-04-02 12:27:01 +02:00
Gusted 7b97ea7154 Merge pull request '[v7.0/forgejo] fix: respond with JSON Resource Descriptor Content-Type per RFC7033' (#2968) from bp-v7.0/forgejo-2c2f146 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2968
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-02 10:22:01 +00:00
Earl Warren 59e42fee1c Merge pull request '[v7.0/forgejo] Render inline file permalinks' (#2951) from earl-warren/forgejo:wip-v7.0-inline-render into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2951
2024-04-02 09:57:35 +00:00
Aravinth Manivannan e13854c305 fix: respond with JSON Resource Descriptor Content-Type per RFC7033 2024-04-02 09:41:57 +00:00
Earl Warren 71153ef8b4 Merge pull request '[v7.0/forgejo] [BUG] Use correct translation on closed milestones' (#2960) from bp-v7.0/forgejo-095d845 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2960
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 07:17:46 +00:00
Earl Warren 7db4e374ca Merge pull request '[v7.0/forgejo] [FEAT] Configure if protected branch rule should apply to admins' (#2956) from bp-v7.0/forgejo-79b7089 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2956
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-02 05:51:43 +00:00
Gusted 2e5aa42f20 [BUG] Use correct translation on closed milestones
- Uh self explanatory? Fix a typo.
- Regression of 365bb77a54
- Resolves https://codeberg.org/Codeberg/Community/issues/1526
2024-04-02 05:33:45 +00:00
Gusted 7a783c3132 Merge pull request '[v7.0/forgejo] [TESTS] prevent overriding testlogger when calling mainApp' (#2952) from earl-warren/forgejo:wip-v7.0-non_failing_test into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2952
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-04-01 20:33:17 +00:00
Gusted 029bcd361a [FEAT] Configure if protected branch rule should apply to admins
- Currently protected branch rules do not apply to admins, however in
some cases (like in the case of Forgejo project) you might also want to
apply these rules to admins to avoid accidental merges.
- Add new option to configure this on a per-rule basis.
- Adds integration tests.
- Resolves #65
2024-04-01 19:31:43 +00:00
TheFox0x7 1a0c9df87f [FIX] make pprof labels conformant with prometheus spec 2024-04-01 18:22:11 +00:00
oliverpool ce74e66b95
[TESTS] disable test failure on log.Error for now
(cherry picked from commit 62148859b9)
2024-04-01 20:19:15 +02:00
Earl Warren cf460b8b5f
[TESTS] do not include line numbers in the error whitelist
They are bound to change. The worst that can happen is that the same
error happens somewhere else and is ignored although it should
not. Which is not worse than the previous situation which was to
ignore all errors anyway.

Also be more liberal about what is ignored. Some error messages are
very long and may contain elements with some variance. It is enough to
have an ignored that is specific.

(cherry picked from commit a60b34a451)
2024-04-01 20:19:03 +02:00
oliverpool 4706b644f8
[TESTS] deliver webhooks on localhost
(cherry picked from commit bd97bd875d)
2024-04-01 16:36:04 +02:00
oliverpool b6dccc0fd4
populate testlogger ignoreList
(cherry picked from commit 0532a91b1a)
2024-04-01 16:36:04 +02:00
oliverpool 966faddee4
[TESTS] prevent overriding testlogger when calling mainApp
(cherry picked from commit 5785ae72c7)
2024-04-01 16:36:04 +02:00
Earl Warren c01935e9d0 Merge pull request '[v7.0/forgejo] Highlight signed tags like signed commits' (#2950) from bp-v7.0/forgejo-bc08007-432ff7d-cd19564 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2950
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-01 14:29:24 +00:00
Mai-Lapyst 22aedc6c96
[v7.0/forgejo] Render inline file permalinks
Backport: https://codeberg.org/forgejo/forgejo/pulls/2669

(cherry picked from commit 1d3240887c)
(cherry picked from commit 781a37fbe1)
(cherry picked from commit 8309f008c2)
(cherry picked from commit fae8d9f70d)
(cherry picked from commit 6721cba75b)
(cherry picked from commit 562e5cdf32)
(cherry picked from commit d789d33229)
(cherry picked from commit 8218e80bfc)
(cherry picked from commit 10bca456a9)
(cherry picked from commit db6f6281fc)
(cherry picked from commit ed8e8a792e)
(cherry picked from commit d6428f92ce)
(cherry picked from commit 069d87b80f)
(cherry picked from commit 2b6546adc9)
(cherry picked from commit 4c7cb0a5d2)
(cherry picked from commit 7e0014dd13)
(cherry picked from commit 16a8658878)
(cherry picked from commit 6e98bacbbd)
2024-04-01 16:15:58 +02:00
Gergely Nagy 4dd475dfe5 models/asymkey: Implement Tag verification
This is, in large part, a refactoring: we rename `CommitVerification` to
`ObjectVerification`, and adjust `ParseObjectWithSignature` (previously
`ParseCommitWithSignature`) to work on an object, rather than a commit.

This in turn, lets us implement `ParseTagWithSignature` on top of it, so
commit & tag signature verification will share most of the code.

Work sponsored by @glts.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-04-01 13:42:11 +00:00
Gergely Nagy 923035e418 Highlight signed tags like signed commits
This makes signed tags show a badge in the tag list similar to signed
commits in the commit list, and a more verbose block when viewing a
single tag. Works for both GPG and SSH signed tags.

Fixes #1316.

Work sponsored by @glts.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-04-01 13:42:11 +00:00
Gergely Nagy 9ecd041975 An integration test for SSH signed tags
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-04-01 13:42:11 +00:00
forgejo-backport-action 9f80081795 [v7.0/forgejo] [REFACTOR] git attribute: test proper cancellation and unify nul-byte reader (#2939)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/2906

Following #2763 (refactor of git check-attr)
and #2866 (wrong log.Error format in check-attr)

- refactors the `nul-byte` reader to be used in both the streaming and one-off cases.
- add test for some failure cases
- don't log the error returned by `cmd.Run`, but return it to the `CheckPath` caller (which can then decide what to do with it).

This should solve the following flaky `log.Error` (or at least move it to the caller, instead of being inside a random goroutine):

https://codeberg.org/forgejo/forgejo/actions/runs/9541/jobs/5#jobstep-7-839

> FATAL ERROR: log.Error has been called: 2024/03/28 14:30:33 ...it/repo_attribute.go:313:func2() [E] Unable to open checker for 3fa2f829675543ecfc16b2891aebe8bf0608a8f4. Error: failed to run attr-check. Error: exit status 128
        Stderr: fatal: this operation must be run in a work tree

Co-authored-by: oliverpool <git@olivier.pfad.fr>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2939
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-04-01 06:44:46 +00:00
Gusted 4cb3f331a2 Merge pull request '[v7.0/forgejo] [BUG] Consistent styling for Sort filter' (#2938) from bp-v7.0/forgejo-b7d55de into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2938
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-31 21:30:51 +00:00
Gusted fd8f51f2b6 [BUG] Consistent styling for Sort filter
- The dropdowns that contain filters for issues and pull requests are
currently not styled with the `small` class, which causes a smaller font
size to be set. Remove it for the `Sort` filter to make it consistent
and make it _more_ readable.
- Resolves #2914
2024-03-31 20:59:35 +00:00
Earl Warren e628d0e54b Merge pull request '[v7.0/forgejo] Fix New issue button position consistency' (#2930) from bp-v7.0/forgejo-892fc82 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2930
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-31 09:45:48 +00:00
Earl Warren ece5c97931 Merge pull request '[v7.0/forgejo] English improvements' (#2929) from bp-v7.0/forgejo-d183d32 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2929
2024-03-31 09:11:47 +00:00
0ko b9dbd93ebc Fix New issue button consistency
Fixes https://codeberg.org/forgejo/forgejo/issues/2613
Based on https://codeberg.org/forgejo/forgejo/issues/2613#issuecomment-1654709

- add new class `list-header-issues`;
- add rules that fix button position;
- use variable to keep the vertical offset constant;
- fix gap for edit button.

Co-authored-by: Gusted <gusted@noreply.codeberg.org>
2024-03-31 08:20:16 +00:00
0ko 66d1cd89d1 [I18N] English improvements 2024-03-31 08:17:16 +00:00
Earl Warren 45f39ce839 Merge pull request '[v7.0/forgejo] Fix accessibility and translatability of repo explore counters' (#2919) from bp-v7.0/forgejo-cbd067e into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2919
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-31 07:57:10 +00:00
Earl Warren f0a2da40ff Merge pull request '[v7.0/forgejo] [CI] backport: show event information for debug purposes' (#2927) from bp-v7.0/forgejo-7aa686d into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2927
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-31 07:56:28 +00:00
Earl Warren 60a82b0890 Merge pull request '[v7.0/forgejo] [BUG] Fix selector inner radius' (#2921) from bp-v7.0/forgejo-177d8e7 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2921
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-31 07:56:02 +00:00
Earl Warren 6b560544fb Merge pull request '[v7.0/forgejo] [REFACTOR] add Icon to webhook.Interface' (#2928) from bp-v7.0/forgejo-69115ba-120fa61 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2928
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-31 07:55:11 +00:00
Earl Warren 4a4bd75989 Merge pull request '[v7.0/forgejo] [RELEASE] GITEA_VERSION is a fallback for FORGEJO_VERSION' (#2922) from bp-v7.0/forgejo-869795a into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2922
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-03-31 07:24:29 +00:00
oliverpool 84eeab59af [REFACTOR] add Icon to webhook.Interface 2024-03-31 07:20:19 +00:00
oliverpool 7f03fdf9f9 [REFACTOR] use Icon from interface in webhook list 2024-03-31 07:20:18 +00:00
Earl Warren 6b2d02528f Merge pull request '[v7.0/fogejo] [I18N] Translations update from Weblate (#2841)' (#2926) from earl-warren/forgejo:wip-i18n-backport into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2926
2024-03-31 07:09:28 +00:00
Earl Warren 92acbb0a8e [CI] backport: show event information for debug purposes
It will help figure out why two runs of testing happen when a backport
PR is open.

Refs: https://codeberg.org/forgejo/forgejo/pulls/2922
Refs: https://codeberg.org/forgejo/forgejo/issues/2009
2024-03-31 07:01:34 +00:00
Codeberg Translate 5503db386e
[I18N] Translations update from Weblate (#2841)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: kita <kita@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <Fjuro@users.noreply.translate.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: cherryb <cherryb@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2841
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
(cherry picked from commit 03cac08b1d)
2024-03-31 08:34:41 +02:00
Earl Warren 005a9c7850 [RELEASE] GITEA_VERSION is a fallback for FORGEJO_VERSION
Existing Forgejo packages may rely on setting GITEA_VERSION to specify
the version to build if:

* they do not build from the git repository with the proper tag
* they build from a source tarbal that does not have a VERSION file

With 7.0 the logic of setting the version was modified in the
`[RELEASE] Gitea version is for interoperability only` commit and
ignores this variable which creates an unecessary breaking change.

If GITEA_VERSION is set, the versions will be set on 7.0 exactly as
they would have with version before and included 1.21.

* If GITEA_VERSION is not set, all versions are the same
* If GITEA_VERSION is set, there is a distinction between the version
  set in the binary are returned by the Gitea API and the
  version returned by the Forgejo API which includes metadata.

Before:

$ make GITEA_VERSION=7.0.0 show-version-full
7.0.0-dev-1809-cd6fa771ab+gitea-1.22.0
$ make GITEA_VERSION=7.0.0 show-version-api
7.0.0-dev-1809-cd6fa771ab+gitea-1.22.0

After:

$ make GITEA_VERSION=7.0.0 show-version-full
7.0.0
$ make GITEA_VERSION=7.0.0 show-version-api
7.0.0+gitea-1.22.0
2024-03-30 22:39:37 +00:00
Earl Warren d0dccaec66 Merge pull request '[v7.0/forgejo] [BUG] Don't color dot literal color names' (#2918) from bp-v7.0/forgejo-80f22ab into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2918
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-30 22:38:16 +00:00
0ko ea0e8caa6f Fix selector inner radius
- Fixes https://codeberg.org/forgejo/forgejo/issues/2835
2024-03-30 22:35:38 +00:00
0ko 9b4d32446c Fix accessibility and translatability of repo explore counters
Progression of: 9e69ef9c51
Regression of: 65e190ae8b (diff-8d94e33cfe70fa6443d059b9c34e3f8064514816)
2024-03-30 22:27:38 +00:00
Earl Warren ce5f1b942f Merge pull request '[v7.0/forgejo] [CI] allow backports to be launched on merged pull requests' (#2904) from bp-v7.0/forgejo-d8ab364 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2904
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-30 22:23:02 +00:00
Gusted e428231b38 [BUG] Don't color dot literal color names
- Colordots are generated for colors in inline code, such as `red`,
`rgb(255, 0, 124)`, `#ffaabb` and `hsl(124, 52%, 50%)`. However this
shouldn't be doon for literal color names as these can be too common
assiocated with non-color related stuff _and matches the behavior of
some other forge_.
- Move the regexes from bluemonday to Forgejo and do the checking
ourselves.
- Adds unit tests.
- Resolves https://codeberg.org/Codeberg/Community/issues/1510
2024-03-30 22:12:40 +00:00
Gusted 03df59ec95 Merge pull request '[v7.0/forgejo] [BUG] Render emojis in labels in issue info popup' (#2907) from bp-v7.0/forgejo-ddc2417 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2907
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-03-30 16:07:12 +00:00
Gusted a1bce73f5c [BUG] Render emojis in labels in issue info popup
- Currently emojis that are part of the label's name aren't rendered
when shown in the popup that you get when you hover over issue
references.
- This patch fixes that by rendering the emoji.
- Adds CSS to not make the emoji big in the label.
- Resolves #1531
2024-03-30 14:31:06 +00:00
Earl Warren 19f7eb657b [CI] allow backports to be launched on merged pull requests
The intention was good initially but the expression was wrong for two
reasons:

* When a pull_request event is received for a labeled action, the
  match should be github.event.action == 'label_updated' and not
  'labeled'
* The event does not have a github.event.label field and
  contains(github.event.label.name, 'backport/v') will always be
  false.

Since the expression is only evaluated in the context of a merged pull
request, either because it was just closed or because it was labeled
after the fact, the only verification that is needed is to assert that
there is at least one `backport/v*` label.
2024-03-30 13:19:01 +00:00
1070 changed files with 11841 additions and 37263 deletions

View file

@ -2,10 +2,9 @@ root = "."
tmp_dir = ".air"
[build]
pre_cmd = ["killall -9 gitea 2>/dev/null || true"] # kill off potential zombie processes from previous runs
cmd = "make --no-print-directory backend"
bin = "gitea"
delay = 2000
delay = 1000
include_ext = ["go", "tmpl"]
include_file = ["main.go"]
include_dir = ["cmd", "models", "modules", "options", "routers", "services"]
@ -16,14 +15,8 @@ exclude_dir = [
"modules/avatar/testdata",
"modules/git/tests",
"modules/migration/file_format_testdata",
"modules/markup/tests/repo/repo1_filepreview",
"routers/private/tests",
"services/gitdiff/testdata",
"services/migrations/testdata",
"services/webhook/sourcehut/testdata",
]
exclude_regex = ["_test.go$", "_gen.go$"]
stop_on_error = true
[log]
main_only = true

57
.changelog.yml Normal file
View file

@ -0,0 +1,57 @@
# The full repository name
repo: go-gitea/gitea
# Service type (gitea or github)
service: github
# Base URL for Gitea instance if using gitea service type (optional)
# Default: https://gitea.com
base-url:
# Changelog groups and which labeled PRs to add to each group
groups:
-
name: BREAKING
labels:
- pr/breaking
-
name: SECURITY
labels:
- topic/security
-
name: FEATURES
labels:
- type/feature
-
name: API
labels:
- modifies/api
-
name: ENHANCEMENTS
labels:
- type/enhancement
- type/refactoring
- topic/ui
-
name: BUGFIXES
labels:
- type/bug
-
name: TESTING
labels:
- type/testing
-
name: BUILD
labels:
- topic/build
- topic/code-linting
-
name: DOCS
labels:
- type/docs
-
name: MISC
default: true
# regex indicating which labels to skip for the changelog
skip-labels: skip-changelog|backport\/.+

View file

@ -1,350 +1,344 @@
code.gitea.io/gitea/cmd
NoMainListener
code.gitea.io/gitea/cmd/forgejo
ContextSetNoInit
ContextSetNoExit
ContextSetStderr
ContextGetStderr
ContextSetStdout
ContextSetStdin
code.gitea.io/gitea/models
IsErrUpdateTaskNotExist
ErrUpdateTaskNotExist.Error
ErrUpdateTaskNotExist.Unwrap
IsErrSHANotFound
IsErrMergeDivergingFastForwardOnly
GetYamlFixturesAccess
code.gitea.io/gitea/models/actions
ScheduleList.GetUserIDs
ScheduleList.GetRepoIDs
ScheduleList.LoadTriggerUser
ScheduleList.LoadRepos
code.gitea.io/gitea/models/asymkey
ErrGPGKeyAccessDenied.Error
ErrGPGKeyAccessDenied.Unwrap
HasDeployKey
code.gitea.io/gitea/models/auth
GetSourceByName
GetWebAuthnCredentialByID
WebAuthnCredentials
code.gitea.io/gitea/models/db
TruncateBeans
InTransaction
DumpTables
code.gitea.io/gitea/models/dbfs
file.renameTo
Create
Rename
code.gitea.io/gitea/models/forgefed
GetFederationHost
code.gitea.io/gitea/models/forgejo/semver
GetVersion
SetVersionString
SetVersion
code.gitea.io/gitea/models/git
RemoveDeletedBranchByID
code.gitea.io/gitea/models/issues
IsErrUnknownDependencyType
ErrNewIssueInsert.Error
IsErrIssueWasClosed
ChangeMilestoneStatus
code.gitea.io/gitea/models/migrations/base
removeAllWithRetry
newXORMEngine
deleteDB
PrepareTestEnv
MainTest
code.gitea.io/gitea/models/organization
GetTeamNamesByID
UpdateTeamUnits
SearchMembersOptions.ToConds
UsersInTeamsCount
code.gitea.io/gitea/models/perm/access
GetRepoWriters
code.gitea.io/gitea/models/project
UpdateColumnSorting
ChangeProjectStatus
code.gitea.io/gitea/models/repo
DeleteAttachmentsByIssue
releaseSorter.Len
releaseSorter.Less
releaseSorter.Swap
SortReleases
FindReposMapByIDs
IsErrTopicNotExist
ErrTopicNotExist.Error
ErrTopicNotExist.Unwrap
GetTopicByName
WatchRepoMode
code.gitea.io/gitea/models/unittest
CheckConsistencyFor
checkForConsistency
GetXORMEngine
OverrideFixtures
InitFixtures
LoadFixtures
Copy
CopyDir
NewMockWebServer
NormalizedFullPath
FixturesDir
fatalTestError
InitSettings
MainTest
CreateTestEngine
PrepareTestDatabase
PrepareTestEnv
Cond
OrderBy
LoadBeanIfExists
BeanExists
AssertExistsAndLoadBean
GetCount
AssertNotExistsBean
AssertExistsIf
AssertSuccessfulInsert
AssertCount
AssertInt64InRange
code.gitea.io/gitea/models/user
IsErrPrimaryEmailCannotDelete
ErrUserInactive.Error
ErrUserInactive.Unwrap
IsErrExternalLoginUserAlreadyExist
IsErrExternalLoginUserNotExist
NewFederatedUser
IsErrUserSettingIsNotExist
GetUserAllSettings
DeleteUserSetting
GetUserEmailsByNames
GetUserNamesByIDs
code.gitea.io/gitea/modules/assetfs
Bindata
code.gitea.io/gitea/modules/auth/password/hash
DummyHasher.HashWithSaltBytes
NewDummyHasher
code.gitea.io/gitea/modules/auth/password/pwn
WithHTTP
code.gitea.io/gitea/modules/base
SetupGiteaRoot
code.gitea.io/gitea/modules/cache
GetInt
WithNoCacheContext
RemoveContextData
code.gitea.io/gitea/modules/charset
BreakWriter.Write
code.gitea.io/gitea/modules/emoji
ReplaceCodes
code.gitea.io/gitea/modules/eventsource
Event.String
code.gitea.io/gitea/modules/forgefed
GetItemByType
JSONUnmarshalerFn
NotEmpty
ToRepository
OnRepository
code.gitea.io/gitea/modules/git
AllowLFSFiltersArgs
AddChanges
AddChangesWithArgs
CommitChanges
CommitChangesWithArgs
IsErrExecTimeout
ErrExecTimeout.Error
ErrUnsupportedVersion.Error
SetUpdateHook
openRepositoryWithDefaultContext
IsTagExist
ToEntryMode
LimitedReaderCloser.Read
LimitedReaderCloser.Close
code.gitea.io/gitea/modules/gitgraph
Parser.Reset
code.gitea.io/gitea/modules/gitrepo
GetBranchCommitID
GetWikiDefaultBranch
code.gitea.io/gitea/modules/graceful
Manager.TerminateContext
Manager.Err
Manager.Value
Manager.Deadline
code.gitea.io/gitea/modules/hcaptcha
WithHTTP
code.gitea.io/gitea/modules/json
StdJSON.Marshal
StdJSON.Unmarshal
StdJSON.NewEncoder
StdJSON.NewDecoder
StdJSON.Indent
code.gitea.io/gitea/modules/markup
GetRendererByType
RenderString
IsMarkupFile
code.gitea.io/gitea/modules/markup/console
Render
RenderString
code.gitea.io/gitea/modules/markup/markdown
IsDetails
IsSummary
IsTaskCheckBoxListItem
IsIcon
RenderRawString
code.gitea.io/gitea/modules/markup/markdown/math
WithInlineDollarParser
WithBlockDollarParser
code.gitea.io/gitea/modules/markup/mdstripper
stripRenderer.AddOptions
StripMarkdown
code.gitea.io/gitea/modules/markup/orgmode
RenderString
code.gitea.io/gitea/modules/private
ActionsRunnerRegister
code.gitea.io/gitea/modules/process
Manager.ExecTimeout
code.gitea.io/gitea/modules/queue
newBaseChannelSimple
newBaseChannelUnique
newBaseRedisSimple
newBaseRedisUnique
testStateRecorder.Records
testStateRecorder.Reset
newWorkerPoolQueueForTest
code.gitea.io/gitea/modules/queue/lqinternal
QueueItemIDBytes
QueueItemKeyBytes
ListLevelQueueKeys
code.gitea.io/gitea/modules/setting
NewConfigProviderFromData
GitConfigType.GetOption
InitLoggersForTest
code.gitea.io/gitea/modules/storage
ErrInvalidConfiguration.Error
IsErrInvalidConfiguration
code.gitea.io/gitea/modules/structs
ParseCreateHook
ParsePushHook
code.gitea.io/gitea/modules/sync
StatusTable.Start
StatusTable.IsRunning
code.gitea.io/gitea/modules/testlogger
testLoggerWriterCloser.pushT
testLoggerWriterCloser.Log
testLoggerWriterCloser.recordError
testLoggerWriterCloser.printMsg
testLoggerWriterCloser.popT
testLoggerWriterCloser.Reset
PrintCurrentTest
Printf
NewTestLoggerWriter
TestLogEventWriter.Base
TestLogEventWriter.GetLevel
TestLogEventWriter.GetWriterName
TestLogEventWriter.GetWriterType
TestLogEventWriter.Run
code.gitea.io/gitea/modules/timeutil
GetExecutableModTime
MockSet
MockUnset
code.gitea.io/gitea/modules/translation
MockLocale.Language
MockLocale.TrString
MockLocale.Tr
MockLocale.TrN
MockLocale.TrSize
MockLocale.PrettyNumber
code.gitea.io/gitea/modules/util/filebuffer
CreateFromReader
code.gitea.io/gitea/modules/validation
IsErrNotValid
code.gitea.io/gitea/modules/web
RouteMock
RouteMockReset
code.gitea.io/gitea/modules/web/middleware
DeleteLocaleCookie
code.gitea.io/gitea/routers/web
NotFound
code.gitea.io/gitea/routers/web/org
MustEnableProjects
code.gitea.io/gitea/services/context
GetPrivateContext
code.gitea.io/gitea/services/convert
ToSecret
code.gitea.io/gitea/services/forms
DeadlineForm.Validate
code.gitea.io/gitea/services/pull
IsCommitStatusContextSuccess
code.gitea.io/gitea/services/repository
IsErrForkAlreadyExist
code.gitea.io/gitea/services/repository/archiver
ArchiveRepository
code.gitea.io/gitea/services/repository/files
ContentType.String
GetFileResponseFromCommit
TemporaryUploadRepository.GetLastCommit
TemporaryUploadRepository.GetLastCommitByRef
code.gitea.io/gitea/services/webhook
NewNotifier
package "code.gitea.io/gitea/cmd"
func NoMainListener
package "code.gitea.io/gitea/cmd/forgejo"
func ContextSetNoInit
func ContextSetNoExit
func ContextSetStderr
func ContextGetStderr
func ContextSetStdout
func ContextSetStdin
package "code.gitea.io/gitea/models"
func IsErrUpdateTaskNotExist
func (ErrUpdateTaskNotExist).Error
func (ErrUpdateTaskNotExist).Unwrap
func IsErrSHANotFound
func IsErrMergeDivergingFastForwardOnly
func GetYamlFixturesAccess
package "code.gitea.io/gitea/models/actions"
func (ScheduleList).GetUserIDs
func (ScheduleList).GetRepoIDs
func (ScheduleList).LoadTriggerUser
func (ScheduleList).LoadRepos
func GetVariableByID
package "code.gitea.io/gitea/models/asymkey"
func (ErrGPGKeyAccessDenied).Error
func (ErrGPGKeyAccessDenied).Unwrap
func HasDeployKey
package "code.gitea.io/gitea/models/auth"
func GetSourceByName
func GetWebAuthnCredentialByID
func WebAuthnCredentials
package "code.gitea.io/gitea/models/db"
func TruncateBeans
func InTransaction
func DumpTables
package "code.gitea.io/gitea/models/dbfs"
func (*file).renameTo
func Create
func Rename
package "code.gitea.io/gitea/models/forgejo/semver"
func GetVersion
func SetVersionString
func SetVersion
package "code.gitea.io/gitea/models/git"
func RemoveDeletedBranchByID
package "code.gitea.io/gitea/models/issues"
func IsErrUnknownDependencyType
func (ErrNewIssueInsert).Error
func IsErrIssueWasClosed
func ChangeMilestoneStatus
package "code.gitea.io/gitea/models/migrations/base"
func removeAllWithRetry
func newXORMEngine
func deleteDB
func PrepareTestEnv
func MainTest
package "code.gitea.io/gitea/models/organization"
func GetTeamNamesByID
func UpdateTeamUnits
func (SearchMembersOptions).ToConds
func UsersInTeamsCount
package "code.gitea.io/gitea/models/perm/access"
func GetRepoWriters
package "code.gitea.io/gitea/models/project"
func UpdateBoardSorting
func ChangeProjectStatus
package "code.gitea.io/gitea/models/repo"
func DeleteAttachmentsByIssue
func (*releaseSorter).Len
func (*releaseSorter).Less
func (*releaseSorter).Swap
func SortReleases
func FindReposMapByIDs
func (SearchOrderBy).String
func IsErrTopicNotExist
func (ErrTopicNotExist).Error
func (ErrTopicNotExist).Unwrap
func GetTopicByName
func WatchRepoMode
package "code.gitea.io/gitea/models/unittest"
func CheckConsistencyFor
func checkForConsistency
func GetXORMEngine
func OverrideFixtures
func InitFixtures
func LoadFixtures
func Copy
func CopyDir
func NewMockWebServer
func NormalizedFullPath
func FixturesDir
func fatalTestError
func InitSettings
func MainTest
func CreateTestEngine
func PrepareTestDatabase
func PrepareTestEnv
func Cond
func OrderBy
func LoadBeanIfExists
func BeanExists
func AssertExistsAndLoadBean
func GetCount
func AssertNotExistsBean
func AssertExistsIf
func AssertSuccessfulInsert
func AssertCount
func AssertInt64InRange
package "code.gitea.io/gitea/models/user"
func IsErrPrimaryEmailCannotDelete
func (ErrUserInactive).Error
func (ErrUserInactive).Unwrap
func IsErrExternalLoginUserAlreadyExist
func IsErrExternalLoginUserNotExist
func IsErrUserSettingIsNotExist
func GetUserAllSettings
func DeleteUserSetting
func GetUserEmailsByNames
func GetUserNamesByIDs
package "code.gitea.io/gitea/modules/activitypub"
func CurrentTime
func containsRequiredHTTPHeaders
func NewClient
func (*Client).NewRequest
func (*Client).Post
func GetPrivateKey
package "code.gitea.io/gitea/modules/assetfs"
func Bindata
package "code.gitea.io/gitea/modules/auth/password/hash"
func (*DummyHasher).HashWithSaltBytes
func NewDummyHasher
package "code.gitea.io/gitea/modules/auth/password/pwn"
func WithHTTP
package "code.gitea.io/gitea/modules/base"
func SetupGiteaRoot
package "code.gitea.io/gitea/modules/cache"
func GetInt
func WithNoCacheContext
func RemoveContextData
package "code.gitea.io/gitea/modules/charset"
func (*BreakWriter).Write
package "code.gitea.io/gitea/modules/emoji"
func ReplaceCodes
package "code.gitea.io/gitea/modules/eventsource"
func (*Event).String
package "code.gitea.io/gitea/modules/git"
func AllowLFSFiltersArgs
func AddChanges
func AddChangesWithArgs
func CommitChanges
func CommitChangesWithArgs
func IsErrExecTimeout
func (ErrExecTimeout).Error
func (ErrUnsupportedVersion).Error
func SetUpdateHook
func openRepositoryWithDefaultContext
func IsTagExist
func ToEntryMode
func (*LimitedReaderCloser).Read
func (*LimitedReaderCloser).Close
package "code.gitea.io/gitea/modules/gitgraph"
func (*Parser).Reset
package "code.gitea.io/gitea/modules/gitrepo"
func GetBranchCommitID
func GetWikiDefaultBranch
package "code.gitea.io/gitea/modules/graceful"
func (*Manager).TerminateContext
func (*Manager).Err
func (*Manager).Value
func (*Manager).Deadline
package "code.gitea.io/gitea/modules/hcaptcha"
func WithHTTP
package "code.gitea.io/gitea/modules/json"
func (StdJSON).Marshal
func (StdJSON).Unmarshal
func (StdJSON).NewEncoder
func (StdJSON).NewDecoder
func (StdJSON).Indent
package "code.gitea.io/gitea/modules/markup"
func IsSameDomain
func GetRendererByType
func RenderString
func IsMarkupFile
package "code.gitea.io/gitea/modules/markup/console"
func Render
func RenderString
package "code.gitea.io/gitea/modules/markup/markdown"
func IsDetails
func IsSummary
func IsTaskCheckBoxListItem
func IsIcon
func RenderRawString
package "code.gitea.io/gitea/modules/markup/markdown/math"
func WithInlineDollarParser
func WithBlockDollarParser
package "code.gitea.io/gitea/modules/markup/mdstripper"
func StripMarkdown
package "code.gitea.io/gitea/modules/markup/orgmode"
func RenderString
package "code.gitea.io/gitea/modules/private"
func ActionsRunnerRegister
package "code.gitea.io/gitea/modules/process"
func (*Manager).ExecTimeout
package "code.gitea.io/gitea/modules/queue"
func newBaseChannelSimple
func newBaseChannelUnique
func newBaseRedisSimple
func newBaseRedisUnique
func newWorkerPoolQueueForTest
package "code.gitea.io/gitea/modules/queue/lqinternal"
func QueueItemIDBytes
func QueueItemKeyBytes
func ListLevelQueueKeys
package "code.gitea.io/gitea/modules/setting"
func NewConfigProviderFromData
func (*GitConfigType).GetOption
func InitLoggersForTest
package "code.gitea.io/gitea/modules/storage"
func (ErrInvalidConfiguration).Error
func IsErrInvalidConfiguration
package "code.gitea.io/gitea/modules/structs"
func ParseCreateHook
func ParsePushHook
package "code.gitea.io/gitea/modules/sync"
func (*StatusTable).Start
func (*StatusTable).IsRunning
package "code.gitea.io/gitea/modules/testlogger"
func (*testLoggerWriterCloser).pushT
func (*testLoggerWriterCloser).Log
func (*testLoggerWriterCloser).recordError
func (*testLoggerWriterCloser).printMsg
func (*testLoggerWriterCloser).popT
func (*testLoggerWriterCloser).Reset
func PrintCurrentTest
func Printf
func NewTestLoggerWriter
func (*TestLogEventWriter).Base
func (*TestLogEventWriter).GetLevel
func (*TestLogEventWriter).GetWriterName
func (*TestLogEventWriter).GetWriterType
func (*TestLogEventWriter).Run
package "code.gitea.io/gitea/modules/timeutil"
func GetExecutableModTime
func MockSet
func MockUnset
package "code.gitea.io/gitea/modules/translation"
func (MockLocale).Language
func (MockLocale).TrString
func (MockLocale).Tr
func (MockLocale).TrN
func (MockLocale).TrSize
func (MockLocale).PrettyNumber
package "code.gitea.io/gitea/modules/util/filebuffer"
func CreateFromReader
package "code.gitea.io/gitea/modules/web"
func RouteMock
func RouteMockReset
package "code.gitea.io/gitea/modules/web/middleware"
func DeleteLocaleCookie
package "code.gitea.io/gitea/routers/web"
func NotFound
package "code.gitea.io/gitea/routers/web/org"
func MustEnableProjects
package "code.gitea.io/gitea/services/context"
func GetPrivateContext
package "code.gitea.io/gitea/services/convert"
func ToSecret
package "code.gitea.io/gitea/services/forms"
func (*DeadlineForm).Validate
package "code.gitea.io/gitea/services/pull"
func IsCommitStatusContextSuccess
package "code.gitea.io/gitea/services/repository"
func IsErrForkAlreadyExist
package "code.gitea.io/gitea/services/repository/archiver"
func ArchiveRepository
package "code.gitea.io/gitea/services/repository/files"
func (*ContentType).String
func GetFileResponseFromCommit
func (*TemporaryUploadRepository).GetLastCommit
func (*TemporaryUploadRepository).GetLastCommitByRef
package "code.gitea.io/gitea/services/webhook"
func NewNotifier

View file

@ -1,17 +1,16 @@
{
"name": "Gitea DevContainer",
"image": "mcr.microsoft.com/devcontainers/go:1.22-bullseye",
"image": "mcr.microsoft.com/devcontainers/go:1.21-bullseye",
"features": {
// installs nodejs into container
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
},
"ghcr.io/devcontainers/features/git-lfs:1.2.1": {},
"ghcr.io/devcontainers/features/git-lfs:1.1.0": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
},
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
}
},
"customizations": {
"vscode": {
@ -26,9 +25,8 @@
"Vue.volar",
"ms-azuretools.vscode-docker",
"vitest.explorer",
"cweijan.vscode-database-client2",
"GitHub.vscode-pull-request-github",
"Azurite.azurite"
"qwtel.sqlite-viewer",
"GitHub.vscode-pull-request-github"
]
}
},

View file

@ -77,6 +77,7 @@ cpu.out
/public/assets/css
/public/assets/fonts
/public/assets/img/avatar
/public/assets/img/webpack
/vendor
/web_src/fomantic/node_modules
/web_src/fomantic/build/*
@ -94,9 +95,6 @@ cpu.out
/.air
/.go-licenses
# Files and folders that were previously generated
/public/assets/img/webpack
# Snapcraft
snap/.snapcraft/
parts/

View file

@ -9,7 +9,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{*.{go,tmpl,html},Makefile,go.mod}]
[*.{go,tmpl,html}]
indent_style = tab
[templates/custom/*.tmpl]
@ -21,6 +21,9 @@ indent_style = space
[templates/user/auth/oidc_wellknown.tmpl]
indent_style = space
[Makefile]
indent_style = tab
[*.svg]
insert_final_newline = false

View file

@ -3,8 +3,6 @@ reportUnusedDisableDirectives: true
ignorePatterns:
- /web_src/js/vendor
- /web_src/fomantic
- /public/assets/js
parserOptions:
sourceType: module
@ -311,7 +309,7 @@ rules:
jquery/no-merge: [2]
jquery/no-param: [2]
jquery/no-parent: [0]
jquery/no-parents: [2]
jquery/no-parents: [0]
jquery/no-parse-html: [2]
jquery/no-prop: [2]
jquery/no-proxy: [2]
@ -320,8 +318,8 @@ rules:
jquery/no-show: [2]
jquery/no-size: [2]
jquery/no-sizzle: [0]
jquery/no-slide: [2]
jquery/no-submit: [2]
jquery/no-slide: [0]
jquery/no-submit: [0]
jquery/no-text: [0]
jquery/no-toggle: [2]
jquery/no-trigger: [0]
@ -459,7 +457,7 @@ rules:
no-jquery/no-other-utils: [2]
no-jquery/no-param: [2]
no-jquery/no-parent: [0]
no-jquery/no-parents: [2]
no-jquery/no-parents: [0]
no-jquery/no-parse-html-literal: [0]
no-jquery/no-parse-html: [2]
no-jquery/no-parse-json: [2]
@ -538,7 +536,7 @@ rules:
no-underscore-dangle: [0]
no-unexpected-multiline: [2]
no-unmodified-loop-condition: [2]
no-unneeded-ternary: [2]
no-unneeded-ternary: [0]
no-unreachable-loop: [2]
no-unreachable: [2]
no-unsafe-finally: [2]
@ -717,14 +715,12 @@ rules:
unicorn/import-style: [0]
unicorn/new-for-builtins: [2]
unicorn/no-abusive-eslint-disable: [0]
unicorn/no-anonymous-default-export: [0]
unicorn/no-array-callback-reference: [0]
unicorn/no-array-for-each: [2]
unicorn/no-array-method-this-argument: [2]
unicorn/no-array-push-push: [2]
unicorn/no-array-reduce: [2]
unicorn/no-await-expression-member: [0]
unicorn/no-await-in-promise-methods: [2]
unicorn/no-console-spaces: [0]
unicorn/no-document-cookie: [2]
unicorn/no-empty-file: [2]
@ -741,7 +737,6 @@ rules:
unicorn/no-null: [0]
unicorn/no-object-as-default-parameter: [0]
unicorn/no-process-exit: [0]
unicorn/no-single-promise-in-promise-methods: [2]
unicorn/no-static-only-class: [2]
unicorn/no-thenable: [2]
unicorn/no-this-assignment: [2]

View file

@ -1,4 +1,4 @@
FROM code.forgejo.org/oci/alpine:3.20
FROM code.forgejo.org/oci/alpine:3.19
ARG RELEASE_VERSION=unkown
LABEL maintainer="contact@forgejo.org" \
org.opencontainers.image.version="${RELEASE_VERSION}"

View file

@ -45,13 +45,39 @@ jobs:
cat <<'EOF'
${{ toJSON(github) }}
EOF
- uses: https://code.forgejo.org/actions/git-backporting@v4.8.0
- name: Fetch labels
id: fetch-labels
shell: bash
run: |
set -x
echo "Labels retrieved below"
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get -q install -qq -y jq
filtered_labels=$(echo "$LABELS" | jq -c 'map(select(.name | startswith("backport/v")))')
echo "FILTERED_LABELS=${filtered_labels}" >> $GITHUB_ENV
env:
LABELS: ${{ toJSON(github.event.pull_request.labels) }}
- name: Extract targets
id: extract-targets
shell: bash
run: |
set -x
targets="$(echo $FILTERED_LABELS | jq -c '[.[] | .name | sub("backport/"; "")]')"
echo "targets=$(echo $targets)" >> $GITHUB_OUTPUT
- name: Printing info
shell: bash
run: |
echo "targets: ${{ steps.extract-targets.outputs.targets }}"
echo "target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}"
echo "pull-request: ${{ github.event.pull_request.url }}"
- uses: https://code.forgejo.org/actions/git-backporting@v4.6.0
with:
target-branch-pattern: "^backport/(?<target>(v.*))$"
target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}/forgejo
strategy: ort
strategy-option: find-renames
cherry-pick-options: -x
no-squash: true
auth: ${{ secrets.BACKPORT_TOKEN }}
pull-request: ${{ github.event.pull_request.url }}
auto-no-squash: true
enable-err-notification: true

View file

@ -1,8 +1,3 @@
#
# Runs every 2 hours, but Renovate is limited to create new PR before 4am.
# See renovate.json for more settings.
# Automerge is enabled for Renovate PR's but need to be approved before.
#
name: renovate
on:
@ -10,7 +5,7 @@ on:
branches:
- 'renovate/**' # self-test updates
schedule:
- cron: '0 0/2 * * *'
- cron: '*/30 * * * *'
env:
RENOVATE_DRY_RUN: ${{ (github.event_name != 'schedule' && github.ref_name != github.event.repository.default_branch) && 'full' || '' }}
@ -22,22 +17,18 @@ jobs:
runs-on: docker
container:
image: ghcr.io/visualon/renovate:37.414.1
image: ghcr.io/visualon/renovate:37.272.0
steps:
- name: Load renovate repo cache
uses: https://code.forgejo.org/actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
- uses: https://code.forgejo.org/actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
.tmp/cache/renovate/repository
.tmp/cache/renovate/renovate-cache-sqlite
.tmp/osv
key: repo-cache-${{ github.run_id }}
restore-keys: |
repo-cache-
- name: Run renovate
run: renovate
- run: renovate
env:
GITHUB_COM_TOKEN: ${{ secrets.RENOVATE_GITHUB_COM_TOKEN }}
LOG_LEVEL: debug
@ -48,21 +39,15 @@ jobs:
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
RENOVATE_GIT_AUTHOR: 'Renovate Bot <forgejo-renovate-action@forgejo.org>'
RENOVATE_X_SQLITE_PACKAGE_CACHE: true
GIT_AUTHOR_NAME: 'Renovate Bot'
GIT_AUTHOR_EMAIL: 'forgejo-renovate-action@forgejo.org'
GIT_COMMITTER_NAME: 'Renovate Bot'
GIT_COMMITTER_EMAIL: 'forgejo-renovate-action@forgejo.org'
OSV_OFFLINE_ROOT_DIR: ${{ github.workspace }}/.tmp/osv
- name: Save renovate repo cache
if: always() && env.RENOVATE_DRY_RUN != 'full'
if: always() && env.RENOVATE_DRY_RUN == 'true'
uses: https://code.forgejo.org/actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
.tmp/cache/renovate/repository
.tmp/cache/renovate/renovate-cache-sqlite
.tmp/osv
key: repo-cache-${{ github.run_id }}

View file

@ -36,7 +36,7 @@ jobs:
- run: make deps-frontend
- run: make lint-frontend
- run: make checks-frontend
- run: make test-frontend-coverage
- run: make test-frontend
- run: make frontend
test-unit:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
@ -45,12 +45,8 @@ jobs:
container:
image: 'docker.io/node:20-bookworm'
services:
elasticsearch:
image: elasticsearch:7.17.22
env:
discovery.type: single-node
minio:
image: bitnami/minio:2024.3.30
image: bitnami/minio:2024.2.26
options: >-
--hostname gitea.minio
env:
@ -86,59 +82,6 @@ jobs:
env:
RACE_ENABLED: 'true'
TAGS: bindata
TEST_ELASTICSEARCH_URL: http://elasticsearch:9200
test-remote-cacher:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
runs-on: docker
needs: [backend-checks, frontend-checks]
container:
image: 'docker.io/node:20-bookworm'
strategy:
matrix:
cacher:
# redis
- image: redis:7.2
port: 6379
# redict
- image: registry.redict.io/redict:7.3.0-scratch
port: 6379
# garnet
- image: ghcr.io/microsoft/garnet-alpine:1.0.14
port: 6379
services:
cacher:
image: ${{ matrix.cacher.image }}
options: ${{ matrix.cacher.options }}
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: "1.22"
- run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- name: install git >= 2.42
run: |
export DEBIAN_FRONTEND=noninteractive
echo deb http://deb.debian.org/debian/ testing main > /etc/apt/sources.list.d/testing.list
apt-get update -qq
apt-get -q install -qq -y git
rm /etc/apt/sources.list.d/testing.list
apt-get update -qq
- run: |
su forgejo -c 'make deps-backend'
- run: |
su forgejo -c 'make backend'
env:
TAGS: bindata
- run: |
su forgejo -c 'make test-remote-cacher test-check'
timeout-minutes: 50
env:
RACE_ENABLED: 'true'
TAGS: bindata
TEST_REDIS_SERVER: cacher:${{ matrix.cacher.port }}
test-mysql:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
runs-on: docker
@ -193,12 +136,10 @@ jobs:
image: 'docker.io/node:20-bookworm'
services:
minio:
image: bitnami/minio:2024.3.30
image: bitnami/minio:2024.2.26
env:
MINIO_ROOT_USER: 123456
MINIO_ROOT_PASSWORD: 12345678
ldap:
image: docker.io/gitea/test-openldap:latest
pgsql:
image: 'docker.io/postgres:15'
env:
@ -235,7 +176,6 @@ jobs:
TAGS: bindata
RACE_ENABLED: true
USE_REPO_TEST_DIR: 1
TEST_LDAP: 1
test-sqlite:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
runs-on: docker

1
.gitattributes vendored
View file

@ -1,6 +1,5 @@
* text=auto eol=lf
*.tmpl linguist-language=go-html-template
*.pb.go linguist-generated
/assets/*.json linguist-generated
/public/assets/img/svg/*.svg linguist-generated
/templates/swagger/v1_json.tmpl linguist-generated

View file

@ -87,3 +87,4 @@ body:
- SQLite
- PostgreSQL
- MySQL
- MSSQL

4
.gitignore vendored
View file

@ -83,6 +83,7 @@ cpu.out
/public/assets/css
/public/assets/fonts
/public/assets/licenses.txt
/public/assets/img/webpack
/vendor
/web_src/fomantic/node_modules
/web_src/fomantic/build/*
@ -101,9 +102,6 @@ cpu.out
/.go-licenses
/.cur-deadcode-out
# Files and folders that were previously generated
/public/assets/img/webpack
# Snapcraft
/gitea_a*.txt
snap/.snapcraft/

View file

@ -43,7 +43,7 @@ vscode:
- Vue.volar
- ms-azuretools.vscode-docker
- vitest.explorer
- cweijan.vscode-database-client2
- qwtel.sqlite-viewer
- GitHub.vscode-pull-request-github
ports:

View file

@ -1,14 +1,13 @@
linters:
enable-all: false
disable-all: true
fast: false
enable:
- bidichk
# - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- depguard
- dupl
- errcheck
- forbidigo
- gocritic
# - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- gofumpt
- gosimple
@ -18,12 +17,16 @@ linters:
- nolintlint
- revive
- staticcheck
# - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- stylecheck
- typecheck
- unconvert
- unused
- unparam
# - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- wastedassign
enable-all: false
disable-all: true
fast: false
run:
timeout: 10m
@ -32,11 +35,6 @@ run:
- public
- web_src
output:
sort-results: true
sort-order: [file]
show-stats: true
linters-settings:
stylecheck:
checks: ["all", "-ST1005", "-ST1003"]
@ -47,39 +45,33 @@ linters-settings:
- ifElseChain
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
revive:
severity: error
ignore-generated-header: false
severity: warning
confidence: 0.8
errorCode: 1
warningCode: 1
rules:
- name: atomic
- name: bare-return
- name: blank-imports
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: duplicated-imports
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: error-naming
- name: exported
- name: identical-branches
- name: if-return
- name: increment-decrement
- name: indent-error-flow
- name: modifies-value-receiver
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: superfluous-else
- name: time-naming
- name: unconditional-recursion
- name: unexported-return
- name: unreachable-code
- name: var-declaration
- name: var-naming
- name: indent-error-flow
- name: errorf
- name: duplicated-imports
- name: modifies-value-receiver
gofumpt:
extra-rules: true
depguard:
@ -104,12 +96,8 @@ linters-settings:
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs: [node_modules, public, web_src]
exclude-case-sensitive: true
exclude-rules:
- path: models/db/sql_postgres_with_schema.go
linters:
- nolintlint
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
@ -127,19 +115,19 @@ issues:
- path: cmd
linters:
- forbidigo
- text: "webhook"
linters:
- linters:
- dupl
- text: "`ID' should not be capitalized"
linters:
text: "webhook"
- linters:
- gocritic
- text: "swagger"
linters:
text: "`ID' should not be capitalized"
- linters:
- unused
- deadcode
- text: "argument x is overwritten before first use"
linters:
text: "swagger"
- linters:
- staticcheck
text: "argument x is overwritten before first use"
- text: "commentFormatting: put a space between `//` and comment text"
linters:
- gocritic

View file

@ -4,8 +4,6 @@
/modules/options/bindata.go
/modules/public/bindata.go
/modules/templates/bindata.go
/options/gitignore
/options/license
/public/assets
/vendor
/public/assets
node_modules

223
.stylelintrc.yaml Normal file
View file

@ -0,0 +1,223 @@
plugins:
- stylelint-declaration-strict-value
- stylelint-declaration-block-no-ignored-properties
- "@stylistic/stylelint-plugin"
ignoreFiles:
- "**/*.go"
overrides:
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console.css", "font_i18n.css"]
rules:
scale-unlimited/declaration-strict-value: null
- files: ["**/chroma/*", "**/codemirror/*"]
rules:
block-no-empty: null
- files: ["**/*.vue"]
customSyntax: postcss-html
rules:
"@stylistic/at-rule-name-case": null
"@stylistic/at-rule-name-newline-after": null
"@stylistic/at-rule-name-space-after": null
"@stylistic/at-rule-semicolon-newline-after": null
"@stylistic/at-rule-semicolon-space-before": null
"@stylistic/block-closing-brace-empty-line-before": null
"@stylistic/block-closing-brace-newline-after": null
"@stylistic/block-closing-brace-newline-before": null
"@stylistic/block-closing-brace-space-after": null
"@stylistic/block-closing-brace-space-before": null
"@stylistic/block-opening-brace-newline-after": null
"@stylistic/block-opening-brace-newline-before": null
"@stylistic/block-opening-brace-space-after": null
"@stylistic/block-opening-brace-space-before": always
"@stylistic/color-hex-case": lower
"@stylistic/declaration-bang-space-after": never
"@stylistic/declaration-bang-space-before": null
"@stylistic/declaration-block-semicolon-newline-after": null
"@stylistic/declaration-block-semicolon-newline-before": null
"@stylistic/declaration-block-semicolon-space-after": null
"@stylistic/declaration-block-semicolon-space-before": never
"@stylistic/declaration-block-trailing-semicolon": null
"@stylistic/declaration-colon-newline-after": null
"@stylistic/declaration-colon-space-after": null
"@stylistic/declaration-colon-space-before": never
"@stylistic/function-comma-newline-after": null
"@stylistic/function-comma-newline-before": null
"@stylistic/function-comma-space-after": null
"@stylistic/function-comma-space-before": null
"@stylistic/function-max-empty-lines": 0
"@stylistic/function-parentheses-newline-inside": never-multi-line
"@stylistic/function-parentheses-space-inside": null
"@stylistic/function-whitespace-after": null
"@stylistic/indentation": 2
"@stylistic/linebreaks": null
"@stylistic/max-empty-lines": 1
"@stylistic/max-line-length": null
"@stylistic/media-feature-colon-space-after": null
"@stylistic/media-feature-colon-space-before": never
"@stylistic/media-feature-name-case": null
"@stylistic/media-feature-parentheses-space-inside": null
"@stylistic/media-feature-range-operator-space-after": always
"@stylistic/media-feature-range-operator-space-before": always
"@stylistic/media-query-list-comma-newline-after": null
"@stylistic/media-query-list-comma-newline-before": null
"@stylistic/media-query-list-comma-space-after": null
"@stylistic/media-query-list-comma-space-before": null
"@stylistic/named-grid-areas-alignment": null
"@stylistic/no-empty-first-line": null
"@stylistic/no-eol-whitespace": true
"@stylistic/no-extra-semicolons": true
"@stylistic/no-missing-end-of-source-newline": null
"@stylistic/number-leading-zero": null
"@stylistic/number-no-trailing-zeros": null
"@stylistic/property-case": lower
"@stylistic/selector-attribute-brackets-space-inside": null
"@stylistic/selector-attribute-operator-space-after": null
"@stylistic/selector-attribute-operator-space-before": null
"@stylistic/selector-combinator-space-after": null
"@stylistic/selector-combinator-space-before": null
"@stylistic/selector-descendant-combinator-no-non-space": null
"@stylistic/selector-list-comma-newline-after": null
"@stylistic/selector-list-comma-newline-before": null
"@stylistic/selector-list-comma-space-after": always-single-line
"@stylistic/selector-list-comma-space-before": never-single-line
"@stylistic/selector-max-empty-lines": 0
"@stylistic/selector-pseudo-class-case": lower
"@stylistic/selector-pseudo-class-parentheses-space-inside": never
"@stylistic/selector-pseudo-element-case": lower
"@stylistic/string-quotes": double
"@stylistic/unicode-bom": null
"@stylistic/unit-case": lower
"@stylistic/value-list-comma-newline-after": null
"@stylistic/value-list-comma-newline-before": null
"@stylistic/value-list-comma-space-after": null
"@stylistic/value-list-comma-space-before": null
"@stylistic/value-list-max-empty-lines": 0
alpha-value-notation: null
annotation-no-unknown: true
at-rule-allowed-list: null
at-rule-disallowed-list: null
at-rule-empty-line-before: null
at-rule-no-unknown: [true, {ignoreAtRules: [tailwind]}]
at-rule-no-vendor-prefix: true
at-rule-property-required-list: null
block-no-empty: true
color-function-notation: null
color-hex-alpha: null
color-hex-length: null
color-named: null
color-no-hex: null
color-no-invalid-hex: true
comment-empty-line-before: null
comment-no-empty: true
comment-pattern: null
comment-whitespace-inside: null
comment-word-disallowed-list: null
custom-media-pattern: null
custom-property-empty-line-before: null
custom-property-no-missing-var-function: true
custom-property-pattern: null
declaration-block-no-duplicate-custom-properties: true
declaration-block-no-duplicate-properties: [true, {ignore: [consecutive-duplicates-with-different-values]}]
declaration-block-no-redundant-longhand-properties: null
declaration-block-no-shorthand-property-overrides: null
declaration-block-single-line-max-declarations: null
declaration-empty-line-before: null
declaration-no-important: null
declaration-property-max-values: null
declaration-property-unit-allowed-list: null
declaration-property-unit-disallowed-list: {line-height: [em]}
declaration-property-value-allowed-list: null
declaration-property-value-disallowed-list: null
declaration-property-value-no-unknown: true
font-family-name-quotes: always-where-recommended
font-family-no-duplicate-names: true
font-family-no-missing-generic-family-keyword: true
font-weight-notation: null
function-allowed-list: null
function-calc-no-unspaced-operator: true
function-disallowed-list: null
function-linear-gradient-no-nonstandard-direction: true
function-name-case: lower
function-no-unknown: true
function-url-no-scheme-relative: null
function-url-quotes: always
function-url-scheme-allowed-list: null
function-url-scheme-disallowed-list: null
hue-degree-notation: null
import-notation: string
keyframe-block-no-duplicate-selectors: true
keyframe-declaration-no-important: true
keyframe-selector-notation: null
keyframes-name-pattern: null
length-zero-no-unit: [true, ignore: [custom-properties], ignoreFunctions: [var]]
max-nesting-depth: null
media-feature-name-allowed-list: null
media-feature-name-disallowed-list: null
media-feature-name-no-unknown: true
media-feature-name-no-vendor-prefix: true
media-feature-name-unit-allowed-list: null
media-feature-name-value-allowed-list: null
media-feature-name-value-no-unknown: true
media-feature-range-notation: null
media-query-no-invalid: true
named-grid-areas-no-invalid: true
no-descending-specificity: null
no-duplicate-at-import-rules: true
no-duplicate-selectors: true
no-empty-source: true
no-invalid-double-slash-comments: true
no-invalid-position-at-import-rule: [true, ignoreAtRules: [tailwind]]
no-irregular-whitespace: true
no-unknown-animations: null
no-unknown-custom-properties: null
number-max-precision: null
plugin/declaration-block-no-ignored-properties: true
property-allowed-list: null
property-disallowed-list: null
property-no-unknown: true
property-no-vendor-prefix: null
rule-empty-line-before: null
rule-selector-property-disallowed-list: null
scale-unlimited/declaration-strict-value: [[/color$/, font-weight], {ignoreValues: /^(inherit|transparent|unset|initial|currentcolor|none)$/, ignoreFunctions: false, disableFix: true, expandShorthand: true}]
selector-anb-no-unmatchable: true
selector-attribute-name-disallowed-list: null
selector-attribute-operator-allowed-list: null
selector-attribute-operator-disallowed-list: null
selector-attribute-quotes: always
selector-class-pattern: null
selector-combinator-allowed-list: null
selector-combinator-disallowed-list: null
selector-disallowed-list: null
selector-id-pattern: null
selector-max-attribute: null
selector-max-class: null
selector-max-combinators: null
selector-max-compound-selectors: null
selector-max-id: null
selector-max-pseudo-class: null
selector-max-specificity: null
selector-max-type: null
selector-max-universal: null
selector-nested-pattern: null
selector-no-qualifying-type: null
selector-no-vendor-prefix: true
selector-not-notation: null
selector-pseudo-class-allowed-list: null
selector-pseudo-class-disallowed-list: null
selector-pseudo-class-no-unknown: true
selector-pseudo-element-allowed-list: null
selector-pseudo-element-colon-notation: double
selector-pseudo-element-disallowed-list: null
selector-pseudo-element-no-unknown: true
selector-type-case: lower
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
shorthand-property-no-redundant-values: true
string-no-newline: true
time-min-milliseconds: null
unit-allowed-list: null
unit-disallowed-list: null
unit-no-unknown: true
value-keyword-case: null
value-no-vendor-prefix: [true, {ignoreValues: [box, inline-box]}]

View file

@ -16,8 +16,6 @@ web_src/.* @caesar @crystal @gusted
# HTML templates used by the backend.
templates/.* @caesar @crystal @gusted
## the issue sidebar was touched by fnetx
templates/repo/issue/view_content/sidebar.* @fnetx
# Files related to Go development.
@ -32,9 +30,3 @@ models/.* @dachary @earl-warren @gusted
# of how Forgejo comes together. It's tedious to write good integration testing
# for code that lives in here.
routers/.* @dachary @earl-warren @gusted
# Let new strings be checked by the translation team.
options/locale/locale_en-US.ini @0ko
# Personal interest
.*/webhook.* @oliverpool

View file

@ -1,13 +1,13 @@
FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22-alpine3.19 as build-env
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-direct}
ENV GOPROXY ${GOPROXY:-direct}
ARG RELEASE_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS="bindata timetzdata $TAGS"
ENV TAGS "bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS
#
@ -51,7 +51,7 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
/go/src/code.gitea.io/gitea/environment-to-ini
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
FROM code.forgejo.org/oci/golang:1.22-alpine3.20
FROM docker.io/library/alpine:3.19
ARG RELEASE_VERSION
LABEL maintainer="contact@forgejo.org" \
org.opencontainers.image.authors="Forgejo" \
@ -92,8 +92,8 @@ RUN addgroup \
git && \
echo "git:*" | chpasswd -e
ENV USER=git
ENV GITEA_CUSTOM=/data/gitea
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]

View file

@ -1,13 +1,13 @@
FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22-alpine3.19 as build-env
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-direct}
ENV GOPROXY ${GOPROXY:-direct}
ARG RELEASE_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS="bindata timetzdata $TAGS"
ENV TAGS "bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS
#
@ -49,7 +49,7 @@ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
/go/src/code.gitea.io/gitea/environment-to-ini
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
FROM code.forgejo.org/oci/golang:1.22-alpine3.20
FROM docker.io/library/alpine:3.19
LABEL maintainer="contact@forgejo.org" \
org.opencontainers.image.authors="Forgejo" \
org.opencontainers.image.url="https://forgejo.org" \
@ -95,17 +95,14 @@ COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_au
#git:git
USER 1000:1000
ENV GITEA_WORK_DIR=/var/lib/gitea
ENV GITEA_CUSTOM=/var/lib/gitea/custom
ENV GITEA_TEMP=/tmp/gitea
ENV TMPDIR=/tmp/gitea
ENV GITEA_WORK_DIR /var/lib/gitea
ENV GITEA_CUSTOM /var/lib/gitea/custom
ENV GITEA_TEMP /tmp/gitea
ENV TMPDIR /tmp/gitea
# Legacy config file for backwards compatibility
# TODO: remove on next major version release
ENV GITEA_APP_INI_LEGACY=/etc/gitea/app.ini
ENV GITEA_APP_INI=${GITEA_CUSTOM}/conf/app.ini
ENV HOME="/var/lib/gitea/git"
#TODO add to docs the ability to define the ini to load (useful to test and revert a config)
ENV GITEA_APP_INI /etc/gitea/app.ini
ENV HOME "/var/lib/gitea/git"
VOLUME ["/var/lib/gitea", "/etc/gitea"]
WORKDIR /var/lib/gitea

61
MAINTAINERS Normal file
View file

@ -0,0 +1,61 @@
Alexey Makhov <amakhov@avito.ru> (@makhov)
Bo-Yi Wu <appleboy.tw@gmail.com> (@appleboy)
Ethan Koenig <ethantkoenig@gmail.com> (@ethantkoenig)
Kees de Vries <bouwko@gmail.com> (@Bwko)
Kim Carlbäcker <kim.carlbacker@gmail.com> (@bkcsoft)
LefsFlare <nobody@nobody.tld> (@LefsFlarey)
Lunny Xiao <xiaolunwen@gmail.com> (@lunny)
Rachid Zarouali <nobody@nobody.tld> (@xinity)
Rémy Boulanouar <admin@dblk.org> (@DblK)
Sandro Santilli <strk@kbt.io> (@strk)
Thibault Meyer <meyer.thibault@gmail.com> (@0xbaadf00d)
Thomas Boerger <thomas@webhippie.de> (@tboerger)
Patrick G <geek1011@outlook.com> (@geek1011)
Antoine Girard <sapk@sapk.fr> (@sapk)
Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
David Schneiderbauer <dschneiderbauer@gmail.com> (@daviian)
Peter Žeby <morlinest@gmail.com> (@morlinest)
Matti Ranta <techknowlogick@gitea.io> (@techknowlogick)
Jonas Franz <info@jonasfranz.software> (@jonasfranz)
Alexey Terentyev <axifnx@gmail.com> (@axifive)
Lanre Adelowo <yo@lanre.wtf> (@adelowo)
Konrad Langenberg <k@knt.li> (@kolaente)
He-Long Zhang <outman99@hotmail.com> (@BetaCat0)
Andrew Thornton <art27@cantab.net> (@zeripath)
John Olheiser <john.olheiser@gmail.com> (@jolheiser)
Richard Mahn <rich.mahn@unfoldingword.org> (@richmahn)
Mrsdizzie <info@mrsdizzie.com> (@mrsdizzie)
silverwind <me@silverwind.io> (@silverwind)
Gary Kim <gary@garykim.dev> (@gary-kim)
Guillermo Prandi <gitea.maint@mailfilter.com.ar> (@guillep2k)
Mura Li <typeless@ctli.io> (@typeless)
6543 <6543@obermui.de> (@6543)
jaqra <jaqra@hotmail.com> (@jaqra)
David Svantesson <davidsvantesson@gmail.com> (@davidsvantesson)
a1012112796 <1012112796@qq.com> (@a1012112796)
Karl Heinz Marbaise <kama@soebes.de> (@khmarbaise)
Norwin Roosen <git@nroo.de> (@noerw)
Kyle Dumont <kdumontnu@gmail.com> (@kdumontnu)
Patrick Schratz <patrick.schratz@gmail.com> (@pat-s)
Janis Estelmann <admin@oldschoolhack.me> (@KN4CK3R)
Steven Kriegler <sk.bunsenbrenner@gmail.com> (@justusbunsi)
Jimmy Praet <jimmy.praet@telenet.be> (@jpraet)
Leon Hofmeister <dev.lh@web.de> (@delvh)
Wim <wim@42.be> (@42wim)
Jason Song <i@wolfogre.com> (@wolfogre)
Yarden Shoham <git@yardenshoham.com> (@yardenshoham)
Yu Tian <zettat123@gmail.com> (@Zettat123)
Eddie Yang <576951401@qq.com> (@yp05327)
Dong Ge <gedong_1994@163.com> (@sillyguodong)
Xinyi Gong <hestergong@gmail.com> (@HesterG)
wxiaoguang <wxiaoguang@gmail.com> (@wxiaoguang)
Gary Moon <gary@garymoon.net> (@garymoon)
Philip Peterson <philip.c.peterson@gmail.com> (@philip-peterson)
Denys Konovalov <kontakt@denyskon.de> (@denyskon)
Punit Inani <punitinani1@gmail.com> (@puni9869)
CaiCandong <1290147055@qq.com> (@caicandong)
Rui Chen <rui@chenrui.dev> (@chenrui333)
Nanguan Lin <nanguanlin6@gmail.com> (@lng2020)
kerwin612 <kerwin612@qq.com> (@kerwin612)
Gary Wang <git@blumia.net> (@BLumia)

196
Makefile
View file

@ -26,20 +26,18 @@ DIFF ?= diff --unified
XGO_VERSION := go-1.21.x
AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@2.8.0 # renovate: datasource=go
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.6.0 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 # renovate: datasource=go
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11 # renovate: datasource=go
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0 # renovate: datasource=go
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 # renovate: datasource=go
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.49.0
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@2.8.0
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.6.0
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.4.1
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.6-0.20240201115257-bcc7c78b7786
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 # renovate: datasource=go
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go
DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.22.0 # renovate: datasource=go
GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.4.0 # renovate: datasource=go
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.15.3 # renovate: datasource=go
RENOVATE_NPM_PACKAGE ?= renovate@37.414.1 # renovate: datasource=docker packageName=ghcr.io/visualon/renovate
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.0.3
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.26
DEADCODE_PACKAGE ?= golang.org/x/tools/internal/cmd/deadcode@v0.14.0
DOCKER_IMAGE ?= gitea/gitea
DOCKER_TAG ?= latest
@ -84,7 +82,7 @@ endif
STORED_VERSION_FILE := VERSION
HUGO_VERSION ?= 0.111.3
GITEA_COMPATIBILITY ?= gitea-1.22.0
GITEA_COMPATIBILITY ?= gitea-1.21.11
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
ifneq ($(STORED_VERSION),)
@ -125,15 +123,13 @@ LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
ifeq ($(HAS_GO), yes)
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) $(shell $(GO) list code.gitea.io/gitea/models/forgejo_migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/))
endif
REMOTE_CACHER_MODULES ?= cache nosql session queue
GO_TEST_REMOTE_CACHER_PACKAGES ?= $(addprefix code.gitea.io/gitea/modules/,$(REMOTE_CACHER_MODULES))
FOMANTIC_WORK_DIR := web_src/fomantic
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
WEBPACK_CONFIGS := webpack.config.js tailwind.config.js
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
@ -158,9 +154,9 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
GO_DIRS := build cmd models modules routers services tests
WEB_DIRS := web_src/js web_src/css
ESLINT_FILES := web_src/js tools *.js tests/e2e
ESLINT_FILES := web_src/js tools *.config.js tests/e2e
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(wildcard *.go *.js *.md *.yml *.yaml *.toml)
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github
GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
@ -199,6 +195,10 @@ TEST_PGSQL_DBNAME ?= testgitea
TEST_PGSQL_USERNAME ?= postgres
TEST_PGSQL_PASSWORD ?= postgres
TEST_PGSQL_SCHEMA ?= gtestschema
TEST_MSSQL_HOST ?= mssql:1433
TEST_MSSQL_DBNAME ?= gitea
TEST_MSSQL_USERNAME ?= sa
TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
.PHONY: all
all: build
@ -222,17 +222,14 @@ help:
@echo " - deps-py install python dependencies"
@echo " - lint lint everything"
@echo " - lint-fix lint everything and fix issues"
@echo " - lint-actions lint action workflow files"
@echo " - lint-frontend lint frontend files"
@echo " - lint-frontend-fix lint frontend files and fix issues"
@echo " - lint-backend lint backend files"
@echo " - lint-backend-fix lint backend files and fix issues"
@echo " - lint-codespell lint typos"
@echo " - lint-codespell-fix lint typos and fix them automatically"
@echo " - lint-codespell-fix-i lint typos and fix them interactively"
@echo " - lint-go lint go files"
@echo " - lint-go-fix lint go files and fix issues"
@echo " - lint-go-vet lint go files with vet"
@echo " - lint-go-gopls lint go files with gopls"
@echo " - lint-js lint js files"
@echo " - lint-js-fix lint js files and fix issues"
@echo " - lint-css lint css files"
@ -240,7 +237,6 @@ help:
@echo " - lint-md lint markdown files"
@echo " - lint-swagger lint swagger files"
@echo " - lint-templates lint template files"
@echo " - lint-renovate lint renovate files"
@echo " - lint-yaml lint yaml files"
@echo " - lint-spell lint spelling"
@echo " - lint-spell-fix lint spelling and fix issues"
@ -251,10 +247,11 @@ help:
@echo " - show-version-full show the same version as the API endpoint"
@echo " - show-version-major show major release number only"
@echo " - test-frontend test frontend files"
@echo " - test-frontend-coverage test frontend files and display code coverage"
@echo " - test-backend test backend files"
@echo " - test-remote-cacher test backend files that use a remote cache"
@echo " - test-e2e-sqlite[\#name.test.e2e] test end to end using playwright and sqlite"
@echo " - test-e2e[\#TestSpecificName] test end to end using playwright"
@echo " - update update js and py dependencies"
@echo " - update-js update js dependencies"
@echo " - update-py update py dependencies"
@echo " - webpack build webpack files"
@echo " - svg build svg files"
@echo " - fomantic build fomantic files"
@ -263,7 +260,6 @@ help:
@echo " - generate-license update license files"
@echo " - generate-gitignore update gitignore files"
@echo " - generate-manpage generate manpage"
@echo " - generate-gomock generate gomock files"
@echo " - generate-forgejo-api generate the forgejo API from spec"
@echo " - forgejo-api-validate check if the forgejo API matches the specs"
@echo " - generate-swagger generate the swagger spec from code comments"
@ -312,14 +308,14 @@ clean:
e2e*.test \
tests/integration/gitea-integration-* \
tests/integration/indexers-* \
tests/mysql.ini tests/pgsql.ini man/ \
tests/mysql.ini tests/pgsql.ini tests/mssql.ini man/ \
tests/e2e/gitea-e2e-*/ \
tests/e2e/indexers-*/ \
tests/e2e/reports/ tests/e2e/test-artifacts/ tests/e2e/test-snapshots/
.PHONY: fmt
fmt:
@GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
@# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only
@# whitespace before it
@ -401,23 +397,11 @@ lint-frontend: lint-js lint-css
lint-frontend-fix: lint-js-fix lint-css-fix
.PHONY: lint-backend
lint-backend: lint-go lint-go-vet lint-editorconfig lint-renovate
lint-backend: lint-go lint-go-vet lint-editorconfig
.PHONY: lint-backend-fix
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig
.PHONY: lint-codespell
lint-codespell:
codespell
.PHONY: lint-codespell-fix
lint-codespell-fix:
codespell -w
.PHONY: lint-codespell-fix-i
lint-codespell-fix-i:
codespell -w -i 3 -C 2
.PHONY: lint-js
lint-js: node_modules
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES)
@ -438,37 +422,29 @@ lint-css-fix: node_modules
lint-swagger: node_modules
npx spectral lint -q -F hint $(SWAGGER_SPEC)
.PHONY: lint-renovate
lint-renovate: node_modules
npx --yes --package $(RENOVATE_NPM_PACKAGE) -- renovate-config-validator --strict > .lint-renovate 2>&1 || true
@if grep --quiet --extended-regexp -e '^( WARN:|ERROR:)' .lint-renovate ; then cat .lint-renovate ; rm .lint-renovate ; exit 1 ; fi
@rm .lint-renovate
.PHONY: lint-md
lint-md: node_modules
npx markdownlint docs *.md
.PHONY: lint-spell
lint-spell: lint-codespell
lint-spell:
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES)
.PHONY: lint-spell-fix
lint-spell-fix: lint-codespell-fix
lint-spell-fix:
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES)
RUN_DEADCODE = $(GO) run $(DEADCODE_PACKAGE) -generated=false -f='{{println .Path}}{{range .Funcs}}{{printf "\t%s\n" .Name}}{{end}}{{println}}' -test code.gitea.io/gitea
.PHONY: lint-go
lint-go:
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS)
$(RUN_DEADCODE) > .cur-deadcode-out
$(GO) run $(DEADCODE_PACKAGE) -generated=false -test code.gitea.io/gitea > .cur-deadcode-out
@$(DIFF) .deadcode-out .cur-deadcode-out \
|| (code=$$?; echo "Please run 'make lint-go-fix' and commit the result"; exit $${code})
.PHONY: lint-go-fix
lint-go-fix:
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS) --fix
$(RUN_DEADCODE) > .deadcode-out
$(GO) run $(DEADCODE_PACKAGE) -generated=false -test code.gitea.io/gitea > .deadcode-out
# workaround step for the lint-go-windows CI task because 'go run' can not
# have distinct GOOS/GOARCH for its build and run steps
@ -482,15 +458,14 @@ lint-go-vet:
@echo "Running go vet..."
@$(GO) vet ./...
.PHONY: lint-go-gopls
lint-go-gopls:
@echo "Running gopls check..."
@GO=$(GO) GOPLS_PACKAGE=$(GOPLS_PACKAGE) tools/lint-go-gopls.sh $(GO_SOURCES_NO_BINDATA)
.PHONY: lint-editorconfig
lint-editorconfig:
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .forgejo/workflows
.PHONY: lint-actions
lint-actions:
$(GO) run $(ACTIONLINT_PACKAGE)
.PHONY: lint-templates
lint-templates: .venv node_modules
@node tools/lint-templates-svg.js
@ -521,19 +496,10 @@ test-backend:
@echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(GO_TEST_PACKAGES)
.PHONY: test-remote-cacher
test-remote-cacher:
@echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(GO_TEST_REMOTE_CACHER_PACKAGES)
.PHONY: test-frontend
test-frontend: node_modules
npx vitest
.PHONY: test-frontend-coverage
test-frontend-coverage: node_modules
npx vitest --coverage --coverage.include 'web_src/**'
.PHONY: test-check
test-check:
@echo "Running test-check...";
@ -645,6 +611,27 @@ test-pgsql\#%: integrations.pgsql.test generate-ini-pgsql
.PHONY: test-pgsql-migration
test-pgsql-migration: migrations.pgsql.test migrations.individual.pgsql.test
generate-ini-mssql:
sed -e 's|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \
-e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
-e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
-e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
-e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \
tests/mssql.ini.tmpl > tests/mssql.ini
.PHONY: test-mssql
test-mssql: integrations.mssql.test generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test
.PHONY: test-mssql\#%
test-mssql\#%: integrations.mssql.test generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test -test.run $(subst .,/,$*)
.PHONY: test-mssql-migration
test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test
.PHONY: playwright
playwright: deps-frontend
npx playwright install $(PLAYWRIGHT_FLAGS)
@ -665,10 +652,6 @@ test-e2e-sqlite: playwright e2e.sqlite.test generate-ini-sqlite
test-e2e-sqlite\#%: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestE2e/$*
.PHONY: test-e2e-sqlite-firefox\#%
test-e2e-sqlite-firefox\#%: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini PLAYWRIGHT_PROJECT=firefox ./e2e.sqlite.test -test.run TestE2e/$*
.PHONY: test-e2e-mysql
test-e2e-mysql: playwright e2e.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./e2e.mysql.test -test.run TestE2e
@ -685,6 +668,14 @@ test-e2e-pgsql: playwright e2e.pgsql.test generate-ini-pgsql
test-e2e-pgsql\#%: playwright e2e.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e/$*
.PHONY: test-e2e-mssql
test-e2e-mssql: playwright e2e.mssql.test generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e
.PHONY: test-e2e-mssql\#%
test-e2e-mssql\#%: playwright e2e.mssql.test generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e/$*
.PHONY: test-e2e-debugserver
test-e2e-debugserver: e2e.sqlite.test generate-ini-sqlite
sed -i s/3003/3000/g tests/sqlite.ini
@ -698,6 +689,10 @@ bench-sqlite: integrations.sqlite.test generate-ini-sqlite
bench-mysql: integrations.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
.PHONY: bench-mssql
bench-mssql: integrations.mssql.test generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
.PHONY: bench-pgsql
bench-pgsql: integrations.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./integrations.pgsql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
@ -716,6 +711,9 @@ integrations.mysql.test: git-check $(GO_SOURCES)
integrations.pgsql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.pgsql.test
integrations.mssql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.mssql.test
integrations.sqlite.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags '$(TEST_TAGS)'
@ -735,6 +733,11 @@ migrations.pgsql.test: $(GO_SOURCES) generate-ini-pgsql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.pgsql.test
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./migrations.pgsql.test
.PHONY: migrations.mssql.test
migrations.mssql.test: $(GO_SOURCES) generate-ini-mssql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.mssql.test
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./migrations.mssql.test
.PHONY: migrations.sqlite.test
migrations.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.sqlite.test -tags '$(TEST_TAGS)'
@ -760,6 +763,17 @@ migrations.individual.pgsql.test: $(GO_SOURCES)
migrations.individual.pgsql.test\#%: $(GO_SOURCES) generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
.PHONY: migrations.individual.mssql.test
migrations.individual.mssql.test: $(GO_SOURCES) generate-ini-mssql
for pkg in $(MIGRATION_PACKAGES); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' -test.failfast $$pkg || exit 1; \
done
.PHONY: migrations.individual.mssql.test\#%
migrations.individual.mssql.test\#%: $(GO_SOURCES) generate-ini-mssql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
.PHONY: migrations.individual.sqlite.test
migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
for pkg in $(MIGRATION_PACKAGES); do \
@ -776,6 +790,9 @@ e2e.mysql.test: $(GO_SOURCES)
e2e.pgsql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.pgsql.test
e2e.mssql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.mssql.test
e2e.sqlite.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.sqlite.test -tags '$(TEST_TAGS)'
@ -805,7 +822,7 @@ generate-backend: $(TAGS_PREREQ) generate-go
.PHONY: generate-go
generate-go: $(TAGS_PREREQ)
@echo "Running go generate..."
@CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./...
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' ./...
.PHONY: merge-locales
merge-locales:
@ -906,15 +923,31 @@ deps-tools:
$(GO) install $(XGO_PACKAGE)
$(GO) install $(GO_LICENSES_PACKAGE)
$(GO) install $(GOVULNCHECK_PACKAGE)
$(GO) install $(GOMOCK_PACKAGE)
$(GO) install $(GOPLS_PACKAGE)
$(GO) install $(ACTIONLINT_PACKAGE)
node_modules: package-lock.json
npm install --no-save
@touch node_modules
.venv: poetry.lock
poetry install
poetry install --no-root
@touch .venv
.PHONY: update
update: update-js update-py
.PHONY: update-js
update-js: node-check | node_modules
npx updates -u -f package.json
rm -rf node_modules package-lock.json
npm install --package-lock
@touch node_modules
.PHONY: update-py
update-py: node-check | node_modules
npx updates -u -f pyproject.toml
rm -rf .venv poetry.lock
poetry install --no-root
@touch .venv
.PHONY: fomantic
@ -935,9 +968,8 @@ webpack: $(WEBPACK_DEST)
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json
@$(MAKE) -s node-check node_modules
@rm -rf $(WEBPACK_DEST_ENTRIES)
@echo "Running webpack..."
@BROWSERSLIST_IGNORE_OLD_DATA=true npx webpack
rm -rf $(WEBPACK_DEST_ENTRIES)
npx webpack
@touch $(WEBPACK_DEST)
.PHONY: svg
@ -975,10 +1007,6 @@ generate-license:
generate-gitignore:
$(GO) run build/generate-gitignores.go
.PHONY: generate-gomock
generate-gomock:
$(GO) run $(GOMOCK_PACKAGE) -package mock -destination ./modules/queue/mock/redisuniversalclient.go github.com/redis/go-redis/v9 UniversalClient
.PHONY: generate-images
generate-images: | node_modules
npm install --no-save fabric@6.0.0-beta20 imagemin-zopfli@7

View file

@ -1,4 +1,3 @@
<div align="center">
<img src="./assets/logo.svg" alt="" width="192" align="center" />
<h1 align="center">Welcome to Forgejo</h1>

View file

@ -1,45 +1,9 @@
# Release Notes
A minor or major Forgejo release is published every [three months](https://forgejo.org/docs/latest/developer/release/#release-cycle), with more patch releases in between depending on the severity of the bug and security fixes it contains.
A minor or major Forgejo release is published every [three months](https://forgejo.org/docs/latest/user/versions/), with more patch releases in between depending on the severity of the bug and security fixes it contains.
A [patch or minor release](https://semver.org/spec/v2.0.0.html) (e.g. upgrading from v7.0.0 to v7.0.1 or v7.1.0) does not require manual intervention. But [major releases](https://semver.org/spec/v2.0.0.html#spec-item-8) where the first version number changes (e.g. upgrading from v1.21 to v7.0) contain breaking changes and the release notes explain how to deal with them.
## Upcoming releases (not available yet)
- [8.0.0](release-notes/8.0.0/)
## 7.0.4
This is a security release. See the documentation for more information on the [upgrade procedure](https://forgejo.org/docs/v7.0/admin/upgrade/).
In addition to the following notable bug fixes, you can browse the [full list of commits](https://codeberg.org/forgejo/forgejo/compare/v7.0.3...v7.0.4) included in this release.
* **Security:**
* [PR](https://codeberg.org/forgejo/forgejo/pulls/4054). Fixed: [CVE-2024-24789](https://pkg.go.dev/vuln/GO-2024-2888): the archive/zip package's handling of certain types of invalid zip files differs from the behavior of most zip implementations. This misalignment could be exploited to create an zip file with contents that vary depending on the implementation reading the file.
* [PR](https://codeberg.org/forgejo/forgejo/pulls/3639) - ([fix](https://codeberg.org/forgejo/forgejo/commit/1b088fade6c69e63843d1bdf402454c363b22ce2) & [test](https://codeberg.org/forgejo/forgejo/pulls/4032)). Fixed: the OAuth2 implementation does not always require authentication for public clients, a requirement of [RFC 6749 Section 10.2](https://datatracker.ietf.org/doc/html/rfc6749#section-10.2). A malicious client can impersonate another client and obtain access to protected resources if the impersonated client fails to, or is unable to, keep its client credentials confidential.
* **Bug fixes:**
* [backport](https://codeberg.org/forgejo/forgejo/pulls/4086) - [PR](https://codeberg.org/forgejo/forgejo/pulls/4085). Fixed: `forgejo migrate-storage --type actions-artifacts` always fails because it picks the wrong path.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/4017) - [PR](https://codeberg.org/forgejo/forgejo/pulls/4015). Fixed: avatar files can be found in storage while they do not exist in the database.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3997) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3976). Fixed: repository admins are always denied the right to force merge and instance admins are subject to restrictions to merge that must only apply to repository admins.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3946) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3615). Fixed: non conformance with the [Nix tarball fetcher immutable link protocol](https://github.com/nixos/nix/blob/56763ff918eb308db23080e560ed2ea3e00c80a7/doc/manual/src/protocols/tarball-fetcher.md).
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3936) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3935). Fixed: migrated activities (such as reviews) are mapped to the user who initiated the migration rather than the Ghost user, if the external user cannot be mapped to a local one. This mapping mismatch leads to internal server errors in some cases.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3906) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3904). Fixed: a v7.0.0 regression causes `[admin].SEND_NOTIFICATION_EMAIL_ON_NEW_USER=true` to always be ignored.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3888) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3865). Fixed: using a subquery for user deletion is a performance bottleneck when using mariadb 10 because only mariadb 11 takes advantage of the available index.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3887) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3885). Fixed: a v7.0.3 regression causes the expanding diffs in pull requests to fail with a 404 error.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3881) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3864). Fixed: SourceHut Builds webhook fail when the `triggers` field is used.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3877) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3242). Fixed: the label list rendering in the issue and pull request timeline is displayed on multiple lines instead of a single one.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/4084) - [PR](https://codeberg.org/forgejo/forgejo/pulls/4083) - [commit](https://codeberg.org/forgejo/forgejo/commit/c6e04c3c9eddfa6c4bec541f681c8d300b157cdb). Fixed: NuGet Package fails `choco info pkgname` when `pkgname` is also a substring of another package Id.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/4004) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3989) - [commit](https://codeberg.org/forgejo/forgejo/commit/62448bfb931882859388b2fd472cb89428c25323). Fixed: "Git hooks of this repository seem to be broken." warning when pushing more than one branch at a time.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3942) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3917) - [commit](https://codeberg.org/forgejo/forgejo/commit/7d7ea45465d6cd1ea0ec549a71f67b4a8ff930cf). Fixed: automerge does not happen when the approval count reaches the required threshold.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3942) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3917) - [commit](https://codeberg.org/forgejo/forgejo/commit/a649610d6175d1994b838f5672261400df9fdb92). Fixed: the `FORCE_PRIVATE=true` setting is not consistently enforced.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/3859) - [PR](https://codeberg.org/forgejo/forgejo/pulls/3838) - [commit](https://codeberg.org/forgejo/forgejo/commit/193ac67176afc72e9d108bc1730c354bfbf9a442). Fixed: CSRF validation errors when OAuth is not enabled.
* [backport](https://codeberg.org/forgejo/forgejo/pulls/4107) - [PR](https://codeberg.org/forgejo/forgejo/pulls/4076). Fixed: headlines in rendered org-mode do not have a margin on the top
* **Localization:**
* Improvements to English locale: [[1]](https://codeberg.org/forgejo/forgejo/pulls/3914), [[2]](https://codeberg.org/forgejo/forgejo/pulls/4114).
* Translation updates: [[1]](https://codeberg.org/forgejo/forgejo/pulls/3907), [[2]](https://codeberg.org/forgejo/forgejo/pulls/3990), [[3]](https://codeberg.org/forgejo/forgejo/pulls/4099).
## 7.0.3
This is a security release. See the documentation for more information on the [upgrade procedure](https://forgejo.org/docs/v7.0/admin/upgrade/).
@ -576,28 +540,6 @@ $ git -C forgejo log --oneline --no-merges origin/v1.21/forgejo..origin/v7.0/for
* [Align ISSUE_TEMPLATE with the new label system](https://codeberg.org/forgejo/forgejo/commit/248b7ee850ecdb538b22ddcfbe80b6f91be32b70).
* [Improve the list header in milestone page](https://codeberg.org/forgejo/forgejo/commit/8abc1aae4ab5b03be0bcbdd390bb903b54ccd21a).
## 1.21.11-2
[The complete list of new commits included in the Forgejo v1.21.11-2 release can be reviewed here](https://codeberg.org/forgejo/forgejo/compare/v1.21.11-1...v1.21.11-2), or from the command line with:
```shell
$ git clone https://codeberg.org/forgejo/forgejo
$ git -C forgejo log --oneline --no-merges v1.21.11-1..v1.21.11-2
```
This stable release contains a **security fix**.
* Recommended Action
We recommend that all Forgejo installations are [upgraded](https://forgejo.org/docs/v1.21/admin/upgrade/) to the latest version as soon as possible.
* [Forgejo Semantic Version](https://forgejo.org/docs/v1.21/user/semver/)
The semantic version was updated to `6.0.13+0-gitea-1.21.10`
* Security fix
* [PR](https://codeberg.org/forgejo/forgejo/pulls/4047). Fixed: the OAuth2 implementation does not always require authentication for public clients, a requirement of [RFC 6749 Section 10.2](https://datatracker.ietf.org/doc/html/rfc6749#section-10.2). A malicious client can impersonate another client and obtain access to protected resources if the impersonated client fails to, or is unable to, keep its client credentials confidential.
## 1.21.11-1
This stable release contains a single bug fix for a regression introduced in v1.21.11-0 by which creating a tag via the API would fail with error 500 on a repository a where Forgejo Actions workflow triggered by tags exists.
@ -616,7 +558,7 @@ This stable release contains a single bug fix for a regression introduced in v1.
## 1.21.11-0
[The complete list of new commits included in the Forgejo v1.21.11-0 release can be reviewed here](https://codeberg.org/forgejo/forgejo/compare/v1.21.10-0...v1.21.11-0), or from the command line with:
[The complete list of new commits included in the Forgejo v1.21.11-0 release can be reviewed here](https://codeberg.org/forgejo/forgejo/compare/v1.21.10-0...v1.21.11-0), or from the comand line with:
```shell
$ git clone https://codeberg.org/forgejo/forgejo
@ -684,7 +626,7 @@ Note that there is no `Forgejo v1.21.9-0` release. The release numbering of the
* [Fix paths when finding files via the web interface that were not escaped](https://codeberg.org/forgejo/forgejo/commit/b22be0c03fa4814c1b8b892346de5d4547782ce7).
* [Respect `DEFAULT_ORG_MEMBER_VISIBLE` setting when adding creator to org](https://codeberg.org/forgejo/forgejo/commit/5e5574c7b328e2c500d497517047b8d1fd0ca478).
* [Fix duplicate migrated milestones](https://codeberg.org/forgejo/forgejo/commit/706ff7aa9fcfe4c43893dc12e27d064064e80635).
* [Fix inline math blocks can't be preceded/followed by alphanumerical characters](https://codeberg.org/forgejo/forgejo/commit/0d3f446460b22a29c259e7d42ed89f90fd216ca7).
* [Fix inline math blocks can't be preceeded/followed by alphanumerical characters](https://codeberg.org/forgejo/forgejo/commit/0d3f446460b22a29c259e7d42ed89f90fd216ca7).
## 1.21.8-0
@ -791,7 +733,7 @@ This stable release contains bug fixes and a **security fix**, as explained in t
* [Fix push to create with capitalize repo name](https://codeberg.org/forgejo/forgejo/commit/8782275c9c66ad6fc7c44503d7df9dae7196aa65).
* In Markdown [don't try to make the link absolute if the link has a schema that's defined in `[markdown].CUSTOM_URL_SCHEMES`](https://codeberg.org/forgejo/forgejo/commit/6c100083c29fb0ccf0cc52e8767e540a260d9468), because they can't be made absolute.
* [Fix Ctrl+Enter on submitting review comment](https://codeberg.org/forgejo/forgejo/commit/1c3a31d85112d10fb948d6f0b763191ed6f68e90).
* In Git version v2.43.1, the behavior of `GIT_FLUSH` was accidentally flipped. This causes Forgejo to hang on the `check-attr` command, because no output was being flushed. [Workaround this by detecting if Git v2.43.1 is used and set `GIT_FLUSH=0` thus getting the correct behavior](https://codeberg.org/forgejo/forgejo/commit/ff468ab5e426582b068586ce13d5a5348365e783).
* In Git version v2.43.1, the behavior of `GIT_FLUSH` was accidentially flipped. This causes Forgejo to hang on the `check-attr` command, because no output was being flushed. [Workaround this by detecting if Git v2.43.1 is used and set `GIT_FLUSH=0` thus getting the correct behavior](https://codeberg.org/forgejo/forgejo/commit/ff468ab5e426582b068586ce13d5a5348365e783).
* [When setting `url.host` on a URL object with no port specified (like is the case of default port), the resulting URL's port will not change. Workaround this quirk in the URL standard by explicitly setting port for the http and https protocols](https://codeberg.org/forgejo/forgejo/commit/628e1036cfbcfae442cb6494249fe11410447056).
* [Fix elasticsearch Request Entity Too Large](https://codeberg.org/forgejo/forgejo/commit/e6f59f6e1489d63d53de0da1de406a7a71a82adb).
* [Do not send update/delete release notifications when it is in a draft state](https://codeberg.org/forgejo/forgejo/commit/3c54a1dbf62e56d948feb1008512900140033737).
@ -881,7 +823,7 @@ This stable release includes security and bug fixes as well as documentation imp
* [Gracefully handle missing branches](https://codeberg.org/forgejo/forgejo/commit/c2fa9c308f5cdb08dd84fb8ec6623a57e75d5152) when a branch is missing from Git but still lingering in the database.
* [Fix panic in `canSoftDeleteContentHistory`](https://codeberg.org/forgejo/forgejo/commit/ab1ccc55dca7fd05e59a01343e6dfe53be6195d0)
* [Check for Commit in opengraph](https://codeberg.org/forgejo/forgejo/commit/b473a44a2bb59591f3e24bfcdeed1d8fbb0f9204)
* [Handle non-existent commit in Archive request](https://codeberg.org/forgejo/forgejo/commit/0fbf761d1930f9336be6da8d17ae6032203a9381)
* [Handle non-existant commit in Archive request](https://codeberg.org/forgejo/forgejo/commit/0fbf761d1930f9336be6da8d17ae6032203a9381)
* [Fix NPE in `ToPullReviewList`](https://codeberg.org/forgejo/forgejo/commit/f5349b66b78968301d7dc4c45e8e08b46910aa6e)
* [Fix URL in the mail to include the host](https://codeberg.org/forgejo/forgejo/commit/ac889d42903b2ce2129a02ace620a10a6f940920)
* [Fix the event of a scheduled action](https://codeberg.org/forgejo/forgejo/commit/892a8e1f4a5cc09cc3136e0b0e6487c154c5ed2b) to be "schedule" instead of a semi-random event from the default branch.
@ -992,7 +934,7 @@ $ git clone https://codeberg.org/forgejo/forgejo/
$ git -C forgejo log --oneline --no-merges v1.21.1-0..v1.21.2-0
```
This stable release includes bug fixes. It was built with Go v1.21.5 that fixes [CVE-2023-39326](https://groups.google.com/g/golang-announce/c/iLGK3x6yuNo) which a malicious HTTP client can exploit to cause a server to automatically read a large amount of data. It allows for memory exhaustion in the situation that HTTP chunked encoding requests can reach Forgejo.
This stable release includes bug fixes. It was built with Go v1.21.5 that fixes [CVE-2023-39326](https://groups.google.com/g/golang-announce/c/iLGK3x6yuNo) which a malicious HTTP client can exploit to cause a server to automatically read a large amount of data. It allows for memory exhaustion in the situation that HTTP chuncked encoding requests can reach Forgejo.
* Recommended Action
@ -1057,7 +999,7 @@ $ git -C forgejo log --oneline --no-merges origin/v1.20/forgejo..origin/v1.21/fo
- [Add](https://codeberg.org/forgejo/forgejo/commit/0d55f64e6cd3de2e1e5c0ee795605823efb14231) support for [recurring actions similar to cron jobs](https://forgejo.org/docs/v1.21/user/actions/#onschedule).
- [Add](https://codeberg.org/forgejo/forgejo/commit/19872063a3c14256a1d89b2a104d63e7538a3a28) the possibility to [disable workflows from the user interface](https://forgejo.org/docs/v1.21/user/actions/#list-of-runners-and-their-tasks).
- [Add](https://codeberg.org/forgejo/forgejo/commit/460a2b0edffe71d9e64633beaa1071fcf4a33369) automatic [cleanup of artificats](https://forgejo.org/docs/v1.21/user/actions/#artifacts).
- [Add](https://codeberg.org/forgejo/forgejo/commit/44781f9f5c4ede618660d8cfe42437f0e8dc22a0) automatic cancellation [of jobs when pushing new commits](https://forgejo.org/docs/v1.21/user/actions/#auto-cancellation-of-workflows) to a PR.
- [Add](https://codeberg.org/forgejo/forgejo/commit/44781f9f5c4ede618660d8cfe42437f0e8dc22a0) automatic cancelation [of jobs when pushing new commits](https://forgejo.org/docs/v1.21/user/actions/#auto-cancelation-of-workflows) to a PR.
- [Add](https://codeberg.org/forgejo/forgejo/commit/f3d293d2bbe0b2eab047bdd403046069cffbc0c4) support for [uploading multiple artificats](https://forgejo.org/docs/v1.21/user/actions/#artifacts).
- [Add](https://codeberg.org/forgejo/forgejo/commit/48e5a74f215d78813a816c57fc5a85a909a003d5) support for the [`pull_request_target` event](https://forgejo.org/docs/v1.21/user/actions/#onpull_request_target) which has access to secrets because it runs using the workflows from the base branch instead of the pull request.
- [Add](https://codeberg.org/forgejo/forgejo/commit/8228751c55d6a4263f0fec2932ca16181c09c97d) support for reading labels from the runner [instead of specifying them during registration](https://forgejo.org/docs/v1.21/admin/actions/#registration).
@ -1372,7 +1314,7 @@ this situation, [follow the instructions in the companion blog post](https://for
* [The CLI exit code now is different from zero when an error occurs](https://codeberg.org/forgejo/forgejo/commit/089af9ab1)
* [Fix error when a Debian package has a double newline character at the end of the control block](https://codeberg.org/forgejo/forgejo/commit/dd7180846)
* [Fix a condition that would cause git related tasks to hang for longer than necessary in the queues and use too many resources as a result](https://codeberg.org/forgejo/forgejo/commit/36f8fbe1b)
* [Fix the topic validation rule and support dots](https://codeberg.org/forgejo/forgejo/commit/a578b75d7)
* [Fix the topic validation rule and suport dots](https://codeberg.org/forgejo/forgejo/commit/a578b75d7)
* [Fix pull request check list when there are more than 30](https://codeberg.org/forgejo/forgejo/commit/e226b9646)
* [Fix attachment clipboard copy on insecure origin](https://codeberg.org/forgejo/forgejo/commit/12ac84c26)
* [Fix the profile README rendering](https://codeberg.org/forgejo/forgejo/commit/84c3b60a4) that [was inconsistent with other markdown files renderings](https://codeberg.org/forgejo/forgejo/issues/833)
@ -1401,7 +1343,7 @@ This stable release includes bug fixes and displays [warnings in the administrat
The most prominent ones are described here, others can be found in the list of commits included in the release as described above.
* [Add missing assets to the Forgejo sources tarball](https://codeberg.org/forgejo/forgejo/commit/e14d239005)
* [Add missing assets to the Forgejo sources tarbal](https://codeberg.org/forgejo/forgejo/commit/e14d239005)
* [Fix user type selection error when creating a user](https://codeberg.org/forgejo/forgejo/commit/268569b462) and selecting `public` or `private`.
* [Fix access check for org-level project](https://codeberg.org/forgejo/forgejo/commit/5afb0294f4)
* [Warn instead of reporting an error when a webhook cannot be found](https://codeberg.org/forgejo/forgejo/commit/4c3dcdf815)
@ -1456,7 +1398,7 @@ $ git -C forgejo log --oneline --no-merges origin/v1.19/forgejo..origin/v1.20/fo
- The storage settings were [refactored](https://codeberg.org/forgejo/forgejo/commit/d6dd6d641b593c54fe1a1041c153111ce81dbc20). Read more about [storage settings](https://forgejo.org/docs/v1.20/admin/storage/).
- [The [repository.editor] PREVIEWABLE_FILE_MODES setting was removed](https://codeberg.org/forgejo/forgejo/commit/84daddc2fa74393cdc13371b0cc44f0444cfdae0). This setting served no practical purpose and was not working correctly. Instead a preview tab is always shown in the file editor when supported.
- In addition to the already deprecated options inside [queue], many options have been dropped as well. Those are WRAP_IF_NECESSARY, MAX_ATTEMPTS, TIMEOUT, WORKERS, BLOCK_TIMEOUT, BOOST_TIMEOUT, BOOST_WORKERS. You can remove them from your app.ini now. Additionally, some default values have changed in this section.
- The default CSS and templates included in Forgejo were heavily refactored and a large number of variables renamed. These changes are not documented and there is a very high chance that a template extracted and modified for a particular Forgejo instance will no longer work as it did. Browsing through the git history of the template in the sources is the best way to figure out how and why it was modified.
- The default CSS and templates included in Forgejo were heavily refactored and a large number of variables renamed. These changes are not documented and there is a very high chance that a tempate extracted and modified for a particular Forgejo instance will no longer work as it did. Browsing through the git history of the template in the sources is the best way to figure out how and why it was modified.
- **Moderation:**
Blocking another user is desirable if they are acting maliciously or are spamming your repository. When you block a user, Forgejo does not explicitly notify them, but they may learn through an interaction with you that is blocked. [Read more about blocking users](https://forgejo.org/docs/v1.20/user/blocking-user/).
- **Package:**
@ -1464,7 +1406,7 @@ $ git -C forgejo log --oneline --no-merges origin/v1.19/forgejo..origin/v1.20/fo
- **Accessibility:**
numerous improvements for [issue comments](https://codeberg.org/forgejo/forgejo/commit/6c354546547cd3a9595a7db119a6480d9cd506a7), [the menu on the navbar](https://codeberg.org/forgejo/forgejo/commit/a78e0b7dade16bc6509b943fe86e74962f1b95b6), [scoped labels](https://codeberg.org/forgejo/forgejo/commit/e8935606f5f1fff3c59222ebca6d4615ab06fb0b), [checkboxes and dropdowns](https://codeberg.org/forgejo/forgejo/commit/d4f35bd681af0632da988e15306f330e020422b2), [RTL rendering support to Markdown](https://codeberg.org/forgejo/forgejo/commit/32d9c47ec7706d8f06e09b42e09a28d7a0e3c526), [file (re-)views](https://codeberg.org/forgejo/forgejo/commit/e95b42e187cde9ac4bd541cd714bdb4f5c1fd8bc), [interactive tooltips](https://codeberg.org/forgejo/forgejo/commit/87f0f7e670c6c0e6aeab8c4458bfdb9d954eacec), [using a button element](https://codeberg.org/forgejo/forgejo/commit/81fe5d61851c0e586af7d32c29171ceff9a571bb), [repository list](https://codeberg.org/forgejo/forgejo/commit/e82f1b15c7120ad13fd3b67cf7e2c6cb9915c22d) and more.
- **Time:**
The display and localization of time was improved for [tooltips](https://codeberg.org/forgejo/forgejo/commit/b7b58348317cbe0145dc453d45c886b8e2764b4c), [milestones](https://codeberg.org/forgejo/forgejo/commit/97176754beb4de23fa0f68df715c4737919c93b0), [due date and translations that contain dates](https://codeberg.org/forgejo/forgejo/commit/70bb4984cdad9a15d676708bd345b590aa42d72a), [commit graphs](https://codeberg.org/forgejo/forgejo/commit/5bc9f7fcf9aece92c3fa2a0ea56e5585261a7f28), [runners](https://codeberg.org/forgejo/forgejo/commit/62ca5825f73ad5a25ffeb6c3ef66f0eaf5d30cdf), [webhooks](https://codeberg.org/forgejo/forgejo/commit/dbb37367854d108ebfffcac27837c0afac199a8e), [tests](https://codeberg.org/forgejo/forgejo/commit/3d266dd0f3dbae7e417c0e790e266aebc0078814) and more. Previously each rendered timestamp would be static, now the real time since an event happened is show. If a comment was added 2 minutes before the page rendered it would show as "2 minutes ago" on the initial render and if another 8 minutes have passed, without a page refresh you'd see "10 minutes ago".
The display and localization of time was improved for [tooltips](https://codeberg.org/forgejo/forgejo/commit/b7b58348317cbe0145dc453d45c886b8e2764b4c), [milestones](https://codeberg.org/forgejo/forgejo/commit/97176754beb4de23fa0f68df715c4737919c93b0), [due date and translations that contain dates](https://codeberg.org/forgejo/forgejo/commit/70bb4984cdad9a15d676708bd345b590aa42d72a), [commit graphs](https://codeberg.org/forgejo/forgejo/commit/5bc9f7fcf9aece92c3fa2a0ea56e5585261a7f28), [runners](https://codeberg.org/forgejo/forgejo/commit/62ca5825f73ad5a25ffeb6c3ef66f0eaf5d30cdf), [webhooks](https://codeberg.org/forgejo/forgejo/commit/dbb37367854d108ebfffcac27837c0afac199a8e), [tests](https://codeberg.org/forgejo/forgejo/commit/3d266dd0f3dbae7e417c0e790e266aebc0078814) and more. Previously each rendered timestamp would be static, now the real time since an event happend is show. If a comment was added 2 minutes before the page rendered it would show as "2 minutes ago" on the initial render and if another 8 minutes have passed, without a page refresh you'd see "10 minutes ago".
- **[Wiki](https://forgejo.org/docs/v1.20/user/wiki/)**
- Improve the [display of the table of content](https://codeberg.org/forgejo/forgejo/commit/1ab16e48cccc086e7f97fb3ae8a293fe47a3a452)
- Fixed a bug [preventing team users who have wiki write permission from deleting a page](https://codeberg.org/forgejo/forgejo/commit/284b41f45244bbe46fc8feee15bbfdf66d150e79)
@ -1805,7 +1747,7 @@ $ git -C forgejo log --oneline --no-merges origin/v1.18/forgejo..origin/v1.19/fo
Forgejo access token, used with the [API](https://forgejo.org/docs/v1.19/admin/api-usage/) can now have a "scope" that limits what it can access. Existing tokens stored in the database and created before Forgejo v1.19 had unlimited access. For backward compatibility, their access will remain the same and they will continue to work as before. However, **newly created token that do not specify a scope will now only have read-only access to public user profile and public repositories**.
For instance, the `/users/{username}/tokens` API endpoint will require the `scopes: ['all', 'sudo']` parameter and the `forgejo admin user generate-access-token` will require the `--scopes all,sudo` argument obtain tokens with unlimited access as before for admin users.
For instance, the `/users/{username}/tokens` API endpoint will require the `scopes: ['all', 'sudo']` parameter and the `forgejo admin user generate-access-token` will require the `--scopes all,sudo` argument obtain tokens with ulimited access as before for admin users.
[Read more about the scoped tokens](https://forgejo.org/docs/v1.19/user/oauth2-provider/#scoped-tokens).
@ -1922,7 +1864,7 @@ $ git -C forgejo log --oneline --no-merges origin/v1.18/forgejo..origin/v1.19/fo
It appears for the first time in this Forgejo release but is not yet fit for production. It is not fully implemented and may be insecure. However, as long as it is not enabled, it presents no risk to existing Forgejo instances.
If a repository has a file such as `.forgejo/workflows/test.yml`, it will be interpreted, for instance to run tests and verify the code in the repository works as expected (Continuous Integration). It can also be used to create HTML pages for a website and publish them (Continuous Deployment). The syntax is similar to GitHub Actions and the jobs can be controlled from the Forgejo web interface.
If a repository has a file such as `.forgejo/workflows/test.yml`, it will be interpreted, for instance to run tests and verify the code in the repository works as expected (Continuous Integration). It can also be used to create HTML pages for a website and publish them (Continous Deployment). The syntax is similar to GitHub Actions and the jobs can be controled from the Forgejo web interface.
[Read more about Forgejo Actions](https://forgejo.codeberg.page/2023-02-27-forgejo-actions/)

File diff suppressed because one or more lines are too long

View file

@ -18,8 +18,8 @@ import (
func main() {
if len(os.Args) != 2 {
fmt.Println("usage: backport-locales <to-ref>")
fmt.Println("eg: backport-locales release/v1.19")
println("usage: backport-locales <to-ref>")
println("eg: backport-locales release/v1.19")
os.Exit(1)
}

View file

@ -69,7 +69,6 @@ func newFileCollector(fileFilter string, batchSize int) (*fileCollector, error)
co.includePatterns = append(co.includePatterns, regexp.MustCompile(`.*\.go$`))
co.excludePatterns = append(co.excludePatterns, regexp.MustCompile(`.*\bbindata\.go$`))
co.excludePatterns = append(co.excludePatterns, regexp.MustCompile(`\.pb\.go$`))
co.excludePatterns = append(co.excludePatterns, regexp.MustCompile(`tests/gitea-repositories-meta`))
co.excludePatterns = append(co.excludePatterns, regexp.MustCompile(`tests/integration/migration-test`))
co.excludePatterns = append(co.excludePatterns, regexp.MustCompile(`modules/git/tests`))
@ -204,6 +203,17 @@ Example:
`, "file-batch-exec")
}
func getGoVersion() string {
goModFile, err := os.ReadFile("go.mod")
if err != nil {
log.Fatalf(`Faild to read "go.mod": %v`, err)
os.Exit(1)
}
goModVersionRegex := regexp.MustCompile(`go \d+\.\d+`)
goModVersionLine := goModVersionRegex.Find(goModFile)
return string(goModVersionLine[3:])
}
func newFileCollectorFromMainOptions(mainOptions map[string]string) (fc *fileCollector, err error) {
fileFilter := mainOptions["file-filter"]
if fileFilter == "" {
@ -268,8 +278,7 @@ func main() {
log.Print("the -d option is not supported by gitea-fmt")
}
cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-w")))
cmdErrors = append(cmdErrors, passThroughCmd("gofmt", append([]string{"-w", "-r", "interface{} -> any"}, substArgs...)))
cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("GOFUMPT_PACKAGE"), "-extra"}, substArgs...)))
cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("GOFUMPT_PACKAGE"), "-extra", "-lang", getGoVersion()}, substArgs...)))
default:
log.Fatalf("unknown cmd: %s %v", subCmd, subArgs)
}

View file

@ -4,7 +4,6 @@
package cmd
import (
"errors"
"fmt"
"os"
"text/tabwriter"
@ -92,7 +91,7 @@ func runListAuth(c *cli.Context) error {
func runDeleteAuth(c *cli.Context) error {
if !c.IsSet("id") {
return errors.New("--id flag is missing")
return fmt.Errorf("--id flag is missing")
}
ctx, cancel := installSignals()

View file

@ -4,7 +4,6 @@
package cmd
import (
"errors"
"fmt"
"net/url"
@ -194,7 +193,7 @@ func runAddOauth(c *cli.Context) error {
func runUpdateOauth(c *cli.Context) error {
if !c.IsSet("id") {
return errors.New("--id flag is missing")
return fmt.Errorf("--id flag is missing")
}
ctx, cancel := installSignals()

View file

@ -5,6 +5,7 @@ package cmd
import (
"errors"
"fmt"
"strings"
auth_model "code.gitea.io/gitea/models/auth"
@ -165,7 +166,7 @@ func runAddSMTP(c *cli.Context) error {
func runUpdateSMTP(c *cli.Context) error {
if !c.IsSet("id") {
return errors.New("--id flag is missing")
return fmt.Errorf("--id flag is missing")
}
ctx, cancel := installSignals()

View file

@ -4,7 +4,6 @@
package cmd
import (
"errors"
"fmt"
"strings"
@ -43,7 +42,7 @@ var microcmdUserDelete = &cli.Command{
func runDeleteUser(c *cli.Context) error {
if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") {
return errors.New("You must provide the id, username or email of a user to delete")
return fmt.Errorf("You must provide the id, username or email of a user to delete")
}
ctx, cancel := installSignals()

View file

@ -4,7 +4,6 @@
package cmd
import (
"errors"
"fmt"
auth_model "code.gitea.io/gitea/models/auth"
@ -43,7 +42,7 @@ var microcmdUserGenerateAccessToken = &cli.Command{
func runGenerateAccessToken(c *cli.Context) error {
if !c.IsSet("username") {
return errors.New("You must provide a username to generate a token for")
return fmt.Errorf("You must provide a username to generate a token for")
}
ctx, cancel := installSignals()
@ -69,7 +68,7 @@ func runGenerateAccessToken(c *cli.Context) error {
return err
}
if exist {
return errors.New("access token name has been used already")
return fmt.Errorf("access token name has been used already")
}
// make sure the scopes are valid

View file

@ -17,7 +17,7 @@ import (
var cmdDoctorConvert = &cli.Command{
Name: "convert",
Usage: "Convert the database",
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4",
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
Action: runDoctorConvert,
}
@ -35,14 +35,21 @@ func runDoctorConvert(ctx *cli.Context) error {
log.Info("Log path: %s", setting.Log.RootPath)
log.Info("Configuration file: %s", setting.CustomConf)
if setting.Database.Type.IsMySQL() {
switch {
case setting.Database.Type.IsMySQL():
if err := db.ConvertDatabaseTable(); err != nil {
log.Fatal("Failed to convert database & table: %v", err)
return err
}
fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")
} else {
fmt.Println("This command can only be used with a MySQL database")
case setting.Database.Type.IsMSSQL():
if err := db.ConvertVarcharToNVarchar(); err != nil {
log.Fatal("Failed to convert database from varchar to nvarchar: %v", err)
return err
}
fmt.Println("Converted successfully, please confirm your database's all columns character is NVARCHAR now")
default:
fmt.Println("This command can only be used with a MySQL or MSSQL database")
}
return nil

View file

@ -128,7 +128,7 @@ It can be used for backup and capture Forgejo server image to send to maintainer
&cli.StringFlag{
Name: "database",
Aliases: []string{"d"},
Usage: "Specify the database SQL syntax: sqlite3, mysql, postgres",
Usage: "Specify the database SQL syntax: sqlite3, mysql, mssql, postgres",
},
&cli.BoolFlag{
Name: "skip-repository",

View file

@ -50,7 +50,7 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, nil, false)
assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 1)
assert.Contains(t, archiver.addedFiles, "example")
assert.EqualValues(t, "example", archiver.addedFiles[0])
})
t.Run("With exclude", func(t *testing.T) {
@ -77,11 +77,11 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, nil, false)
assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 5)
assert.Contains(t, archiver.addedFiles, "deep")
assert.Contains(t, archiver.addedFiles, "deep/nested")
assert.Contains(t, archiver.addedFiles, "deep/nested/folder")
assert.Contains(t, archiver.addedFiles, "deep/nested/folder/example")
assert.Contains(t, archiver.addedFiles, "deep/nested/folder/another-file")
assert.EqualValues(t, "deep", archiver.addedFiles[0])
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1])
assert.EqualValues(t, "deep/nested/folder", archiver.addedFiles[2])
assert.EqualValues(t, "deep/nested/folder/example", archiver.addedFiles[3])
assert.EqualValues(t, "deep/nested/folder/another-file", archiver.addedFiles[4])
})
t.Run("Exclude first directory", func(t *testing.T) {
@ -98,8 +98,8 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder"}, false)
assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 2)
assert.Contains(t, archiver.addedFiles, "deep")
assert.Contains(t, archiver.addedFiles, "deep/nested")
assert.EqualValues(t, "deep", archiver.addedFiles[0])
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1])
})
t.Run("Exclude file", func(t *testing.T) {
@ -108,10 +108,10 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder/example"}, false)
assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 4)
assert.Contains(t, archiver.addedFiles, "deep")
assert.Contains(t, archiver.addedFiles, "deep/nested")
assert.Contains(t, archiver.addedFiles, "deep/nested/folder")
assert.Contains(t, archiver.addedFiles, "deep/nested/folder/another-file")
assert.EqualValues(t, "deep", archiver.addedFiles[0])
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1])
assert.EqualValues(t, "deep/nested/folder", archiver.addedFiles[2])
assert.EqualValues(t, "deep/nested/folder/another-file", archiver.addedFiles[3])
})
})
}

View file

@ -157,9 +157,9 @@ func runViewDo(c *cli.Context) error {
}
if len(matchedAssetFiles) == 0 {
return errors.New("no files matched the given pattern")
return fmt.Errorf("no files matched the given pattern")
} else if len(matchedAssetFiles) > 1 {
return errors.New("too many files matched the given pattern, try to be more specific")
return fmt.Errorf("too many files matched the given pattern, try to be more specific")
}
data, err := matchedAssetFiles[0].fs.ReadFile(matchedAssetFiles[0].name)
@ -180,7 +180,7 @@ func runExtractDo(c *cli.Context) error {
}
if c.NArg() == 0 {
return errors.New("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
}
destdir := "."

View file

@ -134,8 +134,8 @@ func validateSecret(secret string) error {
}
func RunRegister(ctx context.Context, cliCtx *cli.Context) error {
var cancel context.CancelFunc
if !ContextGetNoInit(ctx) {
var cancel context.CancelFunc
ctx, cancel = installSignals(ctx)
defer cancel()

View file

@ -1,77 +0,0 @@
// Copyright Earl Warren <contact@earl-warren.org>
// Copyright Loïc Dachary <loic@dachary.org>
// SPDX-License-Identifier: MIT
package forgejo
import (
"context"
"errors"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/services/f3/util"
_ "code.gitea.io/gitea/services/f3/driver" // register the driver
f3_cmd "code.forgejo.org/f3/gof3/v3/cmd"
f3_logger "code.forgejo.org/f3/gof3/v3/logger"
f3_util "code.forgejo.org/f3/gof3/v3/util"
"github.com/urfave/cli/v2"
)
func CmdF3(ctx context.Context) *cli.Command {
ctx = f3_logger.ContextSetLogger(ctx, util.NewF3Logger(nil, log.GetLogger(log.DEFAULT)))
return &cli.Command{
Name: "f3",
Usage: "F3",
Subcommands: []*cli.Command{
SubcmdF3Mirror(ctx),
},
}
}
func SubcmdF3Mirror(ctx context.Context) *cli.Command {
mirrorCmd := f3_cmd.CreateCmdMirror(ctx)
mirrorCmd.Before = prepareWorkPathAndCustomConf(ctx)
f3Action := mirrorCmd.Action
mirrorCmd.Action = func(c *cli.Context) error { return runMirror(ctx, c, f3Action) }
return mirrorCmd
}
func runMirror(ctx context.Context, c *cli.Context, action cli.ActionFunc) error {
setting.LoadF3Setting()
if !setting.F3.Enabled {
return errors.New("F3 is disabled, it is not ready to be used and is only present for development purposes")
}
var cancel context.CancelFunc
if !ContextGetNoInit(ctx) {
ctx, cancel = installSignals(ctx)
defer cancel()
if err := initDB(ctx); err != nil {
return err
}
if err := storage.Init(); err != nil {
return err
}
if err := git.InitSimple(ctx); err != nil {
return err
}
if err := models.Init(ctx); err != nil {
return err
}
}
err := action(c)
if panicError, ok := err.(f3_util.PanicError); ok {
log.Debug("F3 Stack trace\n%s", panicError.Stack())
}
return err
}

View file

@ -36,7 +36,6 @@ func CmdForgejo(ctx context.Context) *cli.Command {
Flags: []cli.Flag{},
Subcommands: []*cli.Command{
CmdActions(ctx),
CmdF3(ctx),
},
}
}

View file

@ -484,7 +484,7 @@ func hookPrintResults(results []private.HookPostReceiveBranchResult) {
fmt.Fprintf(os.Stderr, " %s\n", res.URL)
}
fmt.Fprintln(os.Stderr, "")
_ = os.Stderr.Sync()
os.Stderr.Sync()
}
}
@ -783,7 +783,7 @@ func writeFlushPktLine(ctx context.Context, out io.Writer) error {
return nil
}
// Write an Pkt-Line based on `data` to `out` according to the specification.
// Write an Pkt-Line based on `data` to `out` according to the specifcation.
// https://git-scm.com/docs/protocol-common
func writeDataPktLine(ctx context.Context, out io.Writer, data []byte) error {
// Implementations SHOULD NOT send an empty pkt-line ("0004").

View file

@ -124,7 +124,6 @@ func NewMainApp(version, versionExtra string) *cli.App {
var subCmdsStandalone []*cli.Command = make([]*cli.Command, 0, 10)
var subCmdWithConfig []*cli.Command = make([]*cli.Command, 0, 10)
var globalFlags []cli.Flag = make([]cli.Flag, 0, 10)
//
// If the executable is forgejo-cli, provide a Forgejo specific CLI
@ -132,15 +131,6 @@ func NewMainApp(version, versionExtra string) *cli.App {
//
if executable == "forgejo-cli" {
subCmdsStandalone = append(subCmdsStandalone, forgejo.CmdActions(context.Background()))
subCmdWithConfig = append(subCmdWithConfig, forgejo.CmdF3(context.Background()))
globalFlags = append(globalFlags, []cli.Flag{
&cli.BoolFlag{
Name: "quiet",
},
&cli.BoolFlag{
Name: "verbose",
},
}...)
} else {
//
// Otherwise provide a Gitea compatible CLI which includes Forgejo
@ -152,10 +142,10 @@ func NewMainApp(version, versionExtra string) *cli.App {
subCmdWithConfig = append(subCmdWithConfig, CmdActions)
}
return innerNewMainApp(version, versionExtra, subCmdsStandalone, subCmdWithConfig, globalFlags)
return innerNewMainApp(version, versionExtra, subCmdsStandalone, subCmdWithConfig)
}
func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmdWithConfigArgs []*cli.Command, globalFlagsArgs []cli.Flag) *cli.App {
func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmdWithConfigArgs []*cli.Command) *cli.App {
app := cli.NewApp()
app.HelpName = "forgejo"
app.Name = "Forgejo"
@ -195,7 +185,6 @@ func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmd
app.DefaultCommand = CmdWeb.Name
globalFlags := appGlobalFlags()
globalFlags = append(globalFlags, globalFlagsArgs...)
app.Flags = append(app.Flags, cli.VersionFlag)
app.Flags = append(app.Flags, globalFlags...)
app.HideHelp = true // use our own help action to show helps (with more information like default config)

View file

@ -4,7 +4,6 @@
package cmd
import (
"errors"
"fmt"
"os"
@ -250,7 +249,7 @@ func runAddFileLogger(c *cli.Context) error {
if c.IsSet("filename") {
vals["filename"] = c.String("filename")
} else {
return errors.New("filename must be set when creating a file logger")
return fmt.Errorf("filename must be set when creating a file logger")
}
if c.IsSet("rotate") {
vals["rotate"] = c.Bool("rotate")

View file

@ -136,7 +136,7 @@ func runServ(c *cli.Context) error {
setup(ctx, c.Bool("debug"))
if setting.SSH.Disabled {
fmt.Println("Forgejo: SSH has been disabled")
println("Forgejo: SSH has been disabled")
return nil
}
@ -164,13 +164,13 @@ func runServ(c *cli.Context) error {
}
switch key.Type {
case asymkey_model.KeyTypeDeploy:
fmt.Println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Forgejo does not provide shell access.")
println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Forgejo does not provide shell access.")
case asymkey_model.KeyTypePrincipal:
fmt.Println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Forgejo does not provide shell access.")
println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Forgejo does not provide shell access.")
default:
fmt.Println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Forgejo does not provide shell access.")
println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Forgejo does not provide shell access.")
}
fmt.Println("If this is unexpected, please log in with password and setup Forgejo under another user.")
println("If this is unexpected, please log in with password and setup Forgejo under another user.")
return nil
} else if c.Bool("debug") {
log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))

View file

@ -11,7 +11,7 @@ The default version will read from `docs/config.yml`. You can override this
using the option `--version`.
The upstream branches will be fetched, using the remote `origin`. This can
be overridden using `--upstream`, and fetching can be avoided using
be overrided using `--upstream`, and fetching can be avoided using
`--no-fetch`.
By default the branch created will be called `backport-$PR-$VERSION`. You

View file

@ -150,7 +150,7 @@
<p>In general, Your Gitea Instance retains User Personal Information for as long as your account is active, or as needed to provide you service.</p>
<p>If you would like to cancel your account or delete your User Personal Information, you may do so in your user profile. We retain and use your information as necessary to comply with our legal obligations, resolve disputes, and enforce our agreements, but barring legal requirements, we will delete your full profile (within reason) within 90 days of your request. Feel free to contact our support to request erasure of the data we process on the basis of consent within 30 days.</p>
<p>If you would like to cancel your account or delete your User Personal Information, you may do so in your user profile. We retain and use your information as necessary to comply with our legal obligations, resolve disputes, and enforce our agreements, but barring legal requirements, we will delete your full profile (within reason) within 90 days of your request. Feel free to contact our support to request erasure of the data we process on the bassis of consent within 30 days.</p>
<p>After an account has been deleted, certain data, such as contributions to other Users' repositories and comments in others' issues, will remain. However, we will delete or de-identify your User Personal Information, including your username and email address, from the author field of issues, pull requests, and comments by associating them with a ghost user.</p>

View file

@ -1,10 +1,10 @@
; This file lists the default values used by Forgejo
; This file lists the default values used by Gitea
;; Copy required sections to your own app.ini (default is custom/conf/app.ini)
;; and modify as needed.
;; Do not copy the whole file as-is, as it contains some invalid sections for illustrative purposes.
;; If you don't know what a setting is you should not set it.
;;
;; see https://forgejo.org/docs/next/admin/config-cheat-sheet for additional documentation.
;; see https://docs.gitea.com/administration/config-cheat-sheet for additional documentation.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -41,14 +41,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; App name that shows in every page title
APP_NAME = ; Forgejo: Beyond coding. We Forge.
;;
;; APP_SLOGAN shows a slogan near the App name in every page title.
;APP_SLOGAN =
;;
;; APP_DISPLAY_NAME_FORMAT defines how the AppDisplayName should be presented
;; It is used only if APP_SLOGAN is set.
;APP_DISPLAY_NAME_FORMAT = {APP_NAME}: {APP_SLOGAN}
APP_NAME = ; Gitea: Git with a cup of tea
;;
;; RUN_USER will automatically detect the current user - but you can set it here change it if you run locally
RUN_USER = ; git
@ -420,8 +413,8 @@ USER = root
;; Database connection max idle time, 0 prevents closing due to idle time.
;CONN_MAX_IDLETIME = 0
;;
;; Database maximum number of open connections, default is 100 which is the lowest default from Postgres (MariaDB + MySQL default to 151). Ensure you only increase the value if you configured your database server accordingly.
;MAX_OPEN_CONNS = 100
;; Database maximum number of open connections, default is 0 meaning no maximum
;MAX_OPEN_CONNS = 0
;;
;; Whether execute database models migrations automatically
;AUTO_MIGRATION = true
@ -984,7 +977,7 @@ LEVEL = Info
;ACCESS_CONTROL_ALLOW_ORIGIN =
;;
;; Force ssh:// clone url instead of scp-style uri when default SSH port is used
;USE_COMPAT_SSH_URI = true
;USE_COMPAT_SSH_URI = false
;;
;; Value for the "go get" request returns the repository url as https or ssh, default is https
;GO_GET_CLONE_URL_PROTOCOL = https
@ -1349,9 +1342,9 @@ LEVEL = Info
;[ui.meta]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AUTHOR = Forgejo Beyond coding. We forge.
;DESCRIPTION = Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
;KEYWORDS = git,forge,forgejo
;AUTHOR = Gitea - Git with a cup of tea
;DESCRIPTION = Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go
;KEYWORDS = go,git,self-hosted,gitea
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1387,9 +1380,6 @@ LEVEL = Info
;;
;; Maximum allowed file size in bytes to render CSV files as table. (Set to 0 for no limit).
;MAX_FILE_SIZE = 524288
;;
;; Maximum allowed rows to render CSV files. (Set to 0 for no limit)
;MAX_ROWS = 2500
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1517,7 +1507,7 @@ LEVEL = Info
;; Batch size to send for batched queues
;BATCH_LENGTH = 20
;;
;; Connection string for redis queues this will store the redis (or Redis cluster) connection string.
;; Connection string for redis queues this will store the redis or redis-cluster connection string.
;; When `TYPE` is `persistable-channel`, this provides a directory for the underlying leveldb
;; or additional options of the form `leveldb://path/to/db?option=value&....`, and will override `DATADIR`.
;CONN_STR = "redis://127.0.0.1:6379/0"
@ -1549,11 +1539,6 @@ LEVEL = Info
;; - manage_ssh_keys: a user cannot configure ssh keys
;; - manage_gpg_keys: a user cannot configure gpg keys
;USER_DISABLED_FEATURES =
;; Comma separated list of disabled features ONLY if the user has an external login type (eg. LDAP, Oauth, etc.), could be `deletion`, `manage_ssh_keys`, `manage_gpg_keys`. This setting is independent from `USER_DISABLED_FEATURES` and supplements its behavior.
;; - deletion: a user cannot delete their own account
;; - manage_ssh_keys: a user cannot configure ssh keys
;; - manage_gpg_keys: a user cannot configure gpg keys
;;EXTERNAL_USER_DISABLE_FEATURES =
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1749,16 +1734,6 @@ LEVEL = Info
;; convert \r\n to \n for Sendmail
;SENDMAIL_CONVERT_CRLF = true
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[mailer.override_header]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is empty by default, use it only if you know what you need it for.
;Reply-To = test@example.com, test2@example.com
;Content-Type = text/html; charset=utf-8
;In-Reply-To =
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[email.incoming]
@ -1812,8 +1787,9 @@ LEVEL = Info
;; For "memory" only, GC interval in seconds, default is 60
;INTERVAL = 60
;;
;; For "redis" and "memcache", connection host address
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` (or `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` for a Redis cluster)
;; For "redis", "redis-cluster" and "memcache", connection host address
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
;; redis-cluster: `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
;; memcache: `127.0.0.1:11211`
;; twoqueue: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000`
;HOST =
@ -1843,14 +1819,15 @@ LEVEL = Info
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Either "memory", "file", "redis", "db", "mysql", "couchbase", "memcache" or "postgres"
;; Either "memory", "file", "redis", "redis-cluster", "db", "mysql", "couchbase", "memcache" or "postgres"
;; Default is "memory". "db" will reuse the configuration in [database]
;PROVIDER = memory
;;
;; Provider config options
;; memory: doesn't have any config yet
;; file: session file path, e.g. `data/sessions`
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` (or `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` for a Redis cluster)
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
;; redis-cluster: `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
;; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
;PROVIDER_CONFIG = data/sessions ; Relative paths will be made absolute against _`AppWorkPath`_.
;;
@ -1944,10 +1921,7 @@ LEVEL = Info
;; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
;MINIO_ENDPOINT = localhost:9000
;;
;; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`.
;; If not provided and STORAGE_TYPE is `minio`, will search for credentials in known
;; environment variables (MINIO_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID), credentials files
;; (~/.mc/config.json, ~/.aws/credentials), and EC2 instance metadata.
;; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`
;MINIO_ACCESS_KEY_ID =
;;
;; Minio secretAccessKey to connect only available when STORAGE_TYPE is `minio`
@ -2407,8 +2381,6 @@ LEVEL = Info
;SHOW_FOOTER_VERSION = true
;; Show template execution time in the footer
;SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
;; Show the "powered by" text in the footer
;SHOW_FOOTER_POWERED_BY = true
;; Generate sitemap. Defaults to `true`.
;ENABLE_SITEMAP = true
;; Enable/Disable RSS/Atom feed
@ -2499,15 +2471,6 @@ LEVEL = Info
;; If set to true, completely ignores server certificate validation errors. This option is unsafe.
;SKIP_TLS_VERIFY = false
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[F3]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Enable/Disable Friendly Forge Format (F3)
;ENABLED = false
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[federation]
@ -2665,10 +2628,7 @@ LEVEL = Info
;; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
;MINIO_ENDPOINT = localhost:9000
;;
;; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`.
;; If not provided and STORAGE_TYPE is `minio`, will search for credentials in known
;; environment variables (MINIO_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID), credentials files
;; (~/.mc/config.json, ~/.aws/credentials), and EC2 instance metadata.
;; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`
;MINIO_ACCESS_KEY_ID =
;;
;; Minio secretAccessKey to connect only available when STORAGE_TYPE is `minio`

View file

@ -13,10 +13,5 @@ fi
if [ $# -gt 0 ]; then
exec "$@"
else
# TODO: remove on next major version release
# Honour legacy config file if existing
if [ -f ${GITEA_APP_INI_LEGACY} ]; then
GITEA_APP_INI=${GITEA_APP_INI_LEGACY}
fi
exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web
fi

View file

@ -11,18 +11,6 @@ mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM}
mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP}
if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi
# TODO: remove on next major version release
# Honour legacy config file if existing, but inform the user
if [ -f ${GITEA_APP_INI_LEGACY} ] && [ ${GITEA_APP_INI} != ${GITEA_APP_INI_LEGACY} ]; then
GITEA_APP_INI_DEFAULT=/var/lib/gitea/custom/conf/app.ini
echo -e \
"\033[33mWARNING\033[0m: detected configuration file in deprecated default path ${GITEA_APP_INI_LEGACY}." \
"The new default is ${GITEA_APP_INI_DEFAULT}. To remove this warning, choose one of the options:\n" \
"* Move ${GITEA_APP_INI_LEGACY} to ${GITEA_APP_INI_DEFAULT} (or to \$GITEA_APP_INI if you want to override this variable)\n" \
"* Explicitly override GITEA_APP_INI=${GITEA_APP_INI_LEGACY} in the container environment"
GITEA_APP_INI=${GITEA_APP_INI_LEGACY}
fi
#Prepare config file
if [ ! -f ${GITEA_APP_INI} ]; then

View file

@ -1,61 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1717974879,
"narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,38 +0,0 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# generic
git
git-lfs
gnumake
gnused
gnutar
gzip
# frontend
nodejs_20
# linting
python312
poetry
# backend
go_1_22
gofumpt
];
};
}
);
}

128
go.mod
View file

@ -1,17 +1,14 @@
module code.gitea.io/gitea
go 1.22.0
toolchain go1.22.4
go 1.22.3
require (
code.forgejo.org/f3/gof3/v3 v3.4.0
code.forgejo.org/forgejo/reply v1.0.2
code.forgejo.org/forgejo/reply v1.0.1
code.gitea.io/actions-proto-go v0.4.0
code.gitea.io/gitea-vet v0.2.3
code.gitea.io/sdk/gitea v0.17.1
codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570
connectrpc.com/connect v1.16.2
connectrpc.com/connect v1.15.0
gitea.com/go-chi/binding v0.0.0-20240430071103-39a851e106ed
gitea.com/go-chi/cache v0.2.0
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098
@ -19,19 +16,19 @@ require (
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
github.com/ProtonMail/go-crypto v1.0.0
github.com/PuerkitoBio/goquery v1.9.2
github.com/alecthomas/chroma/v2 v2.14.0
github.com/PuerkitoBio/goquery v1.8.1
github.com/alecthomas/chroma/v2 v2.13.0
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
github.com/blevesearch/bleve/v2 v2.4.0
github.com/blevesearch/bleve/v2 v2.3.10
github.com/buildkite/terminal-to-html/v3 v3.10.1
github.com/caddyserver/certmagic v0.21.0
github.com/caddyserver/certmagic v0.20.0
github.com/chi-middleware/proxy v1.1.1
github.com/denisenkom/go-mssqldb v0.12.3
github.com/djherbis/buffer v1.2.0
github.com/djherbis/nio/v3 v3.0.1
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5
github.com/dustin/go-humanize v1.0.1
github.com/editorconfig/editorconfig-core-go/v2 v2.6.2
github.com/editorconfig/editorconfig-core-go/v2 v2.6.1
github.com/emersion/go-imap v1.2.1
github.com/emirpasic/gods v1.18.1
github.com/felixge/fgprof v0.9.4
@ -39,46 +36,45 @@ require (
github.com/gliderlabs/ssh v0.3.7
github.com/go-ap/activitypub v0.0.0-20231114162308-e219254dc5c9
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73
github.com/go-chi/chi/v5 v5.0.14
github.com/go-chi/chi/v5 v5.0.11
github.com/go-chi/cors v1.2.1
github.com/go-co-op/gocron v1.37.0
github.com/go-enry/go-enry/v2 v2.8.8
github.com/go-enry/go-enry/v2 v2.8.7
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e
github.com/go-git/go-billy/v5 v5.5.0
github.com/go-git/go-git/v5 v5.11.0
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-sql-driver/mysql v1.8.1
github.com/go-swagger/go-swagger v0.30.5
github.com/go-testfixtures/testfixtures/v3 v3.11.0
github.com/go-testfixtures/testfixtures/v3 v3.10.0
github.com/go-webauthn/webauthn v0.10.0
github.com/gobwas/glob v0.2.3
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/google/go-github/v57 v57.0.0
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7
github.com/google/uuid v1.6.0
github.com/gorilla/feeds v1.2.0
github.com/gorilla/feeds v1.1.2
github.com/gorilla/sessions v1.2.2
github.com/h2non/gock v1.2.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/huandu/xstrings v1.5.0
github.com/huandu/xstrings v1.4.0
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/jhillyerd/enmime v1.2.0
github.com/jhillyerd/enmime v1.1.0
github.com/json-iterator/go v1.1.12
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
github.com/klauspost/compress v1.17.9
github.com/klauspost/cpuid/v2 v2.2.7
github.com/klauspost/compress v1.17.7
github.com/klauspost/cpuid/v2 v2.2.6
github.com/lib/pq v1.10.9
github.com/markbates/goth v1.80.0
github.com/markbates/goth v1.78.0
github.com/mattn/go-isatty v0.0.20
github.com/mattn/go-sqlite3 v1.14.22
github.com/meilisearch/meilisearch-go v0.26.1
github.com/mholt/archiver/v3 v3.5.1
github.com/microcosm-cc/bluemonday v1.0.26
github.com/minio/minio-go/v7 v7.0.70
github.com/minio/minio-go/v7 v7.0.69
github.com/msteinert/pam v1.2.0
github.com/nektos/act v0.2.52
github.com/niklasfasching/go-org v1.7.0
@ -88,30 +84,29 @@ require (
github.com/pquerna/otp v1.4.0
github.com/prometheus/client_golang v1.18.0
github.com/quasoft/websspi v1.1.2
github.com/redis/go-redis/v9 v9.5.2
github.com/redis/go-redis/v9 v9.4.0
github.com/robfig/cron/v3 v3.0.1
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/sassoftware/go-rpmutils v0.2.1-0.20240124161140-277b154961dd
github.com/sergi/go-diff v1.3.1
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.8.4
github.com/syndtr/goleveldb v1.0.0
github.com/tstranex/u2f v1.0.0
github.com/ulikunitz/xz v0.5.11
github.com/urfave/cli/v2 v2.27.2
github.com/valyala/fastjson v1.6.4
github.com/urfave/cli/v2 v2.27.1
github.com/xanzy/go-gitlab v0.96.0
github.com/yohcop/openid-go v1.0.1
github.com/yuin/goldmark v1.7.4
github.com/yuin/goldmark v1.6.0
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
github.com/yuin/goldmark-meta v1.1.0
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.24.0
golang.org/x/image v0.18.0
golang.org/x/net v0.26.0
golang.org/x/oauth2 v0.21.0
golang.org/x/sys v0.21.0
golang.org/x/text v0.16.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
golang.org/x/crypto v0.21.0
golang.org/x/image v0.15.0
golang.org/x/net v0.23.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sys v0.18.0
golang.org/x/text v0.14.0
golang.org/x/tools v0.17.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.33.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
@ -124,17 +119,19 @@ require (
)
require (
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 // indirect
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.24.0 // indirect
github.com/ClickHouse/ch-go v0.61.1 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.18.0 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/RoaringBitmap/roaring v1.7.0 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
@ -143,13 +140,12 @@ require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/blevesearch/bleve_index_api v1.1.6 // indirect
github.com/blevesearch/geo v0.1.20 // indirect
github.com/blevesearch/go-faiss v1.0.13 // indirect
github.com/blevesearch/bleve_index_api v1.1.5 // indirect
github.com/blevesearch/geo v0.1.19 // indirect
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
github.com/blevesearch/gtreap v0.1.1 // indirect
github.com/blevesearch/mmap-go v1.0.4 // indirect
github.com/blevesearch/scorch_segment_api/v2 v2.2.9 // indirect
github.com/blevesearch/scorch_segment_api/v2 v2.2.6 // indirect
github.com/blevesearch/segment v0.9.1 // indirect
github.com/blevesearch/snowballstem v0.9.0 // indirect
github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect
@ -159,17 +155,15 @@ require (
github.com/blevesearch/zapx/v13 v13.3.10 // indirect
github.com/blevesearch/zapx/v14 v14.3.10 // indirect
github.com/blevesearch/zapx/v15 v15.3.13 // indirect
github.com/blevesearch/zapx/v16 v16.0.12 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
github.com/caddyserver/zerossl v0.1.2 // indirect
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/couchbase/go-couchbase v0.1.1 // indirect
github.com/couchbase/gomemcached v0.3.0 // indirect
github.com/couchbase/goutils v0.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
@ -199,11 +193,12 @@ require (
github.com/go-webauthn/x v0.1.6 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/go-tpm v0.9.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
@ -211,9 +206,8 @@ require (
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@ -223,15 +217,16 @@ require (
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/libdns/libdns v0.2.2 // indirect
github.com/libdns/libdns v0.2.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/markbates/going v1.0.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mholt/acmez/v2 v2.0.1 // indirect
github.com/miekg/dns v1.1.59 // indirect
github.com/mholt/acmez v1.2.0 // indirect
github.com/miekg/dns v1.1.58 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
@ -252,16 +247,15 @@ require (
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rhysd/actionlint v1.6.27 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rhysd/actionlint v1.6.26 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
@ -276,22 +270,24 @@ require (
github.com/unknwon/com v1.0.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.etcd.io/bbolt v1.3.9 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.mongodb.org/mongo-driver v1.13.1 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
@ -302,7 +298,9 @@ replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0
replace github.com/nektos/act => gitea.com/gitea/act v0.261.1
replace github.com/nektos/act => gitea.com/gitea/act v0.259.1
replace github.com/gorilla/feeds => github.com/yardenshoham/feeds v0.0.0-20240110072658-f3d0c21c0bd5
exclude github.com/gofrs/uuid v3.2.0+incompatible

586
go.sum

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,6 @@ import (
func TestMain(m *testing.M) {
unittest.MainTest(m, &unittest.TestOptions{
FixtureFiles: []string{
"action_runner.yml",
"action_runner_token.yml",
},
})

View file

@ -98,10 +98,13 @@ func (run *ActionRun) LoadAttributes(ctx context.Context) error {
return nil
}
if err := run.LoadRepo(ctx); err != nil {
return err
if run.Repo == nil {
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID)
if err != nil {
return err
}
run.Repo = repo
}
if err := run.Repo.LoadAttributes(ctx); err != nil {
return err
}
@ -117,19 +120,6 @@ func (run *ActionRun) LoadAttributes(ctx context.Context) error {
return nil
}
func (run *ActionRun) LoadRepo(ctx context.Context) error {
if run == nil || run.Repo != nil {
return nil
}
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID)
if err != nil {
return err
}
run.Repo = repo
return nil
}
func (run *ActionRun) Duration() time.Duration {
return calculateDuration(run.Started, run.Stopped, run.Status) + run.PreviousDuration
}

View file

@ -16,9 +16,14 @@ import (
type ActionJobList []*ActionRunJob
func (jobs ActionJobList) GetRunIDs() []int64 {
return container.FilterSlice(jobs, func(j *ActionRunJob) (int64, bool) {
return j.RunID, j.RunID != 0
})
ids := make(container.Set[int64], len(jobs))
for _, j := range jobs {
if j.RunID == 0 {
continue
}
ids.Add(j.RunID)
}
return ids.Values()
}
func (jobs ActionJobList) LoadRuns(ctx context.Context, withRepo bool) error {

View file

@ -19,15 +19,19 @@ type RunList []*ActionRun
// GetUserIDs returns a slice of user's id
func (runs RunList) GetUserIDs() []int64 {
return container.FilterSlice(runs, func(run *ActionRun) (int64, bool) {
return run.TriggerUserID, true
})
ids := make(container.Set[int64], len(runs))
for _, run := range runs {
ids.Add(run.TriggerUserID)
}
return ids.Values()
}
func (runs RunList) GetRepoIDs() []int64 {
return container.FilterSlice(runs, func(run *ActionRun) (int64, bool) {
return run.RepoID, true
})
ids := make(container.Set[int64], len(runs))
for _, run := range runs {
ids.Add(run.RepoID)
}
return ids.Values()
}
func (runs RunList) LoadTriggerUser(ctx context.Context) error {

View file

@ -5,7 +5,6 @@ package actions
import (
"context"
"encoding/binary"
"fmt"
"strings"
"time"
@ -254,26 +253,11 @@ func UpdateRunner(ctx context.Context, r *ActionRunner, cols ...string) error {
// DeleteRunner deletes a runner by given ID.
func DeleteRunner(ctx context.Context, id int64) error {
runner, err := GetRunnerByID(ctx, id)
if err != nil {
if _, err := GetRunnerByID(ctx, id); err != nil {
return err
}
// Replace the UUID, which was either based on the secret's first 16 bytes or an UUIDv4,
// with a sequence of 8 0xff bytes followed by the little-endian version of the record's
// identifier. This will prevent the deleted record's identifier from colliding with any
// new record.
b := make([]byte, 8)
binary.LittleEndian.PutUint64(b, uint64(id))
runner.UUID = fmt.Sprintf("ffffffff-ffff-ffff-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x",
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7])
err = UpdateRunner(ctx, runner, "UUID")
if err != nil {
return err
}
_, err = db.DeleteByID[ActionRunner](ctx, id)
_, err := db.DeleteByID[ActionRunner](ctx, id)
return err
}
@ -286,7 +270,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
// Only affect action runners were a owner ID is set, as actions runners
// could also be created on a repository.
return db.GetEngine(ctx).Table("action_runner").
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
Where("`action_runner`.owner_id != ?", 0).
And(builder.IsNull{"`user`.id"}).
Count(new(ActionRunner))
@ -295,7 +279,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
subQuery := builder.Select("`action_runner`.id").
From("`action_runner`").
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
Where(builder.Neq{"`action_runner`.owner_id": 0}).
And(builder.IsNull{"`user`.id"})
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
@ -305,25 +289,3 @@ func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
}
return res.RowsAffected()
}
func CountRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
return db.GetEngine(ctx).Table("action_runner").
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
Where("`action_runner`.repo_id != ?", 0).
And(builder.IsNull{"`repository`.id"}).
Count(new(ActionRunner))
}
func FixRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
subQuery := builder.Select("`action_runner`.id").
From("`action_runner`").
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
Where(builder.Neq{"`action_runner`.repo_id": 0}).
And(builder.IsNull{"`repository`.id"})
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
res, err := db.GetEngine(ctx).Exec(b)
if err != nil {
return 0, err
}
return res.RowsAffected()
}

View file

@ -16,9 +16,14 @@ type RunnerList []*ActionRunner
// GetUserIDs returns a slice of user's id
func (runners RunnerList) GetUserIDs() []int64 {
return container.FilterSlice(runners, func(runner *ActionRunner) (int64, bool) {
return runner.OwnerID, runner.OwnerID != 0
})
ids := make(container.Set[int64], len(runners))
for _, runner := range runners {
if runner.OwnerID == 0 {
continue
}
ids.Add(runner.OwnerID)
}
return ids.Values()
}
func (runners RunnerList) LoadOwners(ctx context.Context) error {
@ -36,9 +41,16 @@ func (runners RunnerList) LoadOwners(ctx context.Context) error {
}
func (runners RunnerList) getRepoIDs() []int64 {
return container.FilterSlice(runners, func(runner *ActionRunner) (int64, bool) {
return runner.RepoID, runner.RepoID > 0
})
repoIDs := make(container.Set[int64], len(runners))
for _, runner := range runners {
if runner.RepoID == 0 {
continue
}
if _, ok := repoIDs[runner.RepoID]; !ok {
repoIDs[runner.RepoID] = struct{}{}
}
}
return repoIDs.Values()
}
func (runners RunnerList) LoadRepos(ctx context.Context) error {

View file

@ -1,59 +0,0 @@
// SPDX-License-Identifier: MIT
package actions
import (
"encoding/binary"
"fmt"
"testing"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
"github.com/stretchr/testify/assert"
)
func TestDeleteRunner(t *testing.T) {
const recordID = 12345678
assert.NoError(t, unittest.PrepareTestDatabase())
before := unittest.AssertExistsAndLoadBean(t, &ActionRunner{ID: recordID})
err := DeleteRunner(db.DefaultContext, recordID)
assert.NoError(t, err)
var after ActionRunner
found, err := db.GetEngine(db.DefaultContext).ID(recordID).Unscoped().Get(&after)
assert.NoError(t, err)
assert.True(t, found)
// Most fields (namely Name, Version, OwnerID, RepoID, Description, Base, RepoRange,
// TokenHash, TokenSalt, LastOnline, LastActive, AgentLabels and Created) are unaffected
assert.Equal(t, before.Name, after.Name)
assert.Equal(t, before.Version, after.Version)
assert.Equal(t, before.OwnerID, after.OwnerID)
assert.Equal(t, before.RepoID, after.RepoID)
assert.Equal(t, before.Description, after.Description)
assert.Equal(t, before.Base, after.Base)
assert.Equal(t, before.RepoRange, after.RepoRange)
assert.Equal(t, before.TokenHash, after.TokenHash)
assert.Equal(t, before.TokenSalt, after.TokenSalt)
assert.Equal(t, before.LastOnline, after.LastOnline)
assert.Equal(t, before.LastActive, after.LastActive)
assert.Equal(t, before.AgentLabels, after.AgentLabels)
assert.Equal(t, before.Created, after.Created)
// Deleted contains a value
assert.NotNil(t, after.Deleted)
// UUID was modified
assert.NotEqual(t, before.UUID, after.UUID)
// UUID starts with ffffffff-ffff-ffff-
assert.Equal(t, "ffffffff-ffff-ffff-", after.UUID[:19])
// UUID ends with LE binary representation of record ID
idAsBinary := make([]byte, 8)
binary.LittleEndian.PutUint64(idAsBinary, uint64(recordID))
idAsHexadecimal := fmt.Sprintf("%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x", idAsBinary[0],
idAsBinary[1], idAsBinary[2], idAsBinary[3], idAsBinary[4], idAsBinary[5],
idAsBinary[6], idAsBinary[7])
assert.Equal(t, idAsHexadecimal, after.UUID[19:])
}

View file

@ -18,15 +18,19 @@ type ScheduleList []*ActionSchedule
// GetUserIDs returns a slice of user's id
func (schedules ScheduleList) GetUserIDs() []int64 {
return container.FilterSlice(schedules, func(schedule *ActionSchedule) (int64, bool) {
return schedule.TriggerUserID, true
})
ids := make(container.Set[int64], len(schedules))
for _, schedule := range schedules {
ids.Add(schedule.TriggerUserID)
}
return ids.Values()
}
func (schedules ScheduleList) GetRepoIDs() []int64 {
return container.FilterSlice(schedules, func(schedule *ActionSchedule) (int64, bool) {
return schedule.RepoID, true
})
ids := make(container.Set[int64], len(schedules))
for _, schedule := range schedules {
ids.Add(schedule.RepoID)
}
return ids.Values()
}
func (schedules ScheduleList) LoadTriggerUser(ctx context.Context) error {

View file

@ -16,9 +16,11 @@ import (
type SpecList []*ActionScheduleSpec
func (specs SpecList) GetScheduleIDs() []int64 {
return container.FilterSlice(specs, func(spec *ActionScheduleSpec) (int64, bool) {
return spec.ScheduleID, true
})
ids := make(container.Set[int64], len(specs))
for _, spec := range specs {
ids.Add(spec.ScheduleID)
}
return ids.Values()
}
func (specs SpecList) LoadSchedules(ctx context.Context) error {
@ -44,9 +46,11 @@ func (specs SpecList) LoadSchedules(ctx context.Context) error {
}
func (specs SpecList) GetRepoIDs() []int64 {
return container.FilterSlice(specs, func(spec *ActionScheduleSpec) (int64, bool) {
return spec.RepoID, true
})
ids := make(container.Set[int64], len(specs))
for _, spec := range specs {
ids.Add(spec.RepoID)
}
return ids.Values()
}
func (specs SpecList) LoadRepos(ctx context.Context) error {

View file

@ -16,9 +16,14 @@ import (
type TaskList []*ActionTask
func (tasks TaskList) GetJobIDs() []int64 {
return container.FilterSlice(tasks, func(t *ActionTask) (int64, bool) {
return t.JobID, t.JobID != 0
})
ids := make(container.Set[int64], len(tasks))
for _, t := range tasks {
if t.JobID == 0 {
continue
}
ids.Add(t.JobID)
}
return ids.Values()
}
func (tasks TaskList) LoadJobs(ctx context.Context) error {
@ -54,6 +59,7 @@ type FindTaskOptions struct {
UpdatedBefore timeutil.TimeStamp
StartedBefore timeutil.TimeStamp
RunnerID int64
IDOrderDesc bool
}
func (opts FindTaskOptions) ToConds() builder.Cond {
@ -83,5 +89,8 @@ func (opts FindTaskOptions) ToConds() builder.Cond {
}
func (opts FindTaskOptions) ToOrders() string {
return "`id` DESC"
if opts.IDOrderDesc {
return "`id` DESC"
}
return ""
}

View file

@ -13,7 +13,7 @@ import (
// ActionTasksVersion
// If both ownerID and repoID is zero, its scope is global.
// If ownerID is not zero and repoID is zero, its scope is org (there is no user-level runner currently).
// If ownerID is not zero and repoID is zero, its scope is org (there is no user-level runner currrently).
// If ownerID is zero and repoID is not zero, its scope is repo.
type ActionTasksVersion struct {
ID int64 `xorm:"pk autoincr"`

View file

@ -6,11 +6,13 @@ package actions
import (
"context"
"errors"
"fmt"
"strings"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
"xorm.io/builder"
)
@ -53,24 +55,24 @@ type FindVariablesOpts struct {
db.ListOptions
OwnerID int64
RepoID int64
Name string
}
func (opts FindVariablesOpts) ToConds() builder.Cond {
cond := builder.NewCond()
// Since we now support instance-level variables,
// there is no need to check for null values for `owner_id` and `repo_id`
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
if opts.Name != "" {
cond = cond.And(builder.Eq{"name": strings.ToUpper(opts.Name)})
}
return cond
}
func FindVariables(ctx context.Context, opts FindVariablesOpts) ([]*ActionVariable, error) {
return db.Find[ActionVariable](ctx, opts)
func GetVariableByID(ctx context.Context, variableID int64) (*ActionVariable, error) {
var variable ActionVariable
has, err := db.GetEngine(ctx).Where("id=?", variableID).Get(&variable)
if err != nil {
return nil, err
} else if !has {
return nil, fmt.Errorf("variable with id %d: %w", variableID, util.ErrNotExist)
}
return &variable, nil
}
func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error) {
@ -82,21 +84,9 @@ func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error)
return count != 0, err
}
func DeleteVariable(ctx context.Context, id int64) error {
if _, err := db.DeleteByID[ActionVariable](ctx, id); err != nil {
return err
}
return nil
}
func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, error) {
variables := map[string]string{}
if err := run.LoadRepo(ctx); err != nil {
log.Error("LoadRepo: %v", err)
return nil, err
}
// Global
globalVariables, err := db.Find[ActionVariable](ctx, FindVariablesOpts{})
if err != nil {

View file

@ -22,9 +22,11 @@ import (
type ActionList []*Action
func (actions ActionList) getUserIDs() []int64 {
return container.FilterSlice(actions, func(action *Action) (int64, bool) {
return action.ActUserID, true
})
userIDs := make(container.Set[int64], len(actions))
for _, action := range actions {
userIDs.Add(action.ActUserID)
}
return userIDs.Values()
}
func (actions ActionList) LoadActUsers(ctx context.Context) (map[int64]*user_model.User, error) {
@ -48,9 +50,11 @@ func (actions ActionList) LoadActUsers(ctx context.Context) (map[int64]*user_mod
}
func (actions ActionList) getRepoIDs() []int64 {
return container.FilterSlice(actions, func(action *Action) (int64, bool) {
return action.RepoID, true
})
repoIDs := make(container.Set[int64], len(actions))
for _, action := range actions {
repoIDs.Add(action.RepoID)
}
return repoIDs.Values()
}
func (actions ActionList) LoadRepositories(ctx context.Context) error {
@ -76,19 +80,18 @@ func (actions ActionList) loadRepoOwner(ctx context.Context, userMap map[int64]*
userMap = make(map[int64]*user_model.User)
}
missingUserIDs := container.FilterSlice(actions, func(action *Action) (int64, bool) {
userSet := make(container.Set[int64], len(actions))
for _, action := range actions {
if action.Repo == nil {
return 0, false
continue
}
if _, ok := userMap[action.Repo.OwnerID]; !ok {
userSet.Add(action.Repo.OwnerID)
}
_, alreadyLoaded := userMap[action.Repo.OwnerID]
return action.Repo.OwnerID, !alreadyLoaded
})
if len(missingUserIDs) == 0 {
return nil
}
if err := db.GetEngine(ctx).
In("id", missingUserIDs).
In("id", userSet.Values()).
Find(&userMap); err != nil {
return fmt.Errorf("find user: %w", err)
}
@ -132,9 +135,6 @@ func (actions ActionList) LoadComments(ctx context.Context) error {
commentIDs = append(commentIDs, action.CommentID)
}
}
if len(commentIDs) == 0 {
return nil
}
commentsMap := make(map[int64]*issues_model.Comment, len(commentIDs))
if err := db.GetEngine(ctx).In("id", commentIDs).Find(&commentsMap); err != nil {

View file

@ -196,11 +196,15 @@ func (nl NotificationList) LoadAttributes(ctx context.Context) error {
return nil
}
// getPendingRepoIDs returns all the repositoty ids which haven't been loaded
func (nl NotificationList) getPendingRepoIDs() []int64 {
return container.FilterSlice(nl, func(n *Notification) (int64, bool) {
return n.RepoID, n.Repository == nil
})
ids := make(container.Set[int64], len(nl))
for _, notification := range nl {
if notification.Repository != nil {
continue
}
ids.Add(notification.RepoID)
}
return ids.Values()
}
// LoadRepos loads repositories from database

View file

@ -30,7 +30,7 @@ type Statistic struct {
Mirror, Release, AuthSource, Webhook,
Milestone, Label, HookTask,
Team, UpdateTask, Project,
ProjectColumn, Attachment,
ProjectBoard, Attachment,
Branches, Tags, CommitStatus int64
IssueByLabel []IssueByLabelCount
IssueByRepository []IssueByRepositoryCount
@ -115,6 +115,6 @@ func GetStatistic(ctx context.Context) (stats Statistic) {
stats.Counter.Team, _ = e.Count(new(organization.Team))
stats.Counter.Attachment, _ = e.Count(new(repo_model.Attachment))
stats.Counter.Project, _ = e.Count(new(project_model.Project))
stats.Counter.ProjectColumn, _ = e.Count(new(project_model.Column))
stats.Counter.ProjectBoard, _ = e.Count(new(project_model.Board))
return stats
}

View file

@ -39,8 +39,12 @@ func getUserHeatmapData(ctx context.Context, user *user_model.User, team *organi
// Group by 15 minute intervals which will allow the client to accurately shift the timestamp to their timezone.
// The interval is based on the fact that there are timezones such as UTC +5:30 and UTC +12:45.
groupBy := "created_unix / 900 * 900"
if setting.Database.Type.IsMySQL() {
groupByName := "timestamp" // We need this extra case because mssql doesn't allow grouping by alias
switch {
case setting.Database.Type.IsMySQL():
groupBy = "created_unix DIV 900 * 900"
case setting.Database.Type.IsMSSQL():
groupByName = groupBy
}
cond, err := activityQueryCondition(ctx, GetFeedsOptions{
@ -63,7 +67,7 @@ func getUserHeatmapData(ctx context.Context, user *user_model.User, team *organi
Table("action").
Where(cond).
And("created_unix > ?", timeutil.TimeStampNow()-31536000).
GroupBy("timestamp").
GroupBy(groupByName).
OrderBy("timestamp").
Find(&hdata)
}

View file

@ -94,6 +94,7 @@ func ParseObjectWithSignature(ctx context.Context, c *GitObject) *ObjectVerifica
Reason: "gpg.error.no_committer_account",
}
}
}
}

View file

@ -8,7 +8,6 @@ import (
"crypto/sha256"
"encoding/base32"
"encoding/base64"
"errors"
"fmt"
"net"
"net/url"
@ -145,11 +144,6 @@ func (app *OAuth2Application) TableName() string {
// ContainsRedirectURI checks if redirectURI is allowed for app
func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool {
// OAuth2 requires the redirect URI to be an exact match, no dynamic parts are allowed.
// https://stackoverflow.com/questions/55524480/should-dynamic-query-parameters-be-present-in-the-redirection-uri-for-an-oauth2
// https://www.rfc-editor.org/rfc/rfc6819#section-5.2.3.3
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
// https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-12#section-3.1
contains := func(s string) bool {
s = strings.TrimSuffix(strings.ToLower(s), "/")
for _, u := range app.RedirectURIs {
@ -302,7 +296,7 @@ func UpdateOAuth2Application(ctx context.Context, opts UpdateOAuth2ApplicationOp
return nil, err
}
if app.UID != opts.UserID {
return nil, errors.New("UID mismatch")
return nil, fmt.Errorf("UID mismatch")
}
builtinApps := BuiltinApplications()
if _, builtin := builtinApps[app.ClientID]; builtin {

View file

@ -60,7 +60,7 @@ func TestOAuth2Application_ContainsRedirectURI_WithPort(t *testing.T) {
// not loopback
assert.False(t, app.ContainsRedirectURI("http://192.168.0.1:9954/"))
assert.False(t, app.ContainsRedirectURI("http://intranet:3456/"))
// unparsable
// unparseable
assert.False(t, app.ContainsRedirectURI(":"))
}

View file

@ -85,7 +85,7 @@ func TestAuthSession(t *testing.T) {
err = auth.DestroySession(db.DefaultContext, key)
assert.NoError(t, err)
// Ensure it doesn't exists.
// Ensure it doens't exists.
ok, err = auth.ExistSession(db.DefaultContext, key)
assert.NoError(t, err)
assert.False(t, ok)

View file

@ -33,7 +33,6 @@ const (
DLDAP // 5
OAuth2 // 6
SSPI // 7
Remote // 8
)
// String returns the string name of the LoginType
@ -54,7 +53,6 @@ var Names = map[Type]string{
PAM: "PAM",
OAuth2: "OAuth2",
SSPI: "SPNEGO with SSPI",
Remote: "Remote",
}
// Config represents login config as far as the db is concerned
@ -183,10 +181,6 @@ func (source *Source) IsSSPI() bool {
return source.Type == SSPI
}
func (source *Source) IsRemote() bool {
return source.Type == Remote
}
// HasTLS returns true of this source supports TLS.
func (source *Source) HasTLS() bool {
hasTLSer, ok := source.Cfg.(HasTLSer)

View file

@ -41,6 +41,20 @@ func findAvailableCollationsMySQL(x *xorm.Engine) (ret container.Set[string], er
return ret, nil
}
func findAvailableCollationsMSSQL(x *xorm.Engine) (ret container.Set[string], err error) {
var res []struct {
Name string
}
if err = x.SQL("SELECT * FROM sys.fn_helpcollations() WHERE name LIKE '%[_]CS[_]AS%'").Find(&res); err != nil {
return nil, err
}
ret = make(container.Set[string], len(res))
for _, r := range res {
ret.Add(r.Name)
}
return ret, nil
}
func CheckCollations(x *xorm.Engine) (*CheckCollationsResult, error) {
dbTables, err := x.DBMetas()
if err != nil {
@ -70,6 +84,18 @@ func CheckCollations(x *xorm.Engine) (*CheckCollationsResult, error) {
// At the moment, it's safe to ignore the database difference, just trim the prefix and compare. It could be fixed easily if there is any problem in the future.
return a == b || strings.TrimPrefix(a, "utf8mb4_") == strings.TrimPrefix(b, "utf8mb4_")
}
} else if x.Dialect().URI().DBType == schemas.MSSQL {
if _, err = x.SQL("SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')").Get(&res.DatabaseCollation); err != nil {
return nil, err
}
res.IsCollationCaseSensitive = func(s string) bool {
return strings.HasSuffix(s, "_CS_AS")
}
candidateCollations = []string{"Latin1_General_CS_AS"}
res.AvailableCollation, err = findAvailableCollationsMSSQL(x)
if err != nil {
return nil, err
}
} else {
return nil, nil
}
@ -120,6 +146,10 @@ func alterDatabaseCollation(x *xorm.Engine, collation string) error {
if x.Dialect().URI().DBType == schemas.MYSQL {
_, err := x.Exec("ALTER DATABASE CHARACTER SET utf8mb4 COLLATE " + collation)
return err
} else if x.Dialect().URI().DBType == schemas.MSSQL {
// TODO: MSSQL has many limitations on changing database collation, it could fail in many cases.
_, err := x.Exec("ALTER DATABASE CURRENT COLLATE " + collation)
return err
}
return errors.New("unsupported database type")
}
@ -135,11 +165,12 @@ func preprocessDatabaseCollation(x *xorm.Engine) {
}
// try to alter database collation to expected if the database is empty, it might fail in some cases (and it isn't necessary to succeed)
// at the moment.
// at the moment, there is no "altering" solution for MSSQL, site admin should manually change the database collation
if !r.CollationEquals(r.DatabaseCollation, r.ExpectedCollation) && r.ExistingTableNumber == 0 {
if err = alterDatabaseCollation(x, r.ExpectedCollation); err != nil {
log.Error("Failed to change database collation to %q: %v", r.ExpectedCollation, err)
} else {
_, _ = x.Exec("SELECT 1") // after "altering", MSSQL's session becomes invalid, so make a simple query to "refresh" the session
if r, err = CheckCollations(x); err != nil {
log.Error("Failed to check database collation again after altering: %v", err) // impossible case
return

View file

@ -47,6 +47,8 @@ func BuilderDialect() string {
return builder.SQLITE
case setting.Database.Type.IsPostgreSQL():
return builder.POSTGRES
case setting.Database.Type.IsMSSQL():
return builder.MSSQL
default:
return ""
}

View file

@ -47,6 +47,33 @@ func ConvertDatabaseTable() error {
return nil
}
// ConvertVarcharToNVarchar converts database and tables from varchar to nvarchar if it's mssql
func ConvertVarcharToNVarchar() error {
if x.Dialect().URI().DBType != schemas.MSSQL {
return nil
}
sess := x.NewSession()
defer sess.Close()
res, err := sess.QuerySliceString(`SELECT 'ALTER TABLE ' + OBJECT_NAME(SC.object_id) + ' MODIFY SC.name NVARCHAR(' + CONVERT(VARCHAR(5),SC.max_length) + ')'
FROM SYS.columns SC
JOIN SYS.types ST
ON SC.system_type_id = ST.system_type_id
AND SC.user_type_id = ST.user_type_id
WHERE ST.name ='varchar'`)
if err != nil {
return err
}
for _, row := range res {
if len(row) == 1 {
if _, err = sess.Exec(row[0]); err != nil {
return err
}
}
}
return err
}
// Cell2Int64 converts a xorm.Cell type to int64,
// and handles possible irregular cases.
func Cell2Int64(val xorm.Cell) int64 {

View file

@ -22,8 +22,9 @@ import (
"xorm.io/xorm/names"
"xorm.io/xorm/schemas"
_ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver
_ "github.com/lib/pq" // Needed for the Postgresql driver
_ "github.com/denisenkom/go-mssqldb" // Needed for the MSSQL driver
_ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver
_ "github.com/lib/pq" // Needed for the Postgresql driver
)
var (
@ -114,8 +115,10 @@ func newXORMEngine() (*xorm.Engine, error) {
if err != nil {
return nil, err
}
if setting.Database.Type.IsMySQL() {
if setting.Database.Type == "mysql" {
engine.Dialect().SetParams(map[string]string{"rowFormat": "DYNAMIC"})
} else if setting.Database.Type == "mssql" {
engine.Dialect().SetParams(map[string]string{"DEFAULT_VARCHAR": "nvarchar"})
}
engine.SetSchema(setting.Database.Schema)
return engine, nil
@ -237,6 +240,7 @@ func NamesToBean(names ...string) ([]any, error) {
// Need to map provided names to beans...
beanMap := make(map[string]any)
for _, bean := range tables {
beanMap[strings.ToLower(reflect.Indirect(reflect.ValueOf(bean)).Type().Name())] = bean
beanMap[strings.ToLower(x.TableName(bean))] = bean
beanMap[strings.ToLower(x.TableName(bean, true))] = bean

View file

@ -89,6 +89,33 @@ func mysqlGetNextResourceIndex(ctx context.Context, tableName string, groupID in
return idx, nil
}
func mssqlGetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) {
if _, err := GetEngine(ctx).Exec(fmt.Sprintf(`
MERGE INTO %s WITH (HOLDLOCK) AS target
USING (SELECT %d AS group_id) AS source
(group_id)
ON target.group_id = source.group_id
WHEN MATCHED
THEN UPDATE
SET max_index = max_index + 1
WHEN NOT MATCHED
THEN INSERT (group_id, max_index)
VALUES (%d, 1);
`, tableName, groupID, groupID)); err != nil {
return 0, err
}
var idx int64
_, err := GetEngine(ctx).SQL(fmt.Sprintf("SELECT max_index FROM %s WHERE group_id = ?", tableName), groupID).Get(&idx)
if err != nil {
return 0, err
}
if idx == 0 {
return 0, errors.New("cannot get the correct index")
}
return idx, nil
}
// GetNextResourceIndex generates a resource index, it must run in the same transaction where the resource is created
func GetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) {
switch {
@ -96,6 +123,8 @@ func GetNextResourceIndex(ctx context.Context, tableName string, groupID int64)
return postgresGetNextResourceIndex(ctx, tableName, groupID)
case setting.Database.Type.IsMySQL():
return mysqlGetNextResourceIndex(ctx, tableName, groupID)
case setting.Database.Type.IsMSSQL():
return mssqlGetNextResourceIndex(ctx, tableName, groupID)
}
e := GetEngine(ctx)

View file

@ -18,6 +18,12 @@ const (
SearchOrderByRecentUpdated SearchOrderBy = "updated_unix DESC"
SearchOrderByOldest SearchOrderBy = "created_unix ASC"
SearchOrderByNewest SearchOrderBy = "created_unix DESC"
SearchOrderBySize SearchOrderBy = "size ASC"
SearchOrderBySizeReverse SearchOrderBy = "size DESC"
SearchOrderByGitSize SearchOrderBy = "git_size ASC"
SearchOrderByGitSizeReverse SearchOrderBy = "git_size DESC"
SearchOrderByLFSSize SearchOrderBy = "lfs_size ASC"
SearchOrderByLFSSizeReverse SearchOrderBy = "lfs_size DESC"
SearchOrderByID SearchOrderBy = "id ASC"
SearchOrderByIDReverse SearchOrderBy = "id DESC"
SearchOrderByStars SearchOrderBy = "num_stars ASC"

View file

@ -215,15 +215,16 @@ func fileTimestampToTime(timestamp int64) time.Time {
return time.UnixMicro(timestamp)
}
func (f *file) loadMetaByPath() error {
func (f *file) loadMetaByPath() (*dbfsMeta, error) {
var fileMeta dbfsMeta
if ok, err := db.GetEngine(f.ctx).Where("full_path = ?", f.fullPath).Get(&fileMeta); err != nil {
return err
return nil, err
} else if ok {
f.metaID = fileMeta.ID
f.blockSize = fileMeta.BlockSize
return &fileMeta, nil
}
return nil
return nil, nil
}
func (f *file) open(flag int) (err error) {
@ -287,7 +288,10 @@ func (f *file) createEmpty() error {
if err != nil {
return err
}
return f.loadMetaByPath()
if _, err = f.loadMetaByPath(); err != nil {
return err
}
return nil
}
func (f *file) truncate() error {
@ -364,5 +368,8 @@ func buildPath(path string) string {
func newDbFile(ctx context.Context, path string) (*file, error) {
path = buildPath(path)
f := &file{ctx: ctx, fullPath: path, blockSize: defaultFileBlockSize}
return f, f.loadMetaByPath()
if _, err := f.loadMetaByPath(); err != nil {
return nil, err
}
return f, nil
}

View file

@ -1,7 +1,7 @@
-
id: 1001
type: 0 # pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 1001
index: 1001
head_repo_id: 1

View file

@ -1,20 +0,0 @@
-
# A global runner
# Secret is 7e577e577e577e57feedfacefeedfacefeedface
id: 12345678
uuid: "37653537-3765-3537-3765-353737653537"
name: "test"
version: ""
owner_id: 0
repo_id: 0
description: ""
base: 0
repo_range: ""
token_hash: "3af8a56b850dba8848044385fedcfa4d9432e17de9f9803e4d279991394ac2945066ceb9a5e7cbe60a087d90d4bad03a8f9b"
token_salt: "832f8529db6151a1c3c605dd7570b58f"
last_online: 0
last_active: 0
agent_labels: '[""]'
created: 1716104432
updated: 1716104432
deleted: ~

View file

@ -83,12 +83,3 @@
issue_id: 2 # in repo_id 1
review_id: 20
created_unix: 946684810
-
id: 10
type: 0
poster_id: 1
issue_id: 1 # in repo_id 1
content: "test markup light/dark-mode-only ![GitHub-Mark-Light](https://user-images.githubusercontent.com/3369400/139447912-e0f43f33-6d9f-45f8-be46-2df5bbc91289.png#gh-dark-mode-only)![GitHub-Mark-Dark](https://user-images.githubusercontent.com/3369400/139448065-39a229ba-4b06-434b-bc67-616e2ed80c8f.png#gh-light-mode-only)"
created_unix: 946684813
updated_unix: 946684813

View file

@ -15,7 +15,7 @@
repo_id: 1
state: "warning"
sha: "1234123412341234123412341234123412341234"
target_url: https://example.com/coverage/
target_url: https://example.com/converage/
description: My awesome Coverage service
context: cov/awesomeness
creator_id: 2
@ -26,7 +26,7 @@
repo_id: 1
state: "success"
sha: "1234123412341234123412341234123412341234"
target_url: https://example.com/coverage/
target_url: https://example.com/converage/
description: My awesome Coverage service
context: cov/awesomeness
creator_id: 2

View file

@ -10,7 +10,7 @@
priority: 0
is_closed: false
is_pull: false
num_comments: 3
num_comments: 2
created_unix: 946684800
updated_unix: 978307200
is_locked: false

View file

@ -1,24 +0,0 @@
-
id: 1
repo_id: 4
name_pattern: /v.+/
allowlist_user_i_ds: []
allowlist_team_i_ds: []
created_unix: 1715596037
updated_unix: 1715596037
-
id: 2
repo_id: 1
name_pattern: v-*
allowlist_user_i_ds: []
allowlist_team_i_ds: []
created_unix: 1715596037
updated_unix: 1715596037
-
id: 3
repo_id: 1
name_pattern: v-1.1
allowlist_user_i_ds: [2]
allowlist_team_i_ds: []
created_unix: 1715596037
updated_unix: 1715596037

View file

@ -1,7 +1,7 @@
-
id: 1
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 2
index: 2
head_repo_id: 1
@ -16,7 +16,7 @@
-
id: 2
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 3
index: 3
head_repo_id: 1
@ -29,7 +29,7 @@
-
id: 3
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 8
index: 1
head_repo_id: 11
@ -42,7 +42,7 @@
-
id: 4
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 9
index: 1
head_repo_id: 48
@ -55,7 +55,7 @@
-
id: 5 # this PR is outdated (one commit behind branch1 )
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 11
index: 5
head_repo_id: 1
@ -68,7 +68,7 @@
-
id: 6
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 12
index: 2
head_repo_id: 3
@ -81,7 +81,7 @@
-
id: 7
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 19
index: 1
head_repo_id: 58
@ -94,7 +94,7 @@
-
id: 8
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 20
index: 1
head_repo_id: 23
@ -103,7 +103,7 @@
-
id: 9
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 21
index: 1
head_repo_id: 60
@ -112,7 +112,7 @@
-
id: 10
type: 0 # gitea pull request
status: 2 # mergeable
status: 2 # mergable
issue_id: 22
index: 1
head_repo_id: 61

View file

@ -1,52 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
"fmt"
"strings"
"time"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/validation"
)
// FederationHost data type
// swagger:model
type FederationHost struct {
ID int64 `xorm:"pk autoincr"`
HostFqdn string `xorm:"host_fqdn UNIQUE INDEX VARCHAR(255) NOT NULL"`
NodeInfo NodeInfo `xorm:"extends NOT NULL"`
LatestActivity time.Time `xorm:"NOT NULL"`
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
// Factory function for FederationHost. Created struct is asserted to be valid.
func NewFederationHost(nodeInfo NodeInfo, hostFqdn string) (FederationHost, error) {
result := FederationHost{
HostFqdn: strings.ToLower(hostFqdn),
NodeInfo: nodeInfo,
}
if valid, err := validation.IsValid(result); !valid {
return FederationHost{}, err
}
return result, nil
}
// Validate collects error strings in a slice and returns this
func (host FederationHost) Validate() []string {
var result []string
result = append(result, validation.ValidateNotEmpty(host.HostFqdn, "HostFqdn")...)
result = append(result, validation.ValidateMaxLen(host.HostFqdn, 255, "HostFqdn")...)
result = append(result, host.NodeInfo.Validate()...)
if host.HostFqdn != strings.ToLower(host.HostFqdn) {
result = append(result, fmt.Sprintf("HostFqdn has to be lower case but was: %v", host.HostFqdn))
}
if !host.LatestActivity.IsZero() && host.LatestActivity.After(time.Now().Add(10*time.Minute)) {
result = append(result, fmt.Sprintf("Latest Activity cannot be in the far future: %v", host.LatestActivity))
}
return result
}

View file

@ -1,61 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
"context"
"fmt"
"strings"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/validation"
)
func init() {
db.RegisterModel(new(FederationHost))
}
func GetFederationHost(ctx context.Context, ID int64) (*FederationHost, error) {
host := new(FederationHost)
has, err := db.GetEngine(ctx).Where("id=?", ID).Get(host)
if err != nil {
return nil, err
} else if !has {
return nil, fmt.Errorf("FederationInfo record %v does not exist", ID)
}
if res, err := validation.IsValid(host); !res {
return nil, err
}
return host, nil
}
func FindFederationHostByFqdn(ctx context.Context, fqdn string) (*FederationHost, error) {
host := new(FederationHost)
has, err := db.GetEngine(ctx).Where("host_fqdn=?", strings.ToLower(fqdn)).Get(host)
if err != nil {
return nil, err
} else if !has {
return nil, nil
}
if res, err := validation.IsValid(host); !res {
return nil, err
}
return host, nil
}
func CreateFederationHost(ctx context.Context, host *FederationHost) error {
if res, err := validation.IsValid(host); !res {
return err
}
_, err := db.GetEngine(ctx).Insert(host)
return err
}
func UpdateFederationHost(ctx context.Context, host *FederationHost) error {
if res, err := validation.IsValid(host); !res {
return err
}
_, err := db.GetEngine(ctx).ID(host.ID).Update(host)
return err
}

View file

@ -1,78 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
"strings"
"testing"
"time"
"code.gitea.io/gitea/modules/validation"
)
func Test_FederationHostValidation(t *testing.T) {
sut := FederationHost{
HostFqdn: "host.do.main",
NodeInfo: NodeInfo{
SoftwareName: "forgejo",
},
LatestActivity: time.Now(),
}
if res, err := validation.IsValid(sut); !res {
t.Errorf("sut should be valid but was %q", err)
}
sut = FederationHost{
HostFqdn: "",
NodeInfo: NodeInfo{
SoftwareName: "forgejo",
},
LatestActivity: time.Now(),
}
if res, _ := validation.IsValid(sut); res {
t.Errorf("sut should be invalid: HostFqdn empty")
}
sut = FederationHost{
HostFqdn: strings.Repeat("fill", 64),
NodeInfo: NodeInfo{
SoftwareName: "forgejo",
},
LatestActivity: time.Now(),
}
if res, _ := validation.IsValid(sut); res {
t.Errorf("sut should be invalid: HostFqdn too long (len=256)")
}
sut = FederationHost{
HostFqdn: "host.do.main",
NodeInfo: NodeInfo{},
LatestActivity: time.Now(),
}
if res, _ := validation.IsValid(sut); res {
t.Errorf("sut should be invalid: NodeInfo invalid")
}
sut = FederationHost{
HostFqdn: "host.do.main",
NodeInfo: NodeInfo{
SoftwareName: "forgejo",
},
LatestActivity: time.Now().Add(1 * time.Hour),
}
if res, _ := validation.IsValid(sut); res {
t.Errorf("sut should be invalid: Future timestamp")
}
sut = FederationHost{
HostFqdn: "hOst.do.main",
NodeInfo: NodeInfo{
SoftwareName: "forgejo",
},
LatestActivity: time.Now(),
}
if res, _ := validation.IsValid(sut); res {
t.Errorf("sut should be invalid: HostFqdn lower case")
}
}

View file

@ -1,123 +0,0 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
"net/url"
"code.gitea.io/gitea/modules/validation"
"github.com/valyala/fastjson"
)
// ToDo: Search for full text SourceType and Source, also in .md files
type (
SoftwareNameType string
)
const (
ForgejoSourceType SoftwareNameType = "forgejo"
GiteaSourceType SoftwareNameType = "gitea"
)
var KnownSourceTypes = []any{
ForgejoSourceType, GiteaSourceType,
}
// ------------------------------------------------ NodeInfoWellKnown ------------------------------------------------
// NodeInfo data type
// swagger:model
type NodeInfoWellKnown struct {
Href string
}
// Factory function for NodeInfoWellKnown. Created struct is asserted to be valid.
func NewNodeInfoWellKnown(body []byte) (NodeInfoWellKnown, error) {
result, err := NodeInfoWellKnownUnmarshalJSON(body)
if err != nil {
return NodeInfoWellKnown{}, err
}
if valid, err := validation.IsValid(result); !valid {
return NodeInfoWellKnown{}, err
}
return result, nil
}
func NodeInfoWellKnownUnmarshalJSON(data []byte) (NodeInfoWellKnown, error) {
p := fastjson.Parser{}
val, err := p.ParseBytes(data)
if err != nil {
return NodeInfoWellKnown{}, err
}
href := string(val.GetStringBytes("links", "0", "href"))
return NodeInfoWellKnown{Href: href}, nil
}
// Validate collects error strings in a slice and returns this
func (node NodeInfoWellKnown) Validate() []string {
var result []string
result = append(result, validation.ValidateNotEmpty(node.Href, "Href")...)
parsedURL, err := url.Parse(node.Href)
if err != nil {
result = append(result, err.Error())
return result
}
if parsedURL.Host == "" {
result = append(result, "Href has to be absolute")
}
result = append(result, validation.ValidateOneOf(parsedURL.Scheme, []any{"http", "https"}, "parsedURL.Scheme")...)
if parsedURL.RawQuery != "" {
result = append(result, "Href may not contain query")
}
return result
}
// ------------------------------------------------ NodeInfo ------------------------------------------------
// NodeInfo data type
// swagger:model
type NodeInfo struct {
SoftwareName SoftwareNameType
}
func NodeInfoUnmarshalJSON(data []byte) (NodeInfo, error) {
p := fastjson.Parser{}
val, err := p.ParseBytes(data)
if err != nil {
return NodeInfo{}, err
}
source := string(val.GetStringBytes("software", "name"))
result := NodeInfo{}
result.SoftwareName = SoftwareNameType(source)
return result, nil
}
func NewNodeInfo(body []byte) (NodeInfo, error) {
result, err := NodeInfoUnmarshalJSON(body)
if err != nil {
return NodeInfo{}, err
}
if valid, err := validation.IsValid(result); !valid {
return NodeInfo{}, err
}
return result, nil
}
// Validate collects error strings in a slice and returns this
func (node NodeInfo) Validate() []string {
var result []string
result = append(result, validation.ValidateNotEmpty(string(node.SoftwareName), "node.SoftwareName")...)
result = append(result, validation.ValidateOneOf(node.SoftwareName, KnownSourceTypes, "node.SoftwareName")...)
return result
}

View file

@ -1,92 +0,0 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
"fmt"
"reflect"
"strings"
"testing"
"code.gitea.io/gitea/modules/validation"
)
func Test_NodeInfoWellKnownUnmarshalJSON(t *testing.T) {
type testPair struct {
item []byte
want NodeInfoWellKnown
wantErr error
}
tests := map[string]testPair{
"with href": {
item: []byte(`{"links":[{"href":"https://federated-repo.prod.meissa.de/api/v1/nodeinfo","rel":"http://nodeinfo.diaspora.software/ns/schema/2.1"}]}`),
want: NodeInfoWellKnown{
Href: "https://federated-repo.prod.meissa.de/api/v1/nodeinfo",
},
},
"empty": {
item: []byte(``),
wantErr: fmt.Errorf("cannot parse JSON: cannot parse empty string; unparsed tail: \"\""),
},
}
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
got, err := NodeInfoWellKnownUnmarshalJSON(tt.item)
if (err != nil || tt.wantErr != nil) && tt.wantErr.Error() != err.Error() {
t.Errorf("UnmarshalJSON() error = \"%v\", wantErr \"%v\"", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("UnmarshalJSON() got = %q, want %q", got, tt.want)
}
})
}
}
func Test_NodeInfoWellKnownValidate(t *testing.T) {
sut := NodeInfoWellKnown{Href: "https://federated-repo.prod.meissa.de/api/v1/nodeinfo"}
if b, err := validation.IsValid(sut); !b {
t.Errorf("sut should be valid, %v, %v", sut, err)
}
sut = NodeInfoWellKnown{Href: "./federated-repo.prod.meissa.de/api/v1/nodeinfo"}
_, err := validation.IsValid(sut)
if !validation.IsErrNotValid(err) && strings.Contains(err.Error(), "Href has to be absolute\nValue is not contained in allowed values [http https]") {
t.Errorf("validation error expected but was: %v\n", err)
}
sut = NodeInfoWellKnown{Href: "https://federated-repo.prod.meissa.de/api/v1/nodeinfo?alert=1"}
_, err = validation.IsValid(sut)
if !validation.IsErrNotValid(err) && strings.Contains(err.Error(), "Href has to be absolute\nValue is not contained in allowed values [http https]") {
t.Errorf("sut should be valid, %v, %v", sut, err)
}
}
func Test_NewNodeInfoWellKnown(t *testing.T) {
sut, _ := NewNodeInfoWellKnown([]byte(`{"links":[{"href":"https://federated-repo.prod.meissa.de/api/v1/nodeinfo","rel":"http://nodeinfo.diaspora.software/ns/schema/2.1"}]}`))
expected := NodeInfoWellKnown{Href: "https://federated-repo.prod.meissa.de/api/v1/nodeinfo"}
if sut != expected {
t.Errorf("expected was: %v but was: %v", expected, sut)
}
_, err := NewNodeInfoWellKnown([]byte(`invalid`))
if err == nil {
t.Errorf("error was expected here")
}
}
func Test_NewNodeInfo(t *testing.T) {
sut, _ := NewNodeInfo([]byte(`{"version":"2.1","software":{"name":"gitea","version":"1.20.0+dev-2539-g5840cc6d3","repository":"https://github.com/go-gitea/gitea.git","homepage":"https://gitea.io/"},"protocols":["activitypub"],"services":{"inbound":[],"outbound":["rss2.0"]},"openRegistrations":true,"usage":{"users":{"total":13,"activeHalfyear":1,"activeMonth":1}},"metadata":{}}`))
expected := NodeInfo{SoftwareName: "gitea"}
if sut != expected {
t.Errorf("expected was: %v but was: %v", expected, sut)
}
_, err := NewNodeInfo([]byte(`invalid`))
if err == nil {
t.Errorf("error was expected here")
}
}

View file

@ -59,21 +59,8 @@ var migrations = []*Migration{
// v9 -> v10
NewMigration("Add pronouns to user", forgejo_v1_22.AddPronounsToUser),
// v11 -> v12
// it is a v7.0 migration backport see https://codeberg.org/forgejo/forgejo/pulls/3165#issuecomment-1755941
NewMigration("Add the `created` column to the `issue` table", forgejo_v1_22.AddCreatedToIssue),
// v12 -> v13
NewMigration("Add repo_archive_download_count table", forgejo_v1_22.AddRepoArchiveDownloadCount),
// v13 -> v14
NewMigration("Add `hide_archive_links` column to `release` table", AddHideArchiveLinksToRelease),
// v14 -> v15
NewMigration("Remove Gitea-specific columns from the repository and badge tables", RemoveGiteaSpecificColumnsFromRepositoryAndBadge),
// v15 -> v16
NewMigration("Create the `federation_host` table", CreateFederationHostTable),
// v16 -> v17
NewMigration("Create the `federated_user` table", CreateFederatedUserTable),
// v17 -> v18
NewMigration("Add `normalized_federated_uri` column to `user` table", AddNormalizedFederatedURIToUser),
// v18 -> v19
NewMigration("Create the `following_repo` table", CreateFollowingRepoTable),
}
// GetCurrentDBVersion returns the current Forgejo database version.

View file

@ -1,15 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import "xorm.io/xorm"
func AddHideArchiveLinksToRelease(x *xorm.Engine) error {
type Release struct {
ID int64 `xorm:"pk autoincr"`
HideArchiveLinks bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync(&Release{})
}

View file

@ -1,43 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import (
"code.gitea.io/gitea/models/migrations/base"
"xorm.io/xorm"
)
func RemoveGiteaSpecificColumnsFromRepositoryAndBadge(x *xorm.Engine) error {
// Make sure the columns exist before dropping them
type Repository struct {
ID int64
DefaultWikiBranch string
}
if err := x.Sync(&Repository{}); err != nil {
return err
}
type Badge struct {
ID int64 `xorm:"pk autoincr"`
Slug string
}
err := x.Sync(new(Badge))
if err != nil {
return err
}
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}
if err := base.DropTableColumns(sess, "repository", "default_wiki_branch"); err != nil {
return err
}
if err := base.DropTableColumns(sess, "badge", "slug"); err != nil {
return err
}
return sess.Commit()
}

View file

@ -1,33 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import (
"time"
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
type (
SoftwareNameType string
)
type NodeInfo struct {
SoftwareName SoftwareNameType
}
type FederationHost struct {
ID int64 `xorm:"pk autoincr"`
HostFqdn string `xorm:"host_fqdn UNIQUE INDEX VARCHAR(255) NOT NULL"`
NodeInfo NodeInfo `xorm:"extends NOT NULL"`
LatestActivity time.Time `xorm:"NOT NULL"`
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
func CreateFederationHostTable(x *xorm.Engine) error {
return x.Sync(new(FederationHost))
}

View file

@ -1,17 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import "xorm.io/xorm"
type FederatedUser struct {
ID int64 `xorm:"pk autoincr"`
UserID int64 `xorm:"NOT NULL"`
ExternalID string `xorm:"UNIQUE(federation_user_mapping) NOT NULL"`
FederationHostID int64 `xorm:"UNIQUE(federation_user_mapping) NOT NULL"`
}
func CreateFederatedUserTable(x *xorm.Engine) error {
return x.Sync(new(FederatedUser))
}

View file

@ -1,14 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import "xorm.io/xorm"
func AddNormalizedFederatedURIToUser(x *xorm.Engine) error {
type User struct {
ID int64 `xorm:"pk autoincr"`
NormalizedFederatedURI string
}
return x.Sync(&User{})
}

View file

@ -1,18 +0,0 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_migrations //nolint:revive
import "xorm.io/xorm"
type FollowingRepo struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"UNIQUE(federation_repo_mapping) NOT NULL"`
ExternalID string `xorm:"UNIQUE(federation_repo_mapping) NOT NULL"`
FederationHostID int64 `xorm:"UNIQUE(federation_repo_mapping) NOT NULL"`
URI string
}
func CreateFollowingRepoTable(x *xorm.Engine) error {
return x.Sync(new(FederatedUser))
}

Some files were not shown because too many files have changed in this diff Show more