Commit graph

18493 commits

Author SHA1 Message Date
Gusted 1e364cc21f Merge pull request 'Preview: set font-size on preview content' (#2349) from gusted/forgejo-preview-fontsize into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2349
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-15 16:14:37 +00:00
Earl Warren e3f1e85244 Merge pull request '[CI] upgrade to golangci-lint@v1.56.1' (#2354) from earl-warren/forgejo:wip-lint-upgrade into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2354
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-15 15:49:35 +00:00
Earl Warren c8b177713a
[CLEANUP] make golangci-lint@v1.56.1 happy 2024-02-15 16:19:36 +01:00
Earl Warren 79df409256
[CI] upgrade to golangci-lint@v1.56.1 2024-02-15 16:19:28 +01:00
Argo 761641cf4a Add Zig gitignore 2024-02-15 11:19:08 +00:00
Gusted b1aabbf174
Preview: set font-size on preview content
- When previewing the content in a review, no font size was set. This
resulted in the previewed content being bigger than other text and
therefor creating an noticable inconsistency.
- Set the font size of the previewed content, 14px, this is consistent
with how the content would be rendered.
- `comment-code-cloud` is the class used for the review boxes.
`.ui.tab.markup` means it only applies to the preview tab.
2024-02-14 23:02:40 +01:00
Earl Warren 56f161167a Merge pull request '[gitea] cherry-pick' (#2337) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2337
Reviewed-by: Otto <otto@codeberg.org>
2024-02-14 21:29:08 +00:00
Earl Warren 41cc9784f9 Merge pull request 'agit: Automatically fill in the description' (#2344) from algernon/f/agit/description-autofill into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2344
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-02-14 20:46:00 +00:00
6543 e9e6c6152e
Dont load Review if Comment is CommentTypeReviewRequest (#28551)
RequestReview get deleted on review.
So we don't have to try to load them on comments.

broken out #28544

(cherry picked from commit 6fad2c874438275d3f69bb1cc223708bd2d27ff6)
2024-02-14 21:44:25 +01:00
Tim-Nicas Oelschläger 27bc2b9d95
Show View at this point in history for every commit (#29122)
Shows the 'View at this point in history'-link (from #27354) for every
commit

before:

![image](https://github.com/go-gitea/gitea/assets/72873130/0e5cd763-e099-4bb4-9519-653fe21f85a6)

after:

![image](https://github.com/go-gitea/gitea/assets/72873130/2b57346f-51e3-4901-b85e-63a690878939)

(cherry picked from commit b85e4a64fa26e1f20321c3a7cedf9fa05640ca48)
2024-02-14 21:44:24 +01:00
GiteaBot 1662f50464
[skip ci] Updated translations via Crowdin
(cherry picked from commit 33d939096d93a1014d4961374939376260740cbc)
2024-02-14 21:44:24 +01:00
GiteaBot 9a6709869e
[skip ci] Updated translations via Crowdin
(cherry picked from commit d75708736a2189e7fdbed60444e3bbeef1c5270a)
2024-02-14 21:44:24 +01:00
Tim-Nicas Oelschläger b03af9efb2
Show more settings for empty repositories (#29130)
Shows more settings for empty repositories (Fixes #29060)

(cherry picked from commit 28db539d9c0fa0b7c9411724d8b4bf6f371651a0)
2024-02-14 21:44:24 +01:00
silverwind f7491db1c0
Update JS and PY dependencies (#29127)
- Update all excluding `@mcaptcha/vanilla-glue` and
`eslint-plugin-array-func`
- Remove deprecated and duplicate eslint rule
- Tested Monaco, Mermaid and Swagger

(cherry picked from commit 4fe37124e9ad5395b734662a7e8ab7b0025c38a3)
2024-02-14 21:44:24 +01:00
Gergely Nagy 259ad5d614
agit: Automatically fill in the description
If no `-o description=` is provided, fill it in automatically from the
first commit, just like title. Also allow filling in either, and
specifying them independently.

This means that `git push origin HEAD:refs/for/main/my-local-branch`
will fill in the PR title, *and* the description, without having to
specify additional parameters.

The description is the first commit's message without the first two
lines (the title and a newline, as customary).

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-14 21:17:55 +01:00
Earl Warren 231548ba7e Merge pull request 'Add merge style fast-forward-only (gitea#28954)' (#2347) from algernon/forgejo:f/repo/merge/fast-forward-only-port into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2347
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-14 19:58:54 +00:00
Gergely Nagy a3a7af5a2b
Update .deadcode-out
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-14 17:31:06 +01:00
Chris Copeland 83123b493f
Add merge style fast-forward-only (#28954)
With this option, it is possible to require a linear commit history with
the following benefits over the next best option `Rebase+fast-forward`:
The original commits continue existing, with the original signatures
continuing to stay valid instead of being rewritten, there is no merge
commit, and reverting commits becomes easier.

Closes #24906
2024-02-14 17:19:19 +01:00
Earl Warren 05eaf1cf3e Merge pull request 'Repository settings refactor' (#2221) from algernon/forgejo:repo-units/ui-refactor into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2221
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-02-14 13:29:04 +00:00
Codeberg Translate 6c3895638c [I18N] Translations update from Weblate (#2322)
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: mondstern <mondstern@monocles.de>
Co-authored-by: earl-warren <contact@earl-warren.org>
Co-authored-by: Kaede Fujisaki <psi@7io.org>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Co-authored-by: noureddin <noureddin@protonmail.com>
Co-authored-by: yeziruo <i@yeziruo.com>
Co-authored-by: fnetX <otto@codeberg.org>
Co-authored-by: nykula <nykula@ukr.net>
Co-authored-by: Werenter <abelokopytov149@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2322
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-02-14 11:01:06 +00:00
Gusted 2cf242344e Merge pull request 'Minor cleanup in ViewLatestWorkflowRun' (#2343) from algernon/b/actions/view-latest-run-for-workflow/ctx.ServerError into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2343
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-14 09:02:30 +00:00
Gergely Nagy 8075721823
Minor cleanup in ViewLatestWorkflowRun
Use `ctx.ServerError` instead of a separate `log.Error` + `ctx.Error`.
`ctx.ServerError` does essentially the same thing, but better.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-13 23:20:16 +01:00
Gergely Nagy 44424bfe60
Add tests for the previous two commits
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-13 22:42:09 +01:00
Gergely Nagy e07b0e75ff
Add a direct link from repo header to unit settings
If a repository administrator is viewing a repository, and there are
units that can be enabled, display an "Add more..." link that leads to
the repository unit settings page.

The goal here is to allow instances to configure a small set of repo
units to be enabled by default, but also highlight for repo admins that
they can add more.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-13 22:42:09 +01:00
Gergely Nagy fa73375e13
Split out repository unit settings
This splits out the repository unit settings (formerly "Advanced
settings" under the repository settings page) into their own, separate
page.

The primary reason for this is that the settings page became long and
complicated, with a structure that not always made sense. A secondary
reason is that toggling units on and off should not necessarily be an
"advanced" setting. We want to make doing that easier, and having the
units on their own page helps with that.

This is basically a refactor, there is no new functionality introduced,
just an extra pair of routes for the new page, and the supporting code.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-13 22:42:09 +01:00
Gusted 2d321d27d1 Merge pull request '[BUG] Workaround borked Git version' (#2335) from gusted/forgejo-git-workaround into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2335
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-02-13 20:05:06 +00:00
Gusted f68f880974
[BUG] Workaround borked Git version
- 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.
- Ref: https://lore.kernel.org/git/CABn0oJvg3M_kBW-u=j3QhKnO=6QOzk-YFTgonYw_UvFS1NTX4g@mail.gmail.com/
- Resolves #2333.
2024-02-13 18:33:18 +01:00
Gusted 91d40751c7 Merge pull request '[FEAT] Don't log context cancelled SQL errors (squash)' (#2330) from gusted/forgejo-no-db into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2330
Reviewed-by: Otto <otto@codeberg.org>
2024-02-13 07:35:25 +00:00
Gusted cbbcfdd400
[FEAT] Don't log context cancelled SQL errors
- I found this while doing some unrelated testing in Forgejo. It wasn't
my intention to log failed SQL queries if they were cancelled (which can
happen quite frequently for larger instances) as in those cases it's not
interesting to know which SQL query was run. My intentation was only to
log an SQL query if there was an error reported by the database.
- Ref #2140
2024-02-12 23:11:50 +01:00
Earl Warren c6a89b490d Merge pull request '[gitea] cherry-pick' (#2324) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2324
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-12 13:39:28 +00:00
Earl Warren 98e7753ade Merge pull request '[FEAT]: Allow forking without a repo ID' (#2310) from algernon/forgejo:f/repo/fork-route into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2310
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-12 13:36:49 +00:00
Earl Warren ba5f9f7bb4 Merge pull request '[RELEASE] Gitea version is for interoperability only' (#2327) from earl-warren/forgejo:wip-version into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2327
Reviewed-by: Otto <otto@codeberg.org>
2024-02-11 21:44:31 +00:00
Alexandre Oliveira 29007c09bd Fix Alpine Registry packages with noarch not being found (#2285)
Fixes #2173
~~Still requires a bit of work to do, I'm not 100% happy with this solution.~~

The idea is to copy the noarch package to the architectures available in the package repository.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2285
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
Co-committed-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
2024-02-11 18:02:56 +00:00
Earl Warren db3b867b02
[RELEASE] Gitea version is for interoperability only
Forgejo now has its own lifecycle and its version is derived from the
tag. The Gitea tags are no longer found in the Forgejo codebase and
can no longer be used for that purpose.

When a Forgejo release is published, for interoperability with the
existing tools in the ecosystem, it advertises the supported Gitea
version via /api/v1/version. It is set in the Makefile manually and
cannot be automatically set.

https://codeberg.org/forgejo-contrib/delightful-forgejo#packaging

Existing Forgejo packages rely on the Makefile to build and the change
must be done in a way that tries to not break their assumptions. From
the point of view of a Forgejo package build, the following will
happen on the next major release:

- The package version will bump from v1.21.x to v7.0.0
- /api/v1/version will bump from v1.21.x to v1.22.0
- /api/forgejo/v1/version will bump from v6.x to v7.0.0

The Makefile uses the following variables:

GITEA_VERSION is returned by /api/v1/version
FORGEJO_VERSION is returned by /api/forgejo/v1/version
VERSION is used in the name the binary file and the source archive

Before:

GITEA_VERSION is the computed version
FORGEJO_VERSION is set manually
VERSION defaults to GITEA_VERSION

After:

FORGEJO_VERSION is the computed version
GITEA_VERSION is set manually
VERSION defaults to FORGEJO_VERSION

When the version is computed, it comes from:

- The content of the VERSION file if it exists. It is inserted in
  the source archive because it does not contain a git repository
- Otherwise the output of `git describe`
2024-02-11 15:36:58 +01:00
Earl Warren 7b4dba3aa0 [ACTIONS] skip superflous pull request synchronized event (#2314)
Skip a HookEventPullRequestSync event if it has the same CommitSHA as an existing HookEventPullRequest event in the ActionRun table. A HookEventPullRequestSync event must only create an ActionRun if the CommitSHA is different from what it was when the PR was open.

This guards against a race that can happen when the following is done in parallel:

* A commit C is pushed to a repo on branch B
* A pull request with head on branch B

it is then possible that the pull request is created first, successfully. The commit that was just pushed is not known yet but the PR only references the repository and the B branch so it is fine.

A HookEventPullRequest event is sent to the notification queue but not processed immediately.

The commit C is pushed and processed successfully. Since the PR already exists and has a head that matches the branch, the head of the PR is updated with the commit C and a HookEventPullRequestSync event is sent to the notification queue.

The HookEventPullRequest event is processed and since the head of the PR was updated to be commit C, an ActionRun with CommitSHA C is created.

The HookEventPullRequestSync event is then processed and also has a CommitSHA equal to C.

Refs: https://codeberg.org/forgejo/forgejo/issues/2009
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2314
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2024-02-11 13:06:54 +00:00
silverwind 9c4e0c26f9
[gitea] Remove obsolete border-radius on comment content (#29128)
This border-radius is obsolete since we changed the comment rendering a
few months ago and it caused incorrect display on blockquotes.

Before:
<img width="160" alt="Screenshot 2024-02-10 at 18 42 48"
src="https://github.com/go-gitea/gitea/assets/115237/ccbf4660-acf9-4268-aad9-1ad49d317a67">

After:
<img width="135" alt="Screenshot 2024-02-10 at 18 42 40"
src="https://github.com/go-gitea/gitea/assets/115237/6f588e02-3b2a-49ee-b459-81d8068b2f4e">

(cherry picked from commit 9063fa096386362f9ae602fdf8a39ae8c972b8e0)
2024-02-11 13:47:48 +01:00
Yarden Shoham 7c9387a242
[gitea] Make blockquote border size less aggressive (#29124)
It's too thick

I made it match GitHub's size

![image](https://github.com/go-gitea/gitea/assets/20454870/08c05004-acd9-485e-9219-110d93fe1226)

![image](https://github.com/go-gitea/gitea/assets/20454870/e2e32b6c-4ba8-488e-9405-95d33f80adf7)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 5f5b5ba6e3e50ba5385e6cbf5957d4b73805769b)
2024-02-11 13:47:46 +01:00
Gwyneth Morgan 9a1d5c549c
[gitea] Drop "@" from email sender to avoid spam filters (#29109)
Commit 360b3fd17c (Include username in email headers (#28981),
2024-02-03) adds usernames to the From field of notification emails in
the form of `Display Name (@username)`, to prevent spoofing. However,
some email filtering software flags "@" in the display name part of the
From field as potential spoofing, as you could set the display name part
to another email address than the one you are sending from (e.g.
`From: "apparent@email-address" <actual@email-address>`). To avoid
being flagged, instead send emails from `Display Name (username)`.

Closes: #29107

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 5b2fd0fc19a2a77414c8e2989b4794b6617221f5)
2024-02-11 13:47:44 +01:00
GiteaBot 22fd29d3b7
[gitea] [skip ci] Updated translations via Crowdin
(cherry picked from commit c1f7249056d4aa38927aebcbddc6459ee714c801)
2024-02-11 13:47:36 +01:00
Earl Warren 40b9f3996b Merge pull request '[FEAT]: New route to view latest run of specific workflows' (#2304) from algernon/forgejo:f/web/actions/workflow-latest-run-routes into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2304
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-11 07:34:08 +00:00
Earl Warren 91f2f02f09 Merge pull request '[gitea] cherry-pick' (#2320) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2320
2024-02-10 10:37:00 +00:00
silverwind 22c694a9e9
[gitea] add lint-spell-fix to lint-fix (#29111)
Followup to https://github.com/go-gitea/gitea/pull/29106, fix this
oversight.

(cherry picked from commit c7a21cbb0c5f8302495fa24baf218dc3462de2c5)
2024-02-10 10:53:43 +01:00
silverwind 6fcb8e652b
[gitea] Rework spellchecking, add lint-spell (#29106)
- Use maintained fork https://github.com/golangci/misspell
- Rename `mispell-check` to `lint-spell`, add `lint-spell-fix`
- Run `lint-spell` in separate actions step
- Lint more files, fix discovered issues
- Remove inaccurate and outdated info in docs (we do not need GOPATH for
tools anymore)

Maybe later we can add more spellchecking tools, but I have not found
any good ones yet.

(cherry picked from commit 9c39f8515fa88d644736c6773d7a05d070a02e82)

Conflicts:
	.github/workflows/pull-compliance.yml
	Makefile
2024-02-10 10:53:43 +01:00
wxiaoguang 83bb3cf86a
[gitea] Refactor parseSignatureFromCommitLine (#29054)
Replace #28849. Thanks to @yp05327 for the looking into the problem.
Fix #28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.

(cherry picked from commit a24e1da7e9e38fc5f5c84c083d122c0cc3da4b74)
2024-02-10 10:53:43 +01:00
KN4CK3R 045bd097c6
[gitea] Display friendly error message (#29105)
`ctx.Error` only displays the text but `ctx.ServerError` renders the
usual error page.

(cherry picked from commit da2f03750f9672c5aac48209539874f2af2673f1)
2024-02-10 10:53:43 +01:00
silverwind 0d62b52f4f
[gitea] Use defaults browserslist (#29098)
IE usage has dropped enough to not be included in the defaults
browserslist anymore as per https://browsersl.ist/#q=defaults, so we can
use the defaults now.

(cherry picked from commit ce9978bfd4e035ed065b02b28e02905674320b6a)
2024-02-10 10:53:43 +01:00
Lunny Xiao b9f48332c7
[gitea] Fix push to create with capitalize repo name (#29090)
Fix #29073

(cherry picked from commit 96ad1d6340038c0c841d9cad9a440daee3241aac)
2024-02-10 10:53:43 +01:00
Lunny Xiao 1fdd8341d6
[gitea] Remove unnecessary parameter (#29092)
The parameter extraConfigs has never been used anywhere. This PR just
removed it. It can be taken back once it's needed.

(cherry picked from commit 8c6ffdac378654f9d2171ebdbc46becf1571f7fe)
2024-02-10 10:53:43 +01:00
silverwind 02b03247de
[gitea] Move vitest setup file to root (#29097)
I'm using this convention in other projects and I think it makes sense
for gitea too because the vitest setup file is loaded globally for all
tests, not just ones in web_src, so it makes sense to be in the root.

(cherry picked from commit 98e7e3a5f07b8bc620e26bc1ab6f7a86bccbb7cb)
2024-02-10 10:53:43 +01:00
CEnnis91 4b1b774ccd
[gitea] Fix incorrect link to swift doc and swift package-registry login command (#29096)
Fixes a few mistakes in the Swift package registry documentation.

Syntax for the `package-registry login` command can be found
[here](https://github.com/apple/swift-package-manager/blob/main/Documentation/PackageRegistry/PackageRegistryUsage.md#registry-authentication).
I was not sure the best way to compress all of that information, so I
just focused on making sure the incorrect `package-registry set` command
was fixed.

(cherry picked from commit eb5ddc0a78ecfe007a6e279a3c59711cdfb3f701)
2024-02-10 10:53:43 +01:00