Commit graph

19292 commits

Author SHA1 Message Date
Renovate Bot 9a581e70a1 Update dependency vitest to v1.5.3 2024-05-01 06:03:44 +00:00
Renovate Bot 15978d4d07 Update ghcr.io/visualon/renovate Docker tag to v37.330.1 2024-05-01 06:02:32 +00:00
Earl Warren 288747c660 Merge pull request 'Fix SQL command with too many placeholders' (#3570) from algernon/forgejo:many-question-marks-handle-it into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3570
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 05:24:08 +00:00
Gergely Nagy 33cd8446d3
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>
2024-05-01 00:34:48 +02:00
Gergely Nagy 0d029ebe6d
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>
2024-05-01 00:34:39 +02:00
0ko abcb23a838 Merge pull request 'Cumulative English locale improvements' (#3266) from 0ko/forgejo:i18n-20240416 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3266
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 14:49:48 +00:00
Earl Warren f7b53ef959 Merge pull request 'Fix user mention processing' (#3565) from algernon/forgejo:call-me-maybe into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3565
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:24:07 +00:00
Earl Warren 9a3a3feb4c Merge pull request 'Add inline attachments to comments and prevent double handling of mails' (#3504) from Beowulf/forgejo:mail-inline-attachments-not-added-to-comment into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3504
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:19:42 +00:00
Gergely Nagy 9a01062ae2
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>
2024-04-30 12:51:30 +02:00
Beowulf 34134df3a7
added release notes 2024-04-30 12:05:22 +02:00
oliverpool 6ba60f61cb Merge pull request 'fix: webhook: send short ref on gitea create/delete payload' (#3558) from oliverpool/forgejo:webhook_gitea_fix into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3558
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 09:10:39 +00:00
Beowulf aeb544aff7
added test for reading inline attachments 2024-04-30 10:47:48 +02:00
oliverpool 0d3a9e6491 webhook: send short ref on gitea create/delete payload 2024-04-30 10:41:42 +02:00
oliverpool cb0f361171 test: webhook gitea tag creation ref 2024-04-30 10:41:38 +02:00
Earl Warren afb3bcaa8b Merge pull request 'fix: webhook getPayloadBranch' (#3555) from oliverpool/forgejo:webhook_ref_compat into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3555
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 08:15:42 +00:00
oliverpool df06904f4a webhook: fix getPayloadBranch 2024-04-30 09:38:35 +02:00
oliverpool 79380c209d test: webhook fix branch filter tests 2024-04-30 09:38:35 +02:00
Earl Warren 425d64a023 Merge pull request 'Update module connectrpc.com/connect to v1.16.1' (#3491) from renovate/connectrpc.com-connect-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3491
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 07:10:13 +00:00
Earl Warren e58a4c9a76 Merge pull request 'Update dependency @stylistic/stylelint-plugin to v2.1.2' (#3544) from renovate/stylistic-stylelint-plugin-2.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3544
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-04-30 07:04:10 +00:00
Earl Warren 79ffb2de47 Merge pull request '[gitea] week 2024-18 cherry pick (gitea-github/main -> forgejo)' (#3513) from earl-warren/wcp/2024-18 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3513
Reviewed-by: jean-daricade <jean-daricade@noreply.codeberg.org>
2024-04-30 06:42:26 +00:00
Earl Warren fb5c6d3837 Merge pull request 'remove MAINTAINERS file' (#3549) from Cyborus/forgejo:remove-maintainers into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3549
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 05:53:47 +00:00
Earl Warren fd67dccc5c Merge pull request 'Fix colour contrast issues in forms' (#3543) from fnetx/form-colour-contrast into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3543
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 05:36:14 +00:00
Earl Warren fdfef07d15 Merge pull request 'Choose better icon for Add more repo units suggestion' (#3542) from fnetx/repo-units-icon into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3542
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-30 05:34:58 +00:00
Earl Warren a1dbecf3b8 Merge pull request 'Fix toggling WIP state in PR footer' (#3537) from fnetx/fix-wip-toggle-footer into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3537
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-04-30 05:24:31 +00:00
Earl Warren b4383065d3 Merge pull request 'UI: Disable internal wiki options when enabling external wiki' (#3533) from n0toose/settings/wiki-unit-toggles into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3533
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 05:13:46 +00:00
Cyborus 57956d0525
remove MAINTAINERS file 2024-04-30 00:40:39 -04:00
0ko 11a7d8adfb [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 08:59:46 +05:00
Renovate Bot a7fcc3ca3f Update dependency dayjs to v1.11.11 2024-04-30 00:11:43 +00:00
Renovate Bot aba5fe36d8 Update dependency @stylistic/stylelint-plugin to v2.1.2 2024-04-30 00:11:35 +00:00
Otto Richter 03c1c88b5b Fix colour contrast issues 2024-04-30 01:48:30 +02:00
Codeberg Build Maintainers a8211e07d8 CB/tmpl: Modify icon for add more button 2024-04-30 01:17:18 +02:00
Otto 74ac5b802d Merge pull request '[UI] Remove italics from Settings UI' (#2627) from n0toose/settings/remove-italics into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2627
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-04-29 23:12:00 +00:00
proton-ab 5ed3ffc0c8 [I18N] Fix tepository->repository typo
Signed-off-by: proton-ab <proton_ab@tuta.io>
2024-04-29 22:17:18 +00:00
Otto Richter 900bf43a8a Fix PR WIP toggle prefixes
When the variable was renamed, this occurence was missed.
2024-04-29 23:35:44 +02:00
Panagiotis "Ivory" Vasilopoulos 870a1c85c7 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
```
2024-04-29 21:05:20 +02:00
Panagiotis "Ivory" Vasilopoulos 103306f00c 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`).
2024-04-29 20:29:00 +02:00
Panagiotis "Ivory" Vasilopoulos 3224628f36 [UI] Replace italics in Settings UI 2024-04-29 19:16:52 +02:00
Earl Warren 837b49a5d2 Merge pull request 'Update module github.com/urfave/cli/v2 to v2.27.2' (#3505) from renovate/github.com-urfave-cli-v2-2.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3505
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-04-29 13:01:28 +00:00
Earl Warren ce2becb55e Merge pull request 'feat: implement PKCE when acting as oauth2 client (for user login)' (#3307) from oliverpool/forgejo:pkce into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3307
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-29 10:58:17 +00:00
Earl Warren 18a936e648 Merge pull request 'Fixes that the settings button moves in the overflow menu when the add more button is shown' (#3520) from Beowulf/forgejo:fix-setting-button-on-right into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3520
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: crystal <crystal@noreply.codeberg.org>
Reviewed-by: Gergely Nagy <algernon@noreply.codeberg.org>
2024-04-29 10:53:26 +00:00
Earl Warren c283547692 Merge pull request 'Add release note for #3139' (#3519) from JakobDev/forgejo:releasenote into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3519
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-29 10:32:18 +00:00
oliverpool e1d93950ad feat: implement PKCE when acting as oauth2 client (for user login)
Closes #2766
2024-04-29 11:20:26 +02:00
Beowulf fb5e36bc6f
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.
2024-04-28 23:31:31 +02:00
JakobDev d59ebc3e32
Add release note for #3139 2024-04-28 22:44:59 +02:00
Earl Warren 27fa12427c Merge pull request 'replaced link to gitea docu' (#3503) from mainboarder/forgejo:repo-mirror into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3503
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-28 14:05:18 +00:00
Earl Warren 295b2fff5a
feat(renovate): github.com/urfave/cli/v2 is good at managing patches
let them be merged automatically
2024-04-28 16:01:28 +02:00
Beowulf c54896ba70 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>
2024-04-28 13:47:52 +00:00
Chongyi Zheng ec6d46bc8f
Fix nil dereference on error (#30740)
In both cases, the `err` is nil because of `if` checks before

Reference: #30729
(cherry picked from commit 970965f6d8fb4e68613ca445d2414c6c796b5231)
2024-04-28 15:39:02 +02:00
Chongyi Zheng 7517e70740
Use ProtonMail/go-crypto for opengpg in tests (#30736)
(cherry picked from commit 8b8b48ef5fb1c5c164d5534ea4b8049f1db26ce9)

Conflicts:
	go.mod
	trivial context confllict
2024-04-28 15:39:02 +02:00
Chongyi Zheng 781789e779
Replace deprecated math/rand functions (#30733)
Suggested by logs in #30729

- Remove `math/rand.Seed`
`rand.Seed is deprecated: As of Go 1.20 there is no reason to call Seed
with a random value.`
- Replace `math/rand.Read`
`rand.Read is deprecated: For almost all use cases, [crypto/rand.Read]
is more appropriate.`
- Replace `math/rand` with `math/rand/v2`, which is available since Go
1.22

(cherry picked from commit 7b8e418da1e082786b844562a05864ec1177ce97)
2024-04-28 15:39:02 +02:00