Commit graph

19591 commits

Author SHA1 Message Date
Earl Warren
09f3518069
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
2024-06-02 21:16:46 +02:00
Earl Warren
05f0007437
fix(hook): instance admins wrongly restricted by permissions checks
This exception existed for both instance admins and repo admins
before ApplyToAdmins was introduced in
79b7089360.

It should have been kept for instance admins only because they are not
subject to permission checks.
2024-06-01 23:50:57 +02:00
Earl Warren
793421bf59
tests(integration): add TestPullMergeBranchProtect
Verify variations of branch protection that are in play when merging a
pull request as:

* instance admin
* repository admin / owner
* user with write permissions on the repository

In all cases the result is expected to be the same when merging
the pull request via:

* API
* web

Although the implementations are different.
2024-06-01 23:50:57 +02:00
Earl Warren
e0eba21ab7
test(integration): add protected file to doBranchProtect
A protected file pushed to a protected branch branch is not allowed.
2024-06-01 23:50:57 +02:00
Earl Warren
0d8478b82e
test(integration): refactor doBranchProtectPRMerge
* group test cases to clarify their purpose
* remove pull request branch protection tests, they are redundant
  with TestPullMergeBranchProtect
2024-06-01 23:50:57 +02:00
Earl Warren
20591d966e
test(integration): refactor testPullMerge
* split into testPullMergeForm which can be called directly if
  the caller wants to specify extra parameters.
* testPullMergeForm can expect something different than StatusOK
2024-06-01 23:50:57 +02:00
Earl Warren
49aea9879b
test(integration): refactor doAPIMergePullRequest
* http.StatusMethodNotAllowed can be expected: only retry if the
  error message is "Please try again later"
* split into doAPIMergePullRequestForm which can be called directly if
  the caller wants to specify extra parameters.
