Commit graph

21870 commits

Author SHA1 Message Date
Antonin Delpeuch
4973d23ef8 fix: Do not offer duplicating a PR for a recently pushed branch
Fixes #6187.
2024-12-07 09:45:52 +01:00
Earl Warren
e248179333 Merge pull request 'chore(ci): docker-runner-one is not a known label' (#6177) from earl-warren/forgejo:wip-renovate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6177
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-06 11:11:25 +00:00
Earl Warren
87fd4eeaa5 Revert "chore(ci): merge jobs in issue-labels.yml in one workflow" (#6178)
This is a clean revert of the commits that led to grouping all jobs related to issue labeling into one workflow. The assumption that it would be more efficient was incorrect because it assumed the conditions for running each job would be evaluated statically Forgejo side. In reality the conditions are evaluated by the runner and multiplies the number of runs required instead of decreasing them. In turn, this clutters the status line of each pull request with numerous skipped runs. Finally it is more complex to maintain multiple jobs into a single workflow because the conditions for it to run have to be duplicated.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6178
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-12-06 11:05:00 +00:00
Earl Warren
e801d53e61 Merge pull request 'Update module golang.org/x/net to v0.32.0 (forgejo)' (#6175) from renovate/forgejo-golang.org-x-net-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6175
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-12-06 05:47:25 +00:00
Earl Warren
902102ef24 Merge pull request '[Port] Make LFS http_client parallel within a batch' (#6170) from fnetx/lfs-concurrency into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6170
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-06 05:40:37 +00:00
Earl Warren
ffd5a48b1f
chore(ci): docker-runner-one is not a known label
It was temporarily created when trying to have multiple runners on
multiple machines but this did not yield good results.
2024-12-06 05:46:52 +01:00
Gusted
0fad31a5c6 Merge pull request 'Update dependency webpack to v5.97.1 (forgejo)' (#6172) from renovate/forgejo-webpack-5.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6172
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-06 02:04:48 +00:00
Renovate Bot
2300141b84 Update module golang.org/x/net to v0.32.0 2024-12-06 02:03:26 +00:00
Gusted
1f0ffa2a33 Merge pull request 'Update dependency @github/relative-time-element to v4.4.4 (forgejo)' (#6171) from renovate/forgejo-github-relative-time-element-4.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6171
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-06 00:43:09 +00:00
Renovate Bot
cb4df1ee4d Update dependency webpack to v5.97.1 2024-12-06 00:03:23 +00:00
Renovate Bot
0e250469d4 Update dependency @github/relative-time-element to v4.4.4 2024-12-06 00:03:05 +00:00
wxiaoguang
b84a59b3cd Use 8 as default value for git lfs concurrency (#32421) 2024-12-06 00:17:57 +01:00
Royce Remer
f6273e2250 Make LFS http_client parallel within a batch. (#32369)
Signed-off-by: Royce Remer <royceremer@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-06 00:17:57 +01:00
Andreas Shimokawa
3c9b3ddf5c Do not rewrite ssh keys files when deleting a user without one (#6097)
### Problem

Big instances can have huge authorized_keys files when using OpenSSH instead of the internal ssh server. Forgejo always re-generates the contents of that file when a user is deleted, even if he does not even have a public key uploaded. In case of codeberg.org, a 15MB file gets rewritten. If we batch delete 100 Spam users without ssh keys, we rewrite 1.5GB, this takes time and wears the SSD. In addition, there is a high chance of hitting a race contidion bug, when deleting users in parallel.

### Solution / Mitigation

This patch prevents rewriting authorized_keys files, when not necessary. It greatly speeds up deleting malicious users, saves IO bandwidth and SSD wear. It also greatly reduces the chance of hitting a race condition bug. Fixing the race condition is not the scope of this patch though.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6097
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Andreas Shimokawa <shimokawa@fsfe.org>
Co-committed-by: Andreas Shimokawa <shimokawa@fsfe.org>
2024-12-05 21:32:09 +00:00
Mathieu Fenniak
d9252f53a3 Fix bug where Action UI may occasionally not load logs (#6122)
In the combination of events where the user is viewing an action that is completed (and therefore no interval-based loading of logs is occurring), and `loadJob` is called while `loadJob` is already running (commonly from expanding two log sections back-to-back), the second request for loading would be discarded and never occur.

To fix this, the invocation of `loadJob` keeps track of the log cursors it is attempting to load, and an aborted invocation stores its attempted load.  If `loadJob` succeeds in loading and finds that an attempt was aborted while it was busy, it will reload the data.

Steps to reproduce:
- Open an Action UI that is already "Done".
- Click on two steps in rapid succession to expand their logs.
- (Race condition) As long as the second click is registered while the first log chunk is being loaded, its data won't load.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...  (**not applicable**)
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [x] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6122
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2024-12-05 18:08:11 +00:00
Otto
59e0f7fde6 Merge pull request 'feat: improve performance of notifications page for MySQL' (#6146) from gusted/forgejo-notification-perf into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6146
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-05 17:58:36 +00:00
Michael Kriese
d1aae81e44 Merge pull request 'Update dependency @primer/octicons to v19.13.0 (forgejo)' (#6157) from renovate/forgejo-primer-octicons-19.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6157
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-05 16:11:47 +00:00
Gusted
bf59f6b1ee Merge pull request 'Update module golang.org/x/image to v0.23.0 (forgejo)' (#6160) from renovate/forgejo-golang.org-x-image-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6160
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-05 14:57:14 +00:00
Michael Kriese
70892c4813 Merge pull request 'build: only require go minor' (#6151) from viceice/forgejo:build/pin-go-to-minor-only into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6151
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-05 08:36:03 +00:00
Earl Warren
b5c63c9d7e Merge pull request 'chore(i18): cleanup locales' (#6090) from earl-warren/forgejo:wip-locales into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6090
2024-12-05 07:32:05 +00:00
Earl Warren
d0cb9326f5
chore(i18): cleanup locales
git clone https://codeberg.org/0ko/forgejo-snippets
At 4f82f2392532eb093a19ec6a40c8ce0491bcf30e
python3 ../forgejo-snippets/scripts/i18n-migrator/migrator.py -aow .
2024-12-05 07:59:14 +01:00
Codeberg Translate
886a69f665 i18n: update of translations from Codeberg Translate (#6091)
Co-authored-by: Edgarsons <Edgarsons@users.noreply.translate.codeberg.org>
Co-authored-by: faoquad <faoquad@users.noreply.translate.codeberg.org>
Co-authored-by: Benedikt Straub <benedikt-straub@web.de>
Co-authored-by: pgmtx <pgmtx@users.noreply.translate.codeberg.org>
Co-authored-by: mimot <mimot@users.noreply.translate.codeberg.org>
Co-authored-by: xtex <xtexchooser@duck.com>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
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: Gusted <postmaster@gusted.xyz>
Co-authored-by: Juno Takano <jutty@users.noreply.translate.codeberg.org>
Co-authored-by: Lzebulon <Lzebulon@users.noreply.translate.codeberg.org>
Co-authored-by: artnay <artnay@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/6091
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>
2024-12-05 06:54:07 +00:00
Renovate Bot
0c449f7b24 Update module golang.org/x/image to v0.23.0 2024-12-05 04:03:53 +00:00
Gusted
1a262a1233 Merge pull request 'Update module golang.org/x/crypto to v0.30.0 (forgejo)' (#6159) from renovate/forgejo-golang.org-x-crypto-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6159
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-05 02:34:05 +00:00
Renovate Bot
67b25cb9e6 Update module golang.org/x/crypto to v0.30.0 2024-12-05 02:02:57 +00:00
Gusted
66ddd24f7d
chore: add sparkles octicon 2024-12-05 01:22:14 +01:00
Renovate Bot
b56b70c312 Update dependency @primer/octicons to v19.13.0 2024-12-05 00:04:08 +00:00
Otto
ab00d875b8 Merge pull request 'fix: remove softbreak from github legacy callout' (#6152) from gusted/forgejo-callout into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6152
Reviewed-by: Otto <otto@codeberg.org>
2024-12-04 23:11:59 +00:00
Otto
8208c9b23b Merge pull request 'feat: highlight Gradle Kotlin as Kotlin' (#6153) from gusted/forgejo-kotlin-gradle into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6153
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Otto <otto@codeberg.org>
2024-12-04 23:11:22 +00:00
Michael Kriese
6071c7c9d1
ci: include and fix setup-cache-go action 2024-12-04 22:28:17 +01:00
Gusted
216a542bfb
fix: remove softbreak from github legacy callout
- A softbreak was being preserved during the github legacy callout (this
is likely due to a change in Goldmark) while it should not. This caused
an `<br>` to be present between the attention title and attention content.
- Added unit test.
2024-12-04 22:08:38 +01:00
Gusted
9bcf9502ef
feat: highlight Gradle Kotlin as Kotlin
- Grade Kotlin is almost the as Kotlin syntax, so render it as such.
- Resolves #6138
- Unit test added.
2024-12-04 22:06:33 +01:00
Michael Kriese
1167716b7b
build: only require go minor 2024-12-04 21:21:14 +01:00
Renovate Bot
4df855f37c Update module code.forgejo.org/go-chi/session to v1.0.1 (forgejo) (#6150)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6150
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-04 20:19:11 +00:00
Gusted
5a7a87846b Merge pull request 'fix: correct permission loading for limited organisation' (#6144) from gusted/forgejo-org-limited into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6144
Reviewed-by: Otto <otto@codeberg.org>
2024-12-04 17:57:07 +00:00
Renovate Bot
91e4cf3744 Update module code.forgejo.org/go-chi/captcha to v1.0.1 (forgejo) (#6148)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6148
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-04 17:46:56 +00:00
Renovate Bot
6354fd8ae9 Update dependency go to v1.23.4 (forgejo) (#6145)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6145
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-04 14:53:31 +00:00
Gusted
ac6ece75c9
feat: improve performance of notifications page for MySQL
- For the notifications page the unread and pinned notifications are
gathered for doer those that and are ordered by the updated unix.
MariaDB makes a bad decision (sometimes, for most users it does not make
this decision) with this query, it uses the index for the `updated_unix`
column to speed up this query, however this is not the correct index to
be taking, if the doer does not have more than 20 (the
page size) unread and pinned notifications combined MariaDB will
traverse the whole notifications table before it realizes that there are
no more notifications to be gathered. It instead should use the index
for the `user_id` column (this is what MariaDB already does for most
users), so the list that has to be traversed is limited to the doer's
notifications which is significantly less than the whole notifications
table.
- This is a different approach than what Gitea has taken to solve this
problem, which is to add a index to the (status, userid, updated_unix)
tuple (Ref: https://github.com/go-gitea/gitea/pull/32395). Adding more
and more indexes is not a good way if we can use existing indexes to get
a query to a acceptable performance.
- The code cannot use `db.Find` as it's hard to add a index hint option
specifically for this query and not for the other instances that uses
`activities_model.FindNotificationOptions`.
- Only add a index hint for MySQL as I have not been able to test if
SQLite or PostgreSQL are smart enough to use the better index (as you
need a large enough dataset to test this meaningfully).
- Integration test added to ensure the SQL is run by all databases.

---

Performance numbers (from Codeberg's database - MariaDB
10.11.6-MariaDB-0+deb12u1):

Currently:
```sql
SELECT * FROM `notification` WHERE notification.user_id=26734 AND (notification.status=3 OR notification.status=1) ORDER BY notification.updated_unix DESC LIMIT 20;
(5.731 sec)
+------+-------------+--------------+-------+--------------------------------------------------+-------------------------------+---------+-------+---------+------------+----------+------------+-------------+
| id   | select_type | table        | type  | possible_keys                                    | key                           | key_len | ref   | rows    | r_rows     | filtered | r_filtered | Extra       |
+------+-------------+--------------+-------+--------------------------------------------------+-------------------------------+---------+-------+---------+------------+----------+------------+-------------+
|    1 | SIMPLE      | notification | index | IDX_notification_status,IDX_notification_user_id | IDX_notification_updated_unix | 8       | const | 1376836 | 1474066.00 |    50.03 |       0.00 | Using where |
+------+-------------+--------------+-------+--------------------------------------------------+-------------------------------+---------+-------+---------+------------+----------+------------+-------------+
```

Using the better index:
```sql
SELECT * FROM `notification` USE INDEX (IDX_notification_user_id) WHERE notification.user_id=26734 AND (notification.status=3 OR notification.status=1) ORDER BY notification.updated_unix DESC LIMIT 20;
(0.834 sec)

+------+-------------+--------------+--------+----------------------------------------------------------+--------------------------+---------+----------------------------------+-------+----------+----------+------------+----------------------------------------------+
| id   | select_type | table        | type   | possible_keys                                            | key                      | key_len | ref                              | rows  | r_rows   | filtered | r_filtered | Extra                                        |
+------+-------------+--------------+--------+----------------------------------------------------------+--------------------------+---------+----------------------------------+-------+----------+----------+------------+----------------------------------------------+
|    1 | PRIMARY     | notification | ref    | PRIMARY,IDX_notification_status,IDX_notification_user_id | IDX_notification_user_id | 8       | const                            | 22042 | 10756.00 |    50.03 |       0.02 | Using where; Using temporary; Using filesort |
|    1 | PRIMARY     | notification | eq_ref | PRIMARY                                                  | PRIMARY                  | 8       | gitea_production.notification.id | 1     | 1.00     |   100.00 |     100.00 |                                              |
+------+-------------+--------------+--------+----------------------------------------------------------+--------------------------+---------+----------------------------------+-------+----------+----------+------------+----------------------------------------------+
```
2024-12-04 15:19:59 +01:00
Earl Warren
d91ca01dff Merge pull request 'Update dependency webpack to v5.97.0 (forgejo)' (#6140) from renovate/forgejo-webpack-5.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6140
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-04 11:28:46 +00:00
Renovate Bot
6d0640211a Update dependency webpack to v5.97.0 2024-12-04 10:49:22 +00:00
Michael Kriese
f9b1de2e7d Merge pull request 'build: relax required go version for local development' (#6136) from viceice/forgejo:ci/go-version into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6136
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-04 10:45:14 +00:00
Gusted
bc9f1e2533
fix: correct permission loading for limited organisation
- If a organisation is set to be limited visible, then it will still be
visible for signed-in users. However `UnitPermission` didn't take this
into account, it does now.
- Add unit test.
- Resolves #6141
2024-12-04 11:03:33 +01:00
Michael Kriese
df765431e4
build: fix go command 2024-12-04 09:37:17 +01:00
Michael Kriese
f61db3f2c1
build: use go from goroot for fmt 2024-12-04 09:37:17 +01:00
Michael Kriese
5efd29e54e
build: relax required go version for local development 2024-12-04 09:37:13 +01:00
Earl Warren
790f3c4861 Merge pull request 'Lock file maintenance (forgejo)' (#6119) from renovate/forgejo-lock-file-maintenance into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6119
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-04 08:16:43 +00:00
Renovate Bot
8247a8f2d0 Lock file maintenance 2024-12-04 07:44:05 +00:00
Renovate Bot
8b1cbb470d Update dependency typescript to v5.7.2 (forgejo) (#6049)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6049
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-04 07:41:45 +00:00
Earl Warren
067044eacb Merge pull request 'Update fnetx/setup-cache-go digest to 4b50dd2 (forgejo)' (#6137) from renovate/forgejo-fnetx-setup-cache-go-digest into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6137
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-04 07:26:30 +00:00
Renovate Bot
3e0b76d430 Update dependency tailwindcss to v3.4.16 (forgejo) (#6139)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6139
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-04 07:13:48 +00:00