Commit graph

20429 commits

Author SHA1 Message Date
Max Wipfli
4ddd9af50f
Allow including Reviewed-on/Reviewed-by lines for custom merge messages (#31211)
This PR introduces the `ReviewedOn` and `ReviewedBy` variables for the
default merge message templates (e.g.,
`.gitea/default_merge_message/MERGE_TEMPLATE.md`).

This allows customizing the default merge messages while retaining these
trailers.

This also moves the associated logic out of `pull.tmpl` into the
relevant Go function.

This is a first contribution towards #11077.

---

For illustration, this allows to recreate the "default default" merge
message with the following template:
```
.gitea/default_merge_message/MERGE_TEMPLATE.md
Merge pull request '${PullRequestTitle}' (${PullRequestReference}) from ${HeadBranch} into ${BaseBranch}

${ReviewedOn}
${ReviewedBy}
```

(cherry picked from commit da4bbc42477ba04d175cc0775a0c5ec90c4c24fe)

Conflicts:
	docs/content/usage/merge-message-templates.en-us.md
	not in Forgejo
	templates/repo/issue/view_content/pull.tmpl
	trivial context conflict
2024-06-09 16:04:57 +02:00
Henrique Pimentel
433b6c6910
Add MAX_ROWS option for CSV rendering (#30268)
This solution implements a new config variable MAX_ROWS, which
corresponds to the “Maximum allowed rows to render CSV files. (0 for no
limit)” and rewrites the Render function for CSV files in markup module.
Now the render function only reads the file once, having MAX_FILE_SIZE+1
as a reader limit and MAX_ROWS as a row limit. When the file is larger
than MAX_FILE_SIZE or has more rows than MAX_ROWS, it only renders until
the limit, and displays a user-friendly warning informing that the
rendered data is not complete, in the user's language.

---

Previously, when a CSV file was larger than the limit, the render
function lost its function to render the code. There were also multiple
reads to the file, in order to determine its size and render or
pre-render.

The warning: ![image](https://s3.amazonaws.com/i.snag.gy/vcKh90.jpg)

(cherry picked from commit f7125ab61aaa02fd4c7ab0062a2dc9a57726e2ec)
2024-06-09 16:04:57 +02:00
Kerwin Bryant
93d1fea67d
Optimize runner-tags layout to enhance visual experience (#31258)
![image](https://github.com/go-gitea/gitea/assets/3371163/b8199005-94f2-45be-8ca9-4fa1b3f221b2)

(cherry picked from commit 06ebae7472aef4380602d2ecd64fdc9dddcb6037)
2024-06-09 16:04:57 +02:00
Earl Warren
e759794408
tests(cmd): add coverage for migrateActionsArtifacts
Also convert a comment into a warning in the logs when the deletion of
an artifact cannot find the file in the destination storage.

The case were an error happens while deleting the file is not covered
as it would require to mock the storage.Copy function.
2024-06-09 16:02:31 +02:00
Rowan Bohde
4afbfd3946
fix: allow actions artifacts storage migration to complete succesfully (#31251)
Change the copy to use `ActionsArtifact.StoragePath` instead of the
`ArtifactPath`. Skip artifacts that are expired, and don't error if the
file to copy does not exist.

---

When trying to migrate actions artifact storage from local to MinIO, we
encountered errors that prevented the process from completing
successfully:

* The migration tries to copy the files using the per-run
`ArtifactPath`, instead of the unique `StoragePath`.
* Artifacts that have been marked expired and had their files deleted
would throw an error
* Artifacts that are pending, but don't have a file uploaded yet will
throw an error.

This PR addresses these cases, and allow the process to complete
successfully.

(cherry picked from commit 8de8972baf5d82ff7b58ed77d78e8e1869e64eb5)
2024-06-09 16:02:31 +02:00
Mai-Lapyst
0a7767eaaa [FEAT] Adds x-mode-only anchor styles to display images based if the theme is light or dark mode. (#3985)
Adds a feature similar to this https://github.blog/changelog/2021-11-24-specify-theme-context-for-images-in-markdown/ , by adding styles to elements which `src` or `href` attribute ends with `#light-mode-only` or `#dark-mode-only`. To improve compability, the github variants with the `gh-` prefix are also contained.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3985
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
2024-06-09 10:50:53 +00:00
silverwind
6582f0029b
Add lint-go-gopls (#30729)
Uses `gopls check <files>` as a linter. Tested locally and brings up 149
errors currently for me. I don't think I want to fix them in this PR,
but I would like at least to get this analysis running on CI.

List of errors:
```
modules/indexer/code/indexer.go:181:11: impossible condition: nil != nil
routers/private/hook_post_receive.go:120:15: tautological condition: nil == nil
services/auth/source/oauth2/providers.go:185:9: tautological condition: nil == nil
services/convert/issue.go:216:11: tautological condition: non-nil != nil
tests/integration/git_test.go:332:9: impossible condition: nil != nil
services/migrations/migrate.go:179:24-43: unused parameter: ctx
services/repository/transfer.go:288:48-69: unused parameter: doer
tests/integration/api_repo_tags_test.go:75:41-61: unused parameter: session
tests/integration/git_test.go:696:64-74: unused parameter: baseBranch
tests/integration/gpg_git_test.go:265:27-39: unused parameter: t
tests/integration/gpg_git_test.go:284:23-29: unused parameter: tmpDir
tests/integration/gpg_git_test.go:284:31-35: unused parameter: name
tests/integration/gpg_git_test.go:284:37-42: unused parameter: email
```

(cherry picked from commit 816222243af523316041692622be6f48ef068693)

Conflicts:
	Makefile
	trivial context conflict and also ask renovate to watch over it
	do not include it in lint-backend because the errors are not fixed
2024-06-09 11:13:39 +02:00
silverwind
23a82bcd7a
Remove .segment from .project-column (#31204)
Using `.segment` on the project columns is a major abuse of that class,
so remove it and instead set the border-radius directly on it.

Fixes: https://github.com/go-gitea/gitea/issues/31129
(cherry picked from commit 4ca65fabdad75e39f9948b9a2a18e32edc98ec02)
2024-06-09 11:13:39 +02:00
silverwind
57647abc24
Fix overflow on push notification (#31179)
Fixes: https://github.com/go-gitea/gitea/issues/30063

<img width="1301" alt="Screenshot 2024-05-30 at 14 43 24"
src="https://github.com/go-gitea/gitea/assets/115237/00443af0-088d-49a5-be9e-8c9adcc2c01d">

(cherry picked from commit 1f8ac27b31b52791396f198b665a1d6bbdcfd8b3)
2024-06-09 11:13:39 +02:00
Thomas Desveaux
c6e04c3c9e
Fix NuGet Package API for $filter with Id equality (#31188)
Fixes issue when running `choco info pkgname` where `pkgname` is also a
substring of another package Id.

Relates to #31168

---

This might fix the issue linked, but I'd like to test it with more choco
commands before closing the issue in case I find other problems if
that's ok.

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit c888c933a930ee2ba4e7bb0bf6678aaf45a9778a)
2024-06-09 11:13:39 +02:00
silverwind
5416e4054a
Fix overflow on notifications (#31178)
Fixes https://github.com/go-gitea/gitea/issues/31170.

<img width="1312" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/627711ed-93ca-4be6-b958-10d673ae9517">

(cherry picked from commit 4f9b8b397c1acb6f6d26c55e224aafcb5474a85b)
2024-06-09 11:13:39 +02:00
Earl Warren
21b94765ce
test(services/mailer): Add option for mailer to override mail headers
Use MockVariableValue to avoid undesirable side effects between tests
modifying global variables. TestToMessage relies
on *setting.MailService being set, which will not be the case if run
individually with test-sqlite#TestToMessage and fail.
2024-06-09 11:13:39 +02:00
6543
1d4bff4f65
Add option for mailer to override mail headers (#27860)
Add option to override headers of mails, gitea send out

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit aace3bccc3290446637cac30b121b94b5d03075f)

Conflicts:
	docs/content/administration/config-cheat-sheet.en-us.md
	does not exist in Forgejo
	services/mailer/mailer_test.go
	trivial context conflict
2024-06-09 11:13:39 +02:00
silverwind
237d18974e
Move custom tw- helpers to tailwind plugin (#31184)
Move the previous custom `tw-` classes to be defined in a tailwind
plugin. I think it's cleaner that way and I also verified double-class
works as expected:

<img width="299" alt="Screenshot 2024-05-30 at 19 06 24"
src="https://github.com/go-gitea/gitea/assets/115237/003cbc76-2013-46a0-9e27-63023fa7c7a4">

(cherry picked from commit 8c68c5e436805848197d98313e9ee77e8d540a83)
2024-06-09 11:13:39 +02:00
silverwind
b62fa72ceb
Remove unnecessary inline style for tab-size (#31224)
Move the rule to the parent node. `tab-size` is inherited so will work
just as before.

(cherry picked from commit 0f0db6a14fd10a493ba73f211e2e627c3884d114)
2024-06-09 11:13:39 +02:00
Kemal Zebari
90753a2c11
Document possible action types for the user activity feed API (#31196)
Resolves #31131.

It uses the the go-swagger `enum` property to document the activity
action types.

(cherry picked from commit cb27c438a82fec9f2476f6058bc5dcda2617aab5)
2024-06-09 11:13:39 +02:00
yp05327
3befabead0
Remove sqlite-viewer and using database client (#31223)
sqlite-viewer can not edit sqlite.
database client can connect to almost all common databases, which is
very useful I think. Of cause, it can edit sqlite.

https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-database-client2

And for using sqlite, sqlite3 is required. So also added a new feature:
https://github.com/warrenbuckley/codespace-features
found from: https://containers.dev/features

(cherry picked from commit fc641b3a28300e13c822140556eca8d00f2b5196)

Conflicts:
	.devcontainer/devcontainer.json
	trivial context conflict because AZure blob support was not added
2024-06-09 11:13:39 +02:00
GiteaBot
12528ae72c
[skip ci] Updated licenses and gitignores
(cherry picked from commit c6854202be9eb8358f046871d4eb0e4fd74639ff)
2024-06-09 11:13:39 +02:00
silverwind
e754f24712
Fix overflow in issue card (#31203)
Before:

<img width="373" alt="Screenshot 2024-06-01 at 01 31 26"
src="https://github.com/go-gitea/gitea/assets/115237/82a210f2-c82e-4b7e-ac43-e70e46fa1186">

After:
<img width="376" alt="Screenshot 2024-06-01 at 01 31 32"
src="https://github.com/go-gitea/gitea/assets/115237/82d1b9f7-4fad-47bd-948a-04e1e7e006e6">

(cherry picked from commit 9b05bfb173795ba2a2267402d2669715cd4a64e4)
2024-06-09 11:13:39 +02:00
Earl Warren
96f661e821 Merge pull request 'Update dependency @github/relative-time-element to v4.4.1' (#4081) from renovate/github-relative-time-element-4.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4081
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-09 07:22:08 +00:00
Renovate Bot
0f9f23eb6c Update dependency @github/relative-time-element to v4.4.1 2024-06-09 06:46:42 +00:00
Earl Warren
144aea4b91 Merge pull request 'Update module code.forgejo.org/forgejo/reply to v1.0.2' (#4080) from renovate/code.forgejo.org-forgejo-reply-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4080
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-09 05:55:02 +00:00
Earl Warren
795bfd045d Merge pull request 'chore(deadcode): restore the previous format' (#4078) from earl-warren/forgejo:wip-deadcode into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4078
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-06-09 05:26:50 +00:00
Renovate Bot
b25f5265b1 Update module code.forgejo.org/forgejo/reply to v1.0.2 2024-06-09 00:05:02 +00:00
Earl Warren
9464d51b2b
chore(deadcode): restore the previous format
While the newer default format is machine parsable, it also contains
line numbers which makes it sensitive to any change unrelated to deadcode.
2024-06-08 22:04:04 +02:00
Earl Warren
52f47aa46c Merge pull request 'Update instance title in tests' (#4077) from 0ko/forgejo:tests-actual-title into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4077
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-08 19:42:28 +00:00
0ko
2599737033 Update instance title in tests 2024-06-08 23:33:55 +05:00
Earl Warren
8e33f82a85 Merge pull request 'chore(dependency): add the dependency-upgrade label to PRs' (#4074) from earl-warren/forgejo:wip-renovate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4074
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-06-08 16:13:12 +00:00
Earl Warren
79e243c267
chore(dependency): add the dependency-upgrade label to PRs 2024-06-08 11:00:50 +02:00
Earl Warren
059591fbae Merge pull request 'Update module github.com/golangci/misspell/cmd/misspell to v0.6.0' (#4069) from renovate/github.com-golangci-misspell-cmd-misspell-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4069
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-08 05:37:55 +00:00
earl-warren
eb8345543e fix(dependency): github.com/golangci/misspell/cmd/misspell: chedule:quarterly
It will publish a release every commit which is too frequent.
2024-06-08 05:06:07 +00:00
Renovate Bot
d14bfc5586 Update module github.com/golangci/misspell/cmd/misspell to v0.6.0 2024-06-08 00:02:59 +00:00
0ko
f71a240239 UI improvements to optional sections in installation page (#4062)
Currently the collapsed sections on the installation page have bad visibility, clickability and don't look good. This commit attempts to improve this. It is also worth noting that the amount of these sections might increase.

### Changes

* make custom style for these collapsible sections of the form. This is not a standard design to Forgejo, but we also don't have forms this large anywhere else, and it's fit in a few small CSS rules, so I think that's justified. I'm curious how it looks to others visually, good or bad.
* improve the positioning of the installation location hint.
* remove very rare occasion of dashed horizontal divider as this rule is no longer needed with the new borders. It was [added](c16ae1ab39 (diff-f8dad1e2c95a9e959d4688c763f3e02d1878c8e0)) just a month ago and had a visual bug with duplicated dividers.

### Preview

|Before|After|
|-|-|
|![](/attachments/c5360e33-1694-4e75-bedc-b24717172ee9)|![](/attachments/2363e1ac-b4cb-4d96-9b6a-4315c1bd6416)|

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4062
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 17:57:54 +00:00
mirko
f015846c11 Add slogan config (#3752)
This is a PR for #3616

Currently added a new optional config `SLOGAN`  in ini file. When this config is set title page is modified in APP_NAME [ - SLOGAN]

Example in image below

![Selezione_075.png](/attachments/7a72171e-e730-4e57-8c97-ffc94258e00f)

Add the new config value in the admin settings page (readonly)

![Screenshot 2024-05-13 at 18-04-13 My Forgejo.png](/attachments/dad00fc2-29fa-4371-a7b9-5233eadeac13)

## TODO

* [x] Add the possibility to add the `SLOGAN` config from the installation form
* [ ] Update https://forgejo.org/docs/next/admin/config-cheat-sheet

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3752
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: mirko <mirko.perillo@gmail.com>
Co-committed-by: mirko <mirko.perillo@gmail.com>
2024-06-07 17:12:48 +00:00
Earl Warren
dedcd6c647 Merge pull request 'Update module github.com/huandu/xstrings to v1.5.0' (#4050) from renovate/github.com-huandu-xstrings-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4050
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 16:48:16 +00:00
Earl Warren
0d69cda8bd
cleanup(services): xstrings v1.5.0 the CAMEL & PASCAL workarounds
Refs: https://codeberg.org/forgejo/forgejo/pulls/4050
2024-06-07 18:10:37 +02:00
Earl Warren
da948ae6bb Merge pull request 'Update github.com/google/pprof digest to 186aa03' (#4055) from renovate/github.com-google-pprof-digest into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4055
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 15:59:56 +00:00
Earl Warren
bdfdc6ced0 Merge pull request 'Update module golang.org/x/net to v0.26.0' (#4057) from renovate/golang.org-x-net-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4057
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 10:36:48 +00:00
Renovate Bot
5b82e43da5 Update module golang.org/x/net to v0.26.0 2024-06-07 10:03:08 +00:00
Earl Warren
3f0859658d Merge pull request 'Update module golang.org/x/oauth2 to v0.21.0' (#4058) from renovate/golang.org-x-oauth2-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4058
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 09:41:34 +00:00
Earl Warren
ed2c651429 Merge pull request 'Update module golang.org/x/image to v0.17.0' (#4056) from renovate/golang.org-x-image-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4056
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 09:07:46 +00:00
Earl Warren
e72f039c75 Merge pull request 'Update dependency go to v1.22.4' (#4054) from renovate/patch-golang-packages into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4054
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 08:57:59 +00:00
Renovate Bot
6fb5cef962 Update module golang.org/x/oauth2 to v0.21.0 2024-06-07 08:04:08 +00:00
Renovate Bot
c64afa1bfc Update module golang.org/x/image to v0.17.0 2024-06-07 08:03:51 +00:00
Renovate Bot
b4d8021ce0 Update github.com/google/pprof digest to 186aa03 2024-06-07 08:03:41 +00:00
Renovate Bot
28c9bd3f7e Update dependency go to v1.22.4 2024-06-07 08:03:30 +00:00
Earl Warren
52110aff44 Merge pull request 'Update module golang.org/x/crypto to v0.24.0' (#4051) from renovate/golang.org-x-crypto-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4051
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-06-07 05:59:04 +00:00
0ko
bd4ee91a19 Upgrade deadcode package to a new name (#4048)
We're stuck on an old version of golang deadcode. Renovate is confused by it's rename in https://codeberg.org/forgejo/forgejo/pulls/4043.

I don't remember how to use this tool to test it, let's see how the CI reacts to this PR.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4048
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2024-06-07 05:42:59 +00:00
Renovate Bot
e13972b9da Update module golang.org/x/crypto to v0.24.0 2024-06-07 02:05:07 +00:00
Renovate Bot
884eb07793 Update module github.com/huandu/xstrings to v1.5.0 2024-06-07 00:05:55 +00:00