Commit graph

22043 commits

Author SHA1 Message Date
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
Renovate Bot
585de092b4 Update fnetx/setup-cache-go digest to 4b50dd2 2024-12-03 22:02:18 +00:00
Earl Warren
56007ff3a2 Merge pull request '[gitea] week 2024-49 cherry pick (gitea/main -> forgejo)' (#6110) from earl-warren/wcp/2024-49 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6110
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-03 15:06:55 +00:00
Earl Warren
df37e245d0
chore(release-notes): notes for the week 2024-49 weekly cherry pick 2024-12-03 10:21:20 +01:00
william-allspice
2faccf5374
Fix race condition in mermaid observer (#32599)
This Pull Request addresses a race condition in the updateIframeHeight
function where it is sometimes called when the iframe is not fully
loaded or accessible resulting in an alarming error message for the
user.

To address this we:
1. Add defensive programming within the updateIframeHeight function
2. Delay instantiating the intersection observer until the iframe has
loaded

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 88f5d33ab267f330ffaf02eb019e772ed06ed34f)
2024-12-03 10:19:22 +01:00
Zettat123
7aec65b48a
Fix a bug in actions artifact test (#32672)
This bug exists in `TestActionsArtifactDownload`.

a1f56f83bf/tests/integration/api_actions_artifact_test.go (L123-L134)

We assert that `listResp.Count` is `2`, so `artifactIdx` could be `0` or `1`.

a1f56f83bf/tests/integration/api_actions_artifact_test.go (L144-L147)

Then we assert that the length of `downloadResp.Value` is `1`. If
`artifactIdx` is `1` at this point, the assertion on Line 147 will throw
an `index out of range` error.

(cherry picked from commit fd3aa5bedb07d295d48b1f550c19ad1b387ba83f)
2024-12-03 10:19:22 +01:00
Rowan Bohde
2e00ae4cdd
Validate OAuth Redirect URIs (#32643)
This fixes a TODO in the code to validate the RedirectURIs when adding
or editing an OAuth application in user settings.

This also includes a refactor of the user settings tests to only create
the DB once per top-level test to avoid reloading fixtures.

(cherry picked from commit 16a7d343d78807e39df124756e5d43a69a2203a3)

Conflicts:
	services/forms/user_form.go
	tests/integration/user_settings_test.go
  simple conflicts
2024-12-03 10:19:22 +01:00
Lunny Xiao
3973f1022d
Add github compatible tarball download API endpoints (#32572)
Fix #29654
Fix #32481

(cherry picked from commit 703be6bf307ed19ce8dc8cd311d24aeb6e5b9861)

Conflicts:
	routers/api/v1/repo/file.go
	routers/web/repo/repo.go
	services/repository/archiver/archiver.go
	services/repository/archiver/archiver_test.go
  trivial context conflicts
  add missing function PathParam skipped in a very large refactor
2024-12-03 10:19:22 +01:00
Earl Warren
3d92dc861f Merge pull request 'feat: avoid sorting for MakeSelfOnTop' (#6130) from gusted/forgejo-sort into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6130
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-12-03 07:09:38 +00:00
Earl Warren
9dfea97080 Merge pull request 'fix: clean up log files that no longer exist' (#6128) from gusted/forgejo-cleanup into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6128
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-12-03 07:07:39 +00:00
Gusted
b500c48fa0
feat: avoid sorting for MakeSelfOnTop
- Although sorting can be used to make the doer the first user of the
list, this isn't optimal and can be instead done with a linear search,
remove that entry and add the doer to the front of the slice.
- Extra unit test added.
2024-12-03 05:32:51 +01:00
Gusted
4e8677a911
fix: clean up log files that no longer exist
- If for some reason a action log file does not longer exist in the
database or on the file system, then mark it as being cleaned up.
- Unit test added.
2024-12-03 05:09:47 +01:00
Gusted
b525eec82b Merge pull request 'fix: dbconsistency check adding missing quotes' (#6124) from 71rd/forgejo:dbconsistency-forgejo into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6124
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-03 04:05:20 +00:00
Gusted
45cec645de Merge pull request 'fix: return correct type in GetSubModule' (#6114) from gusted/forgejo-submodule-entry into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6114
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-12-03 03:24:01 +00:00
71rd
2953080339 fix: dbconsistency check adding missing quotes
On postgres the new check for orphaned authorization tokens fails with:
- [E] Error: pq: syntax error at or near "." whilst counting Authorization token without existing User

Adding marks to the user table reference allows the check to succeed
2024-12-02 16:05:51 +00:00
Otto
7c9214cb92 Merge pull request 'chore(ci): run merge conditions when a new commit is pushed' (#6120) from earl-warren/forgejo:wip-merge-conditions into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6120
Reviewed-by: Otto <otto@codeberg.org>
2024-12-02 14:03:54 +00:00
Earl Warren
4075d2c891
chore(ci): run merge conditions when a new commit is pushed
Otherwise the latest status of the PR may be skipped instead of fail
if the condition is not met.
2024-12-02 13:20:35 +01:00
Renovate Bot
8365133d6c Update renovate to v39.42.4 (forgejo) (#6115)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-02 07:14:08 +00:00
Renovate Bot
fc0510fc6f chore(deps): update dependency globals to v15.13.0 (forgejo)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [globals](https://github.com/sindresorhus/globals) | devDependencies | minor | [`15.12.0` -> `15.13.0`](https://renovatebot.com/diffs/npm/globals/15.12.0/15.13.0) |

---

### Release Notes

<details>
<summary>sindresorhus/globals (globals)</summary>

### [`v15.13.0`](https://github.com/sindresorhus/globals/releases/tag/v15.13.0)

[Compare Source](https://github.com/sindresorhus/globals/compare/v15.12.0...v15.13.0)

-   Update globals

***

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - "before 4am" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yOC4wIiwidXBkYXRlZEluVmVyIjoiMzkuMjguMCIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6118
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-02 05:44:16 +00:00
Gusted
e7cffc378f
Fix: return correct type in GetSubModule
- `GetSubModules` already solely stores the URL of the submodule and not
a `*SubModule` entry, so don't try to type assert it to be a struct.
- I am not able to pinpoint when this was regressed but if I had to
guess it might be #4941.
- Added integration test.
2024-12-02 01:08:09 +01:00
Mathieu Fenniak
2faa7ce749 Rework GetLatestCommitStatusForPairs query using a subquery for PG compatibility (#6113)
## Scope

Intended to fix #6099; and moves related tests to integration tests (per. request https://codeberg.org/forgejo/forgejo/pulls/6105#issuecomment-2486228)

## 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...
  - [ ] in their respective `*_test.go` for unit tests. **not applicable**
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes... **not applicable**
  - [ ] 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.
  - Rationale: bug-fix for a change that hasn't been released yet.
- [ ] 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/6113
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2024-12-01 19:15:31 +00:00
Gusted
d35bc0e636 Merge pull request 'feat: Add option to disable builtin authentication' (#6112) from squel/forgejo-disable-internal-signin into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6112
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-12-01 19:02:05 +00:00
Otto Richter
d2bf2e7631 Improve performance of allowed org repo creation query (#6100)
See https://codeberg.org/Codeberg-Infrastructure/build-deploy-forgejo/issues/144#issuecomment-2484031.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6100
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Otto Richter <git@otto.splvs.net>
Co-committed-by: Otto Richter <git@otto.splvs.net>
2024-12-01 15:16:25 +00:00
George Tsiamasiotis
a126477e86 feat: Add option to disable builtin authentication.
Setting ENABLE_INTERNAL_SIGNIN to false will disable the built-in
signin form, should the administrator prefer to limit users to SSO.

Continuation of forgejo/forgejo#6076
2024-12-01 15:50:10 +01:00
Renovate Bot
d68c99542c Update dependency djlint to v1.36.3 (forgejo) (#6108)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-01 08:33:38 +00:00
Renovate Bot
5472cec885 Update dependency @vitest/eslint-plugin to v1.1.12 (forgejo) (#6107)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-01 08:33:15 +00:00
Renovate Bot
a068209f64 Update dependency happy-dom to v15.11.7 (forgejo) (#6109)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-01 07:26:10 +00:00
Renovate Bot
57fd321f85 Update dependency @stoplight/spectral-cli to v6.14.2 (forgejo) (#6106)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-12-01 07:05:04 +00:00
Lunny Xiao
3135e146f9
Strict pagination check (#32548)
(cherry picked from commit c363bd06e93986a564601527ade219d602c9d8dd)

Conflicts:
	models/user/search.go
  change already done in 9b85f97835
2024-12-01 07:56:45 +01:00