Commit graph

19716 commits

Author SHA1 Message Date
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
Renovate Bot 4f4eedc175 Update dependency @github/text-expander-element to v2.7.1 2024-05-29 00:10:32 +00: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
0ko b6849b8e7d Merge pull request 'Port: Fix long branch name overflows (https://github.com/go-gitea/gitea/pull/30345)' (#3890) from 0ko/forgejo:fix-branch-overflow-2 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3890
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2024-05-27 04:24:41 +00:00
0ko b2eba34506 Unify usercards margins (#3915)
These are some slight design changes to how usercards are presented.

- `margin`: removed one of the sides so the margins are the same in both axis
- `margin`: increased from 10px to 15px
Previously it was (Y, X) = (20, 10); now it's (15, 15)
 - `width`: slightly decreased so that the point, where too small screen width causes card relocation to another row, doesn't increase
- `padding`: this change does nothing visually. `padding-bottom` was useless because padding was already set for all sides by another rule `.ui.segment {padding: 1em};`. This change just ensures that padding stays the same for all sides even if `.ui.segment` changes, instead of causing inconsistency
- `margin-bottom`: added as an override to margin caused by `display: flex`. From my research, usually there's `25px` gap between the content and the pagination. It was `39px` here, now it's `25px` too

### Before

![image](/attachments/0ebf6f44-6b27-4d4d-8856-77568291518c)

### After

![image](/attachments/1e0a3d95-ac49-4d10-8e00-86cc041d4338)

I can't show the distance between the content and the pagination, but the change does work when applying via devtools on https://codeberg.org/forgejo/forgejo/stars.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3915
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
Reviewed-by: Caesar Schinas <caesar@caesarschinas.com>
2024-05-27 04:22:48 +00:00
Renovate Bot 23a991a0b4 Update dependency updates to v16.1.1 2024-05-27 00:04:27 +00:00
Renovate Bot 319acec27c Update dependency markdownlint-cli to v0.41.0 2024-05-27 00:04:18 +00:00
Earl Warren 4a9dd87496 Merge pull request 'fix(release): golang:1.22-alpine3.20 does not have all architectures' (#3918) from earl-warren/forgejo:wip-alpine into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3918
Reviewed-by: thefox <thefox@noreply.codeberg.org>
2024-05-26 20:24:52 +00:00
Earl Warren d59ed64345
fix(release): golang:1.22-alpine3.20 does not have all architectures
It was premature to try to use them, try again later.

https://codeberg.org/forgejo-integration/forgejo/actions/runs/2147

github.com/docker/buildx v0.14.1 59582a88fca7858dbe1886fd1556b2a0d79e43a3
::endgroup::
[command]/usr/bin/docker buildx build --build-arg RELEASE_VERSION=8.0-test --file Dockerfile --iidfile /tmp/docker-actions-toolkit-UzuWxS/iidfile --platform linux/amd64,linux/arm64,linux/arm/v6 --tag codeberg.org/***/forgejo:8.0-test --metadata-file /tmp/docker-actions-toolkit-UzuWxS/metadata-file --push .
------
 > [linux/arm/v6 internal] load metadata for code.forgejo.org/oci/golang:1.22-alpine3.20:
------
Dockerfile:3
--------------------
   1 |     FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
   2 |
   3 | >>> FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
   4 |
   5 |     ARG GOPROXY
--------------------
Dockerfile:1
--------------------
   1 | >>> FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
   2 |
   3 |     FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
--------------------
Dockerfile:54
--------------------
  52 |     RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
  53 |
  54 | >>> FROM code.forgejo.org/oci/golang:1.22-alpine3.20
  55 |     ARG RELEASE_VERSION
  56 |     LABEL maintainer="contact@forgejo.org" \
--------------------
ERROR: failed to solve: code.forgejo.org/oci/golang:1.22-alpine3.20: failed to resolve source metadata for code.forgejo.org/oci/golang:1.22-alpine3.20: no match for platform in manifest: not found
::error::buildx failed with: ERROR: failed to solve: code.forgejo.org/oci/golang:1.22-alpine3.20: failed to resolve source metadata for code.forgejo.org/oci/golang:1.22-alpine3.20: no match for platform in manifest: not found
2024-05-26 21:51:57 +02:00
Zettat123 df15abd072
Support setting the default attribute of the issue template dropdown field (#31045)
Fix #31044

According to [GitHub issue template
documentation](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-for-dropdown),
the `default` attribute can be used to specify the preselected option
for a dropdown field.

(cherry picked from commit 7ab0988af140aa3e0204979765f75961f1dc9c11)
2024-05-26 20:13:09 +02:00
Kemal Zebari d6e454c320
Sync up deleted branches & action assets related cleanup documentation (#31022)
Syncs up docs associated to actions and deleted branch cleanup i.e. in
custom/app.example.ini and the config cheat sheet.

(cherry picked from commit c9eac519961ecd5d0e1d6ee856ab532e8c16c65d)

Conflicts:
	docs/content/administration/config-cheat-sheet.en-us.md
	docs do not exist here in Forgejo
2024-05-26 20:09:01 +02:00
6543 2717d7bdad
Add nix flake for dev shell (#30967)
To try it you need **nix** installed `nix-daemon ` running and your user
has to be member of the **nix-users** group. Or use NixOS.

then by just:
```sh
nix develop -c $SHELL
```
a dedicated development environment with all needed packages will be
created.

(cherry picked from commit de6f0488a67ad65bd2ac40356b08a78a365414cd)
2024-05-26 20:08:07 +02:00
Denys Konovalov 07fe5a8b13
use existing oauth grant for public client (#31015)
Do not try to create a new authorization grant when one exists already,
thus preventing a DB-related authorization issue.

Fix https://github.com/go-gitea/gitea/pull/30790#issuecomment-2118812426

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 9c8c9ff6d10b35de8d2d7eae0fc2646ad9bbe94a)
2024-05-26 19:02:48 +02:00
Lunny Xiao 7d7ea45465
Fix automerge will not work because of some events haven't been triggered (#30780)
Replace #25741
Close #24445
Close #30658
Close #20646
~Depends on #30805~

Since #25741 has been rewritten totally, to make the contribution
easier, I will continue the work in this PR. Thanks @6543

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit c6cf96d31d80ab79d370a6192fd761b4443daec2)

Conflicts:
	tests/integration/editor_test.go
	trivial context conflict because of 75ce1e2ac1 [GITEA] Allow user to select email for file operations in Web UI
	tests/integration/pull_merge_test.go
	trivial context conflicts in imports because more tests were added in Forgejo
2024-05-26 19:01:36 +02:00
Kemal Zebari 0e0ab349fb
Don't include link of deleted branch when listing branches (#31028)
From
https://github.com/go-gitea/gitea/issues/31018#issuecomment-2119622680.

This commit removes the link to a deleted branch name because it returns
a 404 while it is in this deleted state. GitHub also throws a 404 when
navigating to a branch link that was just deleted, but this deleted
branch is removed from the branch list after a page refresh. Since with
Gitea this deleted branch would be kept around for quite some time
(well, until the "cleanup deleted branches" cron job begins), it makes
sense to not have this as a link that users can navigate to.

(cherry picked from commit 1007ce764ea80b48120b796175d7d1210cbb6f74)
2024-05-26 18:45:23 +02:00
wxiaoguang 5612cf32e5
Refactor sha1 and time-limited code (#31023)
Remove "EncodeSha1", it shouldn't be used as a general purpose hasher
(just like we have removed "EncodeMD5" in #28622)

Rewrite the "time-limited code" related code and write better tests, the
old code doesn't seem quite right.

(cherry picked from commit fb1ad920b769799aa1287441289d15477d9878c5)

Conflicts:
	modules/git/utils_test.go
	trivial context conflict because sha256 testing in Forgejo has diverged
2024-05-26 18:43:30 +02:00
Zettat123 886a675f62
Return access_denied error when an OAuth2 request is denied (#30974)
According to [RFC
6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1),
when the resource owner or authorization server denied an request, an
`access_denied` error should be returned. But currently in this case
Gitea does not return any error.

For example, if the user clicks "Cancel" here, an `access_denied` error
should be returned.

<img width="360px"
src="https://github.com/go-gitea/gitea/assets/15528715/be31c09b-4c0a-4701-b7a4-f54b8fe3a6c5"
/>

(cherry picked from commit f1d9f18d96050d89a4085c961f572f07b1e653d1)
2024-05-26 18:37:20 +02:00
wxiaoguang f6e50abd65
Fix data-race during testing (#30999)
Fix #30992

(cherry picked from commit 47accfebbd69e5f47d1b97a3e39cf181fab7e597)

Conflicts:
	models/unit/unit.go
	trivial context conflict because of
	e07b0e75ff Add a direct link from repo header to unit settings
2024-05-26 18:28:26 +02:00
wxiaoguang a649610d61
Fix "force private" logic (#31012)
When creating a repo, the "FORCE_PRIVATE" config option should be
respected, `readonly` doesn't work for checkbox, so it should use
`disabled` attribute.

(cherry picked from commit edbf74c418061b013a5855f604dd6be6baf34132)

Conflicts:
	templates/repo/create.tmpl
	templates/repo/migrate/codebase.tmpl
	templates/repo/migrate/git.tmpl
	templates/repo/migrate/gitbucket.tmpl
	templates/repo/migrate/gitea.tmpl
	templates/repo/migrate/github.tmpl
	templates/repo/migrate/gitlab.tmpl
	templates/repo/migrate/gogs.tmpl
	templates/repo/migrate/onedev.tmpl
	already in forgejo fc0c5e80da Fix and improve repo visibility checkbox when FORCE_PRIVATE is on (#3786)
        enforcing FORCE_PRIVATE on repo settings was manually tested
	with a repository of an unprivileged user after setting
	FORCE_PRIVATE = true
2024-05-26 18:20:33 +02:00
GiteaBot 4d30a49031
[skip ci] Updated licenses and gitignores
(cherry picked from commit 82a0c36332824b8ab41efdf6503e86170ce92f08)
2024-05-26 17:59:46 +02:00
Earl Warren f2204d81f1 Merge pull request 'tests(web): verify compressed files are not re-compressed' (#3909) from earl-warren/forgejo:wip-skip-gzip into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3909
Reviewed-by: Victoria <efertone@noreply.codeberg.org>
2024-05-26 11:12:05 +00:00
0ko c3ffa30e7a [I18N] Fixes and improvements to English locale (#3912)
Mostly cap fixes and a few improvements.

As for `activity.active_prs_count_`, it currently looks like this in the UI, I fixed it:
![image](/attachments/5d2dc089-519e-4655-8f8b-f78964ff179a)

Although I'm also the person who [introduced](4c1af0d9a6) the inconsistency.

`send_reset_mail` is a button, removed redundant word from it. It would be good to refactor such keys, but it will be an impossibly long process. Anyway, key refactors are done in separate PRs for easier merges.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3912
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-26 11:06:28 +00:00
Earl Warren 8790ce1890 Merge pull request 'Delete .changelog.yml' (#3913) from 0ko/forgejo:_.changelog.yml into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3913
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-26 10:50:36 +00:00
0ko b4c7cf6099 Delete .changelog.yml 2024-05-26 09:49:38 +05:00
Earl Warren a05eb66c99
tests(web): verify compressed files are not re-compressed
the test file used has a size below the default threshold and will
never be compressed because of that, regardless of its extension. Reduce
the threshold to 10 bytes otherwise the test is a false positive.
2024-05-25 23:54:28 +02:00
Codeberg Translate 0281af75f4 [I18N] Translations update from Weblate (#3851)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: Wuzzy <Wuzzy@users.noreply.translate.codeberg.org>
Co-authored-by: Anonymous <anonymous@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: emansije <emansije@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Kaede Fujisaki <ledyba@users.noreply.translate.codeberg.org>
Co-authored-by: NameLessGO <NameLessGO@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3851
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-05-25 18:32:20 +00:00
Earl Warren bd32dedb48 Merge pull request 'fix(services): set SendNotificationEmailOnNewUser' (#3904) from earl-warren/forgejo:wip-new-user-notify into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3904
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-05-25 15:11:16 +00:00
Earl Warren ff2a3f4e3a
fix(services): set SendNotificationEmailOnNewUser
regression from 767e9634d3. It changed
the parsing of the [admin] section from being derived from the content
of each key with mustMapSetting(rootCfg, "admin", &Admin) to
explicitly listing all keys in the code.

SEND_NOTIFICATION_EMAIL_ON_NEW_USER was not added and therefore
ignored. As a consequence notifications of newly registered users were
never sent.
2024-05-25 16:27:44 +02:00