2024-06-01 23:50:57 +02:00
Earl Warren
70aa294cc1
test(integration): refactor doProtectBranch
explicitly specify the parameters instead of providing them as
arguments so the caller has a more fine grain control over them.
2024-06-01 23:50:57 +02:00
Earl Warren
4c2ed3c35d
test(integration): add t.Helper() to reduce stack polution
Without the a testify stack is likely to not show the relevant test.
2024-06-01 23:50:57 +02:00
Earl Warren
f887972348 Merge pull request 'forgejo-federated-star: UI to define following repos' (#3886) from meissa/forgejo:forgejo-federated-pr5 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3886
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 15:57:17 +00:00
Earl Warren
5e71e0fd4a Merge pull request 'chore(renovate): use sqlite package cache' (#3958) from viceice/renovate-sqlite into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3958
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 15:32:02 +00:00
Michael Jerger
8aade372cb add a release note 2024-05-31 16:28:26 +02:00
Earl Warren
3a469d72a0 Merge pull request 'Update module github.com/go-testfixtures/testfixtures/v3 to v3.11.0' (#3955) from renovate/github.com-go-testfixtures-testfixtures-v3-3.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3955
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 13:51:08 +00:00
Earl Warren
dd4a1aa0d4
chore(dependency): automerge go-testfixtures/testfixtures
Refs: https://codeberg.org/forgejo/forgejo/pulls/3955
2024-05-31 15:10:49 +02:00
Michael Kriese
629554f8a8
chore(renovate): use sqlite package cache 2024-05-31 13:54:12 +02:00
Earl Warren
a1ef8eaf29 Merge pull request 'Disable self-registration by default on the install page' (#3934) from algernon/forgejo:abandon-all-registration-all-ye-who-enter-here into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3934
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-31 11:49:20 +00:00
Earl Warren
05c55e53a8 Merge pull request 'Update linters' (#3921) from renovate/linters into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3921
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-05-31 10:39:01 +00:00
forgejo-renovate-action
494ef1a78a Merge pull request 'Update ghcr.io/visualon/renovate Docker tag to v37.382.4' (#3957) from renovate/ghcr.io-visualon-renovate-37.x into forgejo 2024-05-31 10:33:50 +00:00
Renovate Bot
1a6fb16166 Update ghcr.io/visualon/renovate Docker tag to v37.382.4 2024-05-31 09:09:22 +00:00
Renovate Bot
430183fa14 Update linters 2024-05-31 08:55:12 +00:00
Earl Warren
dcc842dfeb Merge pull request 'chore(renovate): disallow eslint-plugin-no-use-extend-native v0.6.0+, requires eslint v9' (#3951) from viceice/forgejo:chore/renovate/update-config into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3951
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 08:36:38 +00:00
Michael Kriese
99789e2b9a
chore(renovate): disallow eslint-plugin-no-use-extend-native v0.6.0+, requires eslint v9 2024-05-31 09:00:52 +02:00
Gergely Nagy
6b24a7919d
Add a release note about the previous changes
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-31 08:21:55 +02:00
Earl Warren
e48b23c2be Merge pull request 'Update dependency happy-dom to v14.12.0' (#3954) from renovate/happy-dom-14.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3954
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-31 05:56:24 +00:00
Earl Warren
3a8a8fb467 Merge pull request 'Update module github.com/alecthomas/chroma/v2 to v2.14.0 (take 2)' (#3952) from earl-warren/forgejo:wip-chroma into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3952
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-31 05:25:06 +00:00
forgejo-renovate-action
d1c4586d6b Merge pull request 'Update dependency swagger-ui-dist to v5.17.13' (#3929) from renovate/swagger-ui-dist-5.17.x into forgejo 2024-05-31 04:34:46 +00:00
Renovate Bot
652c2840f9 Update dependency happy-dom to v14.12.0 2024-05-31 04:07:17 +00:00
Renovate Bot
7ad366d253 Update dependency swagger-ui-dist to v5.17.14 2024-05-31 04:06:55 +00:00
0ko
503953fb9b Unify vertical and horizontal paddings in markup file view (#3944)
Use the same padding horizontally and vertically, so the views like readme look a bit nicer. Just slightly adjusted two values, nothing really test-able here.

## Motivation

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

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

## Preview

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

## Note

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

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

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

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

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3937
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-05-30 11:41:45 +00:00
Earl Warren
b1e04a89be Merge pull request 'Fix localization of release/tag counters on releases page' (#3938) from 0ko/forgejo:i18n-release-page into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3938
2024-05-29 22:06:22 +00:00
0ko
83e6b0c0c6 Fix localization of release/tag counters on releases page 2024-05-29 22:46:36 +05:00
Michael Jerger
2f7f1aab8a fix review 2024-05-29 18:31:06 +02:00
Michael Jerger
5620dd76fa Merge branch 'forgejo' into forgejo-federated-pr5 2024-05-29 18:26:16 +02:00
Earl Warren
73f6e8809a Merge pull request 'Update dependency happy-dom to v14.11.2' (#3928) from renovate/happy-dom-14.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3928
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-28 17:52:41 +00:00
Earl Warren
8cca0d74dc Merge pull request 'mailer: Switch X-Mailer to "Forgejo"' (#3931) from algernon/forgejo:mailer-detox into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3931
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-28 17:51:04 +00:00
Earl Warren
f770ae3eb6 Merge pull request 'mailer: Put the username in X-Forgejo-Sender and -Recipient' (#3932) from algernon/forgejo:of-display-and-user-names into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3932
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-28 17:50:01 +00:00
Earl Warren
ae99aa0bbe Merge pull request 'migrations: Map non-existant external users to Ghost' (#3935) from algernon/forgejo:who-let-the-nils-out into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3935
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-28 16:42:31 +00:00
Renovate Bot
59a1336b8d Update dependency happy-dom to v14.11.2 2024-05-28 14:04:44 +00:00
Earl Warren
7af3a981b5 Merge pull request '[gitea] week 2024-22 cherry pick (gitea/main -> forgejo)' (#3917) from earl-warren/wcp/2024-22 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3917
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-28 10:50:48 +00:00
Gergely Nagy
ade7304eea
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>
2024-05-28 12:40:11 +02:00
Gergely Nagy
9fc61cae48
install: Force DisableRegistration on during install
When installing Forgejo via the on-line installer, force
DisableRegistration to true, to discourage creating instances with open
registration. Because open registration requires constant vigil to fight
off spammers of all kinds, it is not a great default. It should be a
conscious decision. This change is made in an effort to make the choice
of running an instance with open registration a conscious choice, rather
than simply the default.

Partially addresses #3925.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-28 08:57:30 +02:00
Gergely Nagy
95808a3cfd
install: Make "Disable self-registration" more prominent
Having an instance with open registration requires work, otherwise it
will be overrun by spammers of all kinds. Yet, the setting to disable
open registration on the installation page is hidden behind "optional
settings", a place hardly anyone ever looks.

To improve the situation, lift the setting out of that, and place it
more prominently, just above the update checker setting.

Partially addresses #3925.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-28 08:53:31 +02:00
Gergely Nagy
4bccc96684
mailer: Put the username in X-Forgejo-Sender and -Recipient
Following gitea#28981, set `X-Forgejo-Sender` and `X-Forgejo-Recipient`
to the username of the respective users, rather than their display name.
The username is more appropriate for these headers, for filtering
purposes. The display name is already included in the From header.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-28 08:27:37 +02:00
Gergely Nagy
887c027ec2
mailer: Switch X-Mailer to "Forgejo"
Fixes #3930.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-28 08:19:03 +02:00
silverwind
afa1380672
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)
2024-05-27 13:15:20 +02:00
Earl Warren
95ccbb5995 Merge pull request 'Update dependency updates to v16.1.1' (#3920) from renovate/updates-16.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3920
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-27 05:47:51 +00:00
Earl Warren
d17c8ad7fc Merge pull request 'Update dependency markdownlint-cli to v0.41.0' (#3919) from renovate/markdownlint-cli-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3919
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-27 05:46:18 +00:00