]> source.dussan.org Git - gitea.git/log
gitea.git
10 months agoFix Docker meta action for releases (#28232)
John Olheiser [Thu, 7 Dec 2023 17:42:58 +0000 (11:42 -0600)]
Fix Docker meta action for releases (#28232)

Should fix #28229 and #28230 for next release.

Assuming I'm reading the docs correctly for the docker meta action:

https://github.com/docker/metadata-action#flavor-input
https://github.com/docker/metadata-action#latest-tag

1. We want `latest=false` for the RCs.
2. `latest` should happen already due to `auto` mode, however there's an
extra option for the `suffix` flavor.

This PR is ready, but leaving it as draft to make sure someone
double-checks my sleuth-work.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
10 months agoMake gogit Repository.GetBranchNames consistent (#28348)
Adam Majer [Thu, 7 Dec 2023 17:08:17 +0000 (17:08 +0000)]
Make gogit Repository.GetBranchNames consistent (#28348)

10 months agoRemove GetByBean method because sometimes it's danger when query condition parameter...
Lunny Xiao [Thu, 7 Dec 2023 07:27:36 +0000 (15:27 +0800)]
Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220)

The function `GetByBean` has an obvious defect that when the fields are
empty values, it will be ignored. Then users will get a wrong result
which is possibly used to make a security problem.

To avoid the possibility, this PR removed function `GetByBean` and all
references.
And some new generic functions have been introduced to be used.

The recommand usage like below.

```go
// if query an object according id
obj, err := db.GetByID[Object](ctx, id)
// query with other conditions
obj, err := db.Get[Object](ctx, builder.Eq{"a": a, "b":b})
```

10 months agoInclude public repos in doer's dashboard for issue search (#28304)
Jason Song [Thu, 7 Dec 2023 05:26:18 +0000 (13:26 +0800)]
Include public repos in doer's dashboard for issue search (#28304)

It will fix #28268 .

<img width="1313" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/cb1e07d5-7a12-4691-a054-8278ba255bfc">

<img width="1318" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/4fd60820-97f1-4c2c-a233-d3671a5039e9">

## :warning: BREAKING :warning:

But need to give up some features:

<img width="1312" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/281c0d51-0e7d-473f-bbed-216e2f645610">

However, such abandonment may fix #28055 .

## Backgroud

When the user switches the dashboard context to an org, it means they
want to search issues in the repos that belong to the org. However, when
they switch to themselves, it means all repos they can access because
they may have created an issue in a public repo that they don't own.

<img width="286" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/182dcd5b-1c20-4725-93af-96e8dfae5b97">

It's a confusing design. Think about this: What does "In your
repositories" mean when the user switches to an org? Repos belong to the
user or the org?

Whatever, it has been broken by #26012 and its following PRs. After the
PR, it searches for issues in repos that the dashboard context user owns
or has been explicitly granted access to, so it causes #28268.

## How to fix it

It's not really difficult to fix it. Just extend the repo scope to
search issues when the dashboard context user is the doer. Since the
user may create issues or be mentioned in any public repo, we can just
set `AllPublic` to true, which is already supported by indexers. The DB
condition will also support it in this PR.

But the real difficulty is how to count the search results grouped by
repos. It's something like "search issues with this keyword and those
filters, and return the total number and the top results. **Then, group
all of them by repo and return the counts of each group.**"

<img width="314" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/5206eb20-f8f5-49b9-b45a-1be2fcf679f4">

Before #26012, it was being done in the DB, but it caused the results to
be incomplete (see the description of #26012).

And to keep this, #26012 implement it in an inefficient way, just count
the issues by repo one by one, so it cannot work when `AllPublic` is
true because it's almost impossible to do this for all public repos.

https://github.com/go-gitea/gitea/blob/1bfcdeef4cca0f5509476358e5931c13d37ed1ca/modules/indexer/issues/indexer.go#L318-L338

## Give up unnecessary features

We may can resovle `TODO: use "group by" of the indexer engines to
implement it`, I'm sure it can be done with Elasticsearch, but IIRC,
Bleve and Meilisearch don't support "group by".

And the real question is, does it worth it? Why should we need to know
the counts grouped by repos?

Let me show you my search dashboard on gitea.com.

<img width="1304" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2bca2d46-6c71-4de1-94cb-0c9af27c62ff">

I never think the long repo list helps anything.

And if we agree to abandon it, things will be much easier. That is this
PR.

## TODO

I know it's important to filter by repos when searching issues. However,
it shouldn't be the way we have it now. It could be implemented like
this.

<img width="1316" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/99ee5f21-cbb5-4dfe-914d-cb796cb79fbe">

The indexers support it well now, but it requires some frontend work,
which I'm not good at. So, I think someone could help do that in another
PR and merge this one to fix the bug first.

Or please block this PR and help to complete it.

Finally, "Switch dashboard context" is also a design that needs
improvement. In my opinion, it can be accomplished by adding filtering
conditions instead of "switching".

10 months agoIssue fixes for RSS feed improvements (#28380)
Panagiotis "Ivory" Vasilopoulos [Thu, 7 Dec 2023 03:01:32 +0000 (03:01 +0000)]
Issue fixes for RSS feed improvements (#28380)

Follow-up for #28368

- Just replace button with an a-element with the button class
- Remove useless link-action class from template/org/home.tmpl

10 months agoFix margin in server signed signature verification view (#28379)
Lauris BH [Thu, 7 Dec 2023 01:51:39 +0000 (03:51 +0200)]
Fix margin in server signed signature verification view (#28379)

Before:

![image](https://github.com/go-gitea/gitea/assets/165205/e2e2256d-03c5-4ab8-8ed9-08ef68571a43)

After:

![image](https://github.com/go-gitea/gitea/assets/165205/804132ef-18f9-4ab8-949d-f6c71e7f4d24)

10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 7 Dec 2023 00:24:32 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoFix incorrect run order of action jobs (#28367)
yp05327 [Wed, 6 Dec 2023 22:10:05 +0000 (07:10 +0900)]
Fix incorrect run order of action jobs (#28367)

When we pick up a job, all waiting jobs should firstly be ordered by
update time,
otherwise when there's a running job, if I rerun an older job, the older
job will run first, as it's id is smaller.

10 months agoImprove RSS feed icons (#28368)
Panagiotis "Ivory" Vasilopoulos [Wed, 6 Dec 2023 20:29:26 +0000 (20:29 +0000)]
Improve RSS feed icons (#28368)

- The RSS Feed icons were placed in a proper button, so that it does
  not look "inconsistent". This also makes the problem of the button
  being improperly aligned go away.
- The icon that shows on user profiles has not been modified because
  of a lack of better implementation ideas.
- Where applicable, the RSS Feed icon was put directly next to the
  Follow button (right menu), as both functionalities effectively
  share the same purpose.
- Despite the attempt at achieving less inconsistency, a conscious
  decision to not add any text to those buttons was made, opting for
  tooltips instead. "Make it present, but not too annoying."
- A special exception was made for the Releases pages (which contains
  text, not a tooltip), where an RSS feed would be particularly
  beneficial to users.

The fact that the RSS functionality is explicitly optional was taken
into account, and these improvements were made with public-facing
instances (where the feature works best) in mind.

10 months agoUse `filepath` instead of `path` to create SQLite3 database file (#28374)
wxiaoguang [Wed, 6 Dec 2023 16:57:52 +0000 (00:57 +0800)]
Use `filepath` instead of `path` to create SQLite3 database file (#28374)

10 months agoFix incorrect default value of `[attachment].MAX_SIZE` (#28373)
capvor [Wed, 6 Dec 2023 15:59:56 +0000 (23:59 +0800)]
Fix incorrect default value of `[attachment].MAX_SIZE` (#28373)

10 months agoFix object does not exist error when checking citation file (#28314)
yp05327 [Wed, 6 Dec 2023 08:51:01 +0000 (17:51 +0900)]
Fix object does not exist error when checking citation file (#28314)

Fix #28264

`DataAsync()` will be called twice.
Caused by https://github.com/go-gitea/gitea/pull/27958.
I'm sorry, I didn't completely remove all unnecessary codes.

10 months agoFix the runs will not be displayed bug when the main branch have no workflows but...
Lunny Xiao [Wed, 6 Dec 2023 01:13:59 +0000 (09:13 +0800)]
Fix the runs will not be displayed bug when the main branch have no workflows but other branches have (#28359)

10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 6 Dec 2023 00:25:02 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoRender PyPi long description as document (#28272)
Earl Warren [Tue, 5 Dec 2023 15:02:01 +0000 (16:02 +0100)]
Render PyPi long description as document (#28272)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agohandle repository.size column being NULL in migration v263 (#28336)
Nate Levesque [Tue, 5 Dec 2023 14:31:13 +0000 (09:31 -0500)]
handle repository.size column being NULL in migration v263 (#28336)

This resolves a problem I encountered while updating gitea from 1.20.4
to 1.21. For some reason (correct or otherwise) there are some values in
`repository.size` that are NULL in my gitea database which cause this
migration to fail due to the NOT NULL constraints.

Log snippet (excuse the escape characters)
```
ESC[36mgitea                |ESC[0m 2023-12-04T03:52:28.573122395Z 2023/12/04 03:52:28 ...ations/migrations.go:641:Migrate() [I] Migration[263]: Add git_size and lfs_size columns to repository table
ESC[36mgitea                |ESC[0m 2023-12-04T03:52:28.608705544Z 2023/12/04 03:52:28 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #3/10 failed. Error: migrate: migration[263]: Add git_size and lfs_size columns to repository table failed: NOT NULL constraint failed: repository.git_size
```

I assume this should be reasonably safe since `repository.git_size` has
a default value of 0 but I don't know if that value being 0 in the odd
situation where `repository.size == NULL` has any problematic
consequences.

10 months agoFix migration panic due to an empty review comment diff (#28334)
Nanguan Lin [Tue, 5 Dec 2023 08:29:43 +0000 (16:29 +0800)]
Fix migration panic due to an empty review comment diff (#28334)

Fix #28328
```
func (p *PullRequestComment) GetDiffHunk() string {
if p == nil || p.DiffHunk == nil {
return ""
}
return *p.DiffHunk
}
```
This function in the package `go-github` may return an empty diff. When
it's empty, the following code will panic because it access `ss[1]`

https://github.com/go-gitea/gitea/blob/ec1feedbf582b05b6a5e8c59fb2457f25d053ba2/services/migrations/gitea_uploader.go#L861-L867

https://github.com/go-gitea/gitea/blob/ec1feedbf582b05b6a5e8c59fb2457f25d053ba2/modules/git/diff.go#L97-L101

10 months agoAdd `HEAD` support for rpm repo files (#28309)
KN4CK3R [Tue, 5 Dec 2023 08:01:02 +0000 (09:01 +0100)]
Add `HEAD` support for rpm repo files (#28309)

Fixes https://codeberg.org/forgejo/forgejo/issues/1810

zypper uses HEAD requests to check file existence.

https://github.com/openSUSE/libzypp/blob/HEAD/zypp/RepoManager.cc#L2549

https://github.com/openSUSE/libzypp/blob/HEAD/zypp-curl/ng/network/private/downloaderstates/basicdownloader_p.cc#L116

@ExplodingDragon fyi

10 months agoRemove deprecated query condition in ListReleases (#28339)
Nanguan Lin [Tue, 5 Dec 2023 07:30:43 +0000 (15:30 +0800)]
Remove deprecated query condition in ListReleases (#28339)

close #24057
call stack:

https://github.com/go-gitea/gitea/blob/25faee3c5f5be23c99b3b7e50418fc0dbad7a41b/routers/api/v1/repo/release.go#L154

https://github.com/go-gitea/gitea/blob/ec1feedbf582b05b6a5e8c59fb2457f25d053ba2/routers/api/v1/utils/page.go#L13-L18

https://github.com/go-gitea/gitea/blob/ec1feedbf582b05b6a5e8c59fb2457f25d053ba2/services/convert/utils.go#L15-L22

## :warning: Breaking   :warning: (though it's not caused by this PR)
Do not use `per_page` to specify pagination; use `limit` instead

10 months agoConvert git commit summary to valid UTF8. (#28356)
darrinsmart [Tue, 5 Dec 2023 06:34:24 +0000 (22:34 -0800)]
Convert git commit summary to valid UTF8. (#28356)

The summary string ends up in the database, and (at least) MySQL &
PostgreSQL require valid UTF8 strings.

Fixes #28178

Co-authored-by: Darrin Smart <darrin@filmlight.ltd.uk>
10 months agoFix RPM/Debian signature key creation (#28352)
KN4CK3R [Tue, 5 Dec 2023 00:48:01 +0000 (01:48 +0100)]
Fix RPM/Debian signature key creation (#28352)

Fixes #28324

The name parameter can't contain some characters
(https://github.com/keybase/go-crypto/blob/master/openpgp/keys.go#L680)
but is optional. Therefore just use an empty string.

10 months agoRefactor template empty checks (#28351)
KN4CK3R [Mon, 4 Dec 2023 21:48:42 +0000 (22:48 +0100)]
Refactor template empty checks (#28351)

10 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 4 Dec 2023 00:25:15 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

10 months agoFix missing issue search index update when changing status (#28325)
Brecht Van Lommel [Sun, 3 Dec 2023 11:22:44 +0000 (12:22 +0100)]
Fix missing issue search index update when changing status (#28325)

Changing an issue status, assignee, labels or milestone without also
adding a comment would not update the index, resulting in wrong search
results.

10 months agoKeep profile tab when clicking on Language (#28320)
JakobDev [Fri, 1 Dec 2023 20:31:40 +0000 (21:31 +0100)]
Keep profile tab when clicking on Language (#28320)

Fixes https://codeberg.org/Codeberg/Community/issues/1355

10 months agoFix wrong link in `protect_branch_name_pattern_desc` (#28313)
yp05327 [Fri, 1 Dec 2023 11:45:04 +0000 (20:45 +0900)]
Fix wrong link in `protect_branch_name_pattern_desc` (#28313)

The current href will link to
`https://domain/owner/repo/settings/branches/github.com/gobwas/glob`

10 months agoFix links in docs (#28302)
yp05327 [Fri, 1 Dec 2023 11:42:42 +0000 (20:42 +0900)]
Fix links in docs (#28302)

Close #28287

## How to test it in local
convert Makefile L34 into:
```
cd .tmp/upstream-docs && git clean -f && git reset --hard && git fetch origin pull/28302/head:pr28302 && git switch pr28302
```

10 months agoRead `previous` info from git blame (#28306)
KN4CK3R [Fri, 1 Dec 2023 01:26:52 +0000 (02:26 +0100)]
Read `previous` info from git blame (#28306)

Fixes #28280

Reads the `previous` info from the `git blame` output instead of
calculating it afterwards.

10 months agoAdd missing variable in tag list (#28305)
JakobDev [Thu, 30 Nov 2023 15:26:56 +0000 (16:26 +0100)]
Add missing variable in tag list (#28305)

This fixes a regression from #25859

If a tag has no Release, Gitea will show a Link to create a Release for
the Tag if the User has the Permission to do this, but the variable to
indicate that is no longer set.

Used here:

https://github.com/go-gitea/gitea/blob/1bfcdeef4cca0f5509476358e5931c13d37ed1ca/templates/repo/tag/list.tmpl#L39-L41

10 months agoMake pushUpdate error verbose (#28263)
Earl Warren [Thu, 30 Nov 2023 00:46:51 +0000 (01:46 +0100)]
Make pushUpdate error verbose (#28263)

- Push commits updates are run in a queue and updates can come from less
traceable places such as Git over SSH, therefor add more information
about on which repository the pushUpdate failed.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1723

(cherry picked from commit 37ab9460394800678d2208fed718e719d7a5d96f)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoMeilisearch: require all query terms to be matched (#28293)
Brecht Van Lommel [Wed, 29 Nov 2023 15:00:59 +0000 (16:00 +0100)]
Meilisearch: require all query terms to be matched (#28293)

Previously only the first term had to be matched. That default
Meilisearch behavior makes sense for e.g. some kind of autocomplete to
find and select a single result. But for filtering issues it means you
can't narrow down results by adding more terms.

This is also more consistent with other indexers and GitHub.

---

Reference:
https://www.meilisearch.com/docs/reference/api/search#matching-strategy

10 months agoIgnore "non-existing" errors when getDirectorySize calculates the size (#28276)
wxiaoguang [Wed, 29 Nov 2023 05:08:58 +0000 (13:08 +0800)]
Ignore "non-existing" errors when getDirectorySize calculates the size (#28276)

The git command may operate the git directory (add/remove) files in any
time.

So when the code iterates the directory, some files may disappear during
the "walk". All "IsNotExist" errors should be ignored.

Fix #26765

10 months agoFix required error for token name (#28267)
Earl Warren [Wed, 29 Nov 2023 03:47:05 +0000 (04:47 +0100)]
Fix required error for token name (#28267)

- Say to the binding middleware which locale should be used for the
required error.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1683

(cherry picked from commit 5a2d7966127b5639332038e9925d858ab54fc360)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoUse appSubUrl for OAuth2 callback URL tip (#28266)
Earl Warren [Wed, 29 Nov 2023 01:37:12 +0000 (02:37 +0100)]
Use appSubUrl for OAuth2 callback URL tip (#28266)

- When crafting the OAuth2 callbackURL take into account `appSubUrl`,
which is quite safe given that its strictly formatted.
- No integration testing as this is all done in Javascript.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1795

(cherry picked from commit 27cb6b7956136f87aa78067d9adb5a4c4ce28a24)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoIgnore temporary files for directory size (#28265)
Earl Warren [Tue, 28 Nov 2023 21:53:21 +0000 (22:53 +0100)]
Ignore temporary files for directory size (#28265)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoCheck for v prefix on tags for release clean name (#28257)
John Olheiser [Tue, 28 Nov 2023 21:18:01 +0000 (15:18 -0600)]
Check for v prefix on tags for release clean name (#28257)

10 months agoUse full width for project boards (#28225)
Denys Konovalov [Mon, 27 Nov 2023 17:43:52 +0000 (18:43 +0100)]
Use full width for project boards (#28225)

Inspired by #28182

10 months agoIncrease "version" when update the setting value to a same value as before (#28243)
wxiaoguang [Mon, 27 Nov 2023 17:15:40 +0000 (01:15 +0800)]
Increase "version" when update the setting value to a same value as before (#28243)

Setting the same value should not trigger DuplicateKey error, and the
"version" should be increased

10 months agoFix issue will be detected as pull request when checking `First-time contributor...
yp05327 [Mon, 27 Nov 2023 10:46:55 +0000 (19:46 +0900)]
Fix issue will be detected as pull request when checking `First-time contributor` (#28237)

Fix #28224

10 months agoFix link to `Code` tab on wiki commits (#28041)
JakobDev [Mon, 27 Nov 2023 05:59:56 +0000 (06:59 +0100)]
Fix link to `Code` tab on wiki commits (#28041)

Fixes https://codeberg.org/forgejo/forgejo/issues/1759

If you are bowing another branch than the default branch and click n the
Code tab, it will take you to the root of the branch. The `BranchName`
variable is also set when viewing a Wiki commit, so we also need to
check if we are on a Wiki.

10 months agoFix links in docs (#28234)
yp05327 [Mon, 27 Nov 2023 05:34:40 +0000 (14:34 +0900)]
Fix links in docs (#28234)

Follow #28191

Changes:
- `(doc/administration/config-cheat-sheet.md` is incorrect:

![image](https://github.com/go-gitea/gitea/assets/18380374/1c417dd7-61a0-49ba-8d50-871fd4c9bf20)
- remove `../../`

10 months agoFix actions when tagging (#28061)
Lunny Xiao [Sat, 25 Nov 2023 18:45:31 +0000 (02:45 +0800)]
Fix actions when tagging (#28061)

close https://github.com/go-gitea/gitea/issues/28053

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
10 months agoFix comment permissions (#28213)
Lunny Xiao [Sat, 25 Nov 2023 17:21:21 +0000 (01:21 +0800)]
Fix comment permissions (#28213)

This PR will fix some missed checks for private repositories' data on
web routes and API routes.

10 months agoDocs: Replace deprecated IS_TLS_ENABLED mailer setting in email setup (#28205)
CodeShakingSheep [Sat, 25 Nov 2023 02:16:29 +0000 (03:16 +0100)]
Docs: Replace deprecated IS_TLS_ENABLED mailer setting in email setup (#28205)

In the [docs for email
setup](https://docs.gitea.com/administration/email-setup)
`mailer.IS_TLS_ENABLED` is mentioned which was replaced by
`mailer.PROTOCOL` in release 1.18.0 according to
https://blog.gitea.com/release-of-1.18.0/ . This change wasn't reflected
in the docs for email setup. I just replaced the deprecated mailer
setting.

10 months agoFix delete-orphaned-repos (#28200)
pitpalme [Fri, 24 Nov 2023 14:46:19 +0000 (15:46 +0100)]
Fix delete-orphaned-repos (#28200)

gitea doctor failed at checking and fixing 'delete-orphaned-repos',
because table name 'user' needs quoting to be correctly recognized by at
least PostgreSQL.

fixes #28199

10 months agoRefactor graceful manager to use shared code (#28073)
wxiaoguang [Fri, 24 Nov 2023 14:21:46 +0000 (22:21 +0800)]
Refactor graceful manager to use shared code (#28073)

Make "windows" and "unix" share as much code as possible. No logic
change.

10 months agoFix some incorrect links in docs (#28191)
yp05327 [Fri, 24 Nov 2023 13:57:09 +0000 (22:57 +0900)]
Fix some incorrect links in docs (#28191)

https://gitea.com/gitea/gitea-docusaurus/actions/runs/661/jobs/0#jobstep-9-39
I noticed that there are many warning logs in building docs.
It is causing 404 in docs.gitea.com now, so we need to fix it.
And there are also some other problems in v1.19 which can not be done in
this PR.

ps: Are there any good methods to test this in local?

10 months agoRemove workaround in disk-clean.yml (#28195)
Nanguan Lin [Fri, 24 Nov 2023 12:25:01 +0000 (20:25 +0800)]
Remove workaround in disk-clean.yml (#28195)

According to https://github.com/jlumbroso/free-disk-space/issues/17, the
issue has been fixed in the main branch.

10 months agoUse db.Find instead of writing methods for every object (#28084)
Lunny Xiao [Fri, 24 Nov 2023 03:49:41 +0000 (11:49 +0800)]
Use db.Find instead of writing methods for every object (#28084)

For those simple objects, it's unnecessary to write the find and count
methods again and again.

10 months agoEdit Discord Badge (#28188)
NintenHero [Fri, 24 Nov 2023 00:58:12 +0000 (20:58 -0400)]
Edit Discord Badge (#28188)

Use white Discord icon. Label the badge as "Discord". Use the official
Discord logo's color value of 5865F2.

10 months agoUse restricted sanitizer for repository description (#28141)
Earl Warren [Thu, 23 Nov 2023 16:34:25 +0000 (17:34 +0100)]
Use restricted sanitizer for repository description (#28141)

- Currently the repository description uses the same sanitizer as a
normal markdown document. This means that element such as heading and
images are allowed and can be abused.
- Create a minimal restricted sanitizer for the repository description,
which only allows what the postprocessor currently allows, which are
links and emojis.
- Added unit testing.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1202
- Resolves https://codeberg.org/Codeberg/Community/issues/1122

(cherry picked from commit 631c87cc2347f0036a75dcd21e24429bbca28207)

Co-authored-by: Gusted <postmaster@gusted.xyz>
10 months agoUse full width for PR comparison (#28182)
Nanguan Lin [Thu, 23 Nov 2023 15:52:57 +0000 (23:52 +0800)]
Use full width for PR comparison (#28182)

Follow-up #22844
close #28142
Before

![ksnip_20231123-183906](https://github.com/go-gitea/gitea/assets/70063547/78428a22-b0a0-45f9-9458-7fd5ec73aa29)
After

![full](https://github.com/go-gitea/gitea/assets/70063547/047242cf-9d6c-4b3a-9f92-54102740c27e)

Co-authored-by: Giteabot <teabot@gitea.io>
10 months agoMake CORS work for oauth2 handlers (#28184)
wxiaoguang [Thu, 23 Nov 2023 13:19:26 +0000 (21:19 +0800)]
Make CORS work for oauth2 handlers (#28184)

Fix #25473

Although there was `m.Post("/login/oauth/access_token", CorsHandler()...`,
it never really worked, because it still lacks the "OPTIONS" handler.

10 months agoFix missing buttons (#28179)
Nanguan Lin [Thu, 23 Nov 2023 10:36:52 +0000 (18:36 +0800)]
Fix missing buttons (#28179)

fix #28173
regression #25948
That PR is supposed to only change the style but somehow delete a code
snippet. See the
diff(https://github.com/go-gitea/gitea/pull/25948/files#diff-7c36d66fe058f4ff9f2beaac73cf710dca45b350d0dd98daf806828a4745fe62L125-L129)
for details.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
10 months agoRevert "Fix EOL handling in web editor" (#28101)
Nanguan Lin [Wed, 22 Nov 2023 09:14:16 +0000 (17:14 +0800)]
Revert "Fix EOL handling in web editor" (#28101)

Reverts go-gitea/gitea#27141
close #28097

10 months agoFix swagger title (#28164)
yp05327 [Wed, 22 Nov 2023 08:09:19 +0000 (17:09 +0900)]
Fix swagger title (#28164)

![image](https://github.com/go-gitea/gitea/assets/18380374/380859b2-a643-42fd-b53e-78c93c05c826)
Don't know why there's a `.` behind. 🤔

10 months agoFix the description about the default setting for action in quick start document...
yp05327 [Wed, 22 Nov 2023 02:11:22 +0000 (11:11 +0900)]
Fix the description about the default setting for action in quick start document (#28160)

Since #27054, Actions are enabled by default. so we should also edit the
document. 😃

ps: I think this should be backport to 1.21.0.

10 months agoDo not display search box when there's no packages yet (#28146)
yp05327 [Tue, 21 Nov 2023 20:03:19 +0000 (05:03 +0900)]
Do not display search box when there's no packages yet (#28146)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/3012f544-7ff5-4ccb-ac80-ce24d50abe97)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/4084312a-9ac0-4103-8c93-ea178ae24493)

![image](https://github.com/go-gitea/gitea/assets/18380374/3c47d175-0735-476d-8979-da2bc0a4fc95)

![image](https://github.com/go-gitea/gitea/assets/18380374/033c6a81-d1f7-4426-8063-5793d0b47462)

10 months agoAdd guide page to actions when there's no workflows (#28145)
yp05327 [Tue, 21 Nov 2023 08:27:33 +0000 (17:27 +0900)]
Add guide page to actions when there's no workflows (#28145)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/599d40c1-9b8d-4189-9286-c9c36fb780dd)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/848a73d1-aaec-478f-93a7-adcc7ee18907)

10 months agoFix no ActionTaskOutput table waring (#28149)
yp05327 [Tue, 21 Nov 2023 08:02:51 +0000 (17:02 +0900)]
Fix no ActionTaskOutput table waring (#28149)

Reproduce:
- Create a new Gitea instance
- Register a runner
- Create a repo and add a workflow
- Check the log, you will see warnings:

![image](https://github.com/go-gitea/gitea/assets/18380374/5f1278e0-114b-48bc-8113-8ba1404d9975)
It comes from:

![image](https://github.com/go-gitea/gitea/assets/18380374/c2807831-e137-4229-9536-87f6114c8a5b)

The reason is that we forgot registering `ActionTaskOutput` model.
So `action_table_output` table will be missing in your db.

10 months agoFix empty action run title (#28113)
Lunny Xiao [Tue, 21 Nov 2023 03:00:59 +0000 (11:00 +0800)]
Fix empty action run title (#28113)

Fix #27901

10 months agoUse "is-loading" to avoid duplicate form submit for code comment (#28143)
wxiaoguang [Tue, 21 Nov 2023 02:12:31 +0000 (10:12 +0800)]
Use "is-loading" to avoid duplicate form submit for code comment (#28143)

When the form is going to be submitted, add the "is-loading" class to
show an indicator and avoid user UI events.

When the request finishes (success / error), remove the "is-loading"
class to make user can interact the UI.

10 months agoFix typo in `packages.cleanup.success` (#28133)
Jason Song [Mon, 20 Nov 2023 13:41:10 +0000 (21:41 +0800)]
Fix typo in `packages.cleanup.success` (#28133)

Follow
https://github.com/go-gitea/gitea/pull/28129#discussion_r1398971596

10 months agoAdd edit option for README.md (#28071)
JakobDev [Mon, 20 Nov 2023 11:47:55 +0000 (12:47 +0100)]
Add edit option for README.md (#28071)

Fix #28059

![grafik](https://github.com/go-gitea/gitea/assets/15185051/07adc216-954e-486b-bfda-df3bc15f2089)

10 months agoRemove autofocus in search box (#28033)
yp05327 [Mon, 20 Nov 2023 08:57:46 +0000 (17:57 +0900)]
Remove autofocus in search box (#28033)

Mentioned here:
https://github.com/go-gitea/gitea/pull/27982#issuecomment-1807923026

10 months agoAdd missing `packages.cleanup.success` (#28129)
Jason Song [Mon, 20 Nov 2023 08:33:58 +0000 (16:33 +0800)]
Add missing `packages.cleanup.success` (#28129)

Used at
https://github.com/go-gitea/gitea/blob/a3348bfc4d565328f3608b1ee555f61be9fce1c3/routers/web/admin/packages.go#L111

<img width="1325" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/60edc1fa-eea8-4d74-a7ec-96bd5461a53f">

10 months agoUpdate docs for docusaurus v3 (#28125)
John Olheiser [Mon, 20 Nov 2023 05:25:47 +0000 (23:25 -0600)]
Update docs for docusaurus v3 (#28125)

Updates the docs for usage with docusaurus v3

Signed-off-by: jolheiser <john.olheiser@gmail.com>
10 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 20 Nov 2023 00:25:03 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

10 months agoUpdate JS and PY dependencies (#28120)
silverwind [Mon, 20 Nov 2023 00:02:57 +0000 (01:02 +0100)]
Update JS and PY dependencies (#28120)

- Update all JS and PY dependencies minus `@mcaptcha/vanilla-glue`
- Adapt to eslint rule rename
- Regenerate all SVGs because of [new
optimizations](https://github.com/svg/svgo/releases/tag/v3.0.4) from
svgo.
- Tested mentions, mermaid, vue, api docs

10 months agoDecrease issue font size in project template (#28054)
KazzmanK [Sun, 19 Nov 2023 02:02:26 +0000 (05:02 +0300)]
Decrease issue font size in project template (#28054)

I propose to decrease font size. 18 is too big and looks ugly, on
windows. 14 is on par with other elements and save a bit of space.

![image](https://github.com/go-gitea/gitea/assets/13328513/bc41f65d-8f48-4fd9-8e3b-d7a73967b0aa)

![image](https://github.com/go-gitea/gitea/assets/13328513/70e78919-9b9b-4f57-a491-d746ea59c048)

Co-authored-by: Nikolay Kobzarev <n.kobzarev@aeronavigator.ru>
10 months agoRequire clear descriptions both for feature and breaking PRs prior to the merge ...
delvh [Sun, 19 Nov 2023 01:53:31 +0000 (02:53 +0100)]
Require clear descriptions both for feature and breaking PRs prior to the merge (#28112)

When writing the release blog, it is really annoying and time-consuming
to re-discover and write down how a feature behaves and capture a
screenshot of it, for every single feature merged since the last
release.
This should not be the responsibility of maintainers, but rather of the
person implementing a feature in the first place.
They know best how to use the feature and how to gather screenshots for
it.
Similarly for breaking changes and their effects.

As such, let's require everything to be up-to-date and easily
understandable before merging features or breaking changes.

11 months agoadd skip ci functionality (#28075)
Denys Konovalov [Sat, 18 Nov 2023 11:37:08 +0000 (12:37 +0100)]
add skip ci functionality (#28075)

Adds the possibility to skip workflow execution if the commit message
contains a string like [skip ci] or similar.

The default strings are the same as on GitHub, users can also set custom
ones in app.ini

Reference:
https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs

Close #28020

11 months agoFix project counter in organization/individual profile (#28068)
yp05327 [Sat, 18 Nov 2023 03:02:42 +0000 (12:02 +0900)]
Fix project counter in organization/individual profile (#28068)

Fix #28052
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/5f299983-4b38-4d68-ac0e-4be3c62c0558)

![image](https://github.com/go-gitea/gitea/assets/18380374/f0e12afd-483b-4882-80e9-0261beb3fe0c)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/47cccb7b-bb35-4a7d-9c5b-83133be0323a)

![image](https://github.com/go-gitea/gitea/assets/18380374/77825c0c-4bf2-4762-83a2-1a5a173cc22d)

11 months agoFix Show/hide filetree button on small displays (#27881)
sebastian-sauer [Fri, 17 Nov 2023 18:35:51 +0000 (19:35 +0100)]
Fix Show/hide filetree button on small displays (#27881)

the gt-df's display:flex !important did override the display:none on small displays

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
11 months agoChange default size of attachments and repo files (#28100)
Nanguan Lin [Fri, 17 Nov 2023 11:42:00 +0000 (19:42 +0800)]
Change default size of attachments and repo files (#28100)

https://github.com/go-gitea/gitea/pull/27946 forgets to change them in
code. Sorry about that.

11 months agoFix Matrix and MSTeams nil dereference (#28089)
KN4CK3R [Fri, 17 Nov 2023 11:17:33 +0000 (12:17 +0100)]
Fix Matrix and MSTeams nil dereference (#28089)

Fixes #28088
Fixes #28094

Added missing tests.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
11 months agoFix incorrect pgsql conn builder behavior (#28085)
wxiaoguang [Fri, 17 Nov 2023 02:30:57 +0000 (10:30 +0800)]
Fix incorrect pgsql conn builder behavior (#28085)

Fix #28083 and fix the tests

11 months agoFix system config cache expiration timing (#28072)
wxiaoguang [Thu, 16 Nov 2023 12:53:42 +0000 (20:53 +0800)]
Fix system config cache expiration timing (#28072)

To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix #28057

11 months agoImprove PR diff view on mobile (#27883)
sebastian-sauer [Thu, 16 Nov 2023 03:58:53 +0000 (04:58 +0100)]
Improve PR diff view on mobile (#27883)

1. Show diff stats only on large screens

these are already shown in tabs, so no need for this duplicate
information on small screens

![image](https://github.com/go-gitea/gitea/assets/1135157/1287839d-7490-42eb-a17e-d526dc0bfd9e)

![image](https://github.com/go-gitea/gitea/assets/1135157/e9dcd89d-ed4d-4945-a7aa-4e6fc6d9c3a2)

2. Hide viewed files information on small screens

Github does the same and this gives us more free space on small screens

![image](https://github.com/go-gitea/gitea/assets/1135157/e90b042f-fffb-4f79-a5ae-cd480c9d8334)

![image](https://github.com/go-gitea/gitea/assets/1135157/d2480ffe-58f2-4694-8ae1-a2ab0aae14d4)

3. Review bar now doesn't wrap so we don't need the 77px even on very
small screens

(the sticky headers are still working)

![image](https://github.com/go-gitea/gitea/assets/1135157/42b19b2b-73ef-4b88-8680-c555879b363b)

11 months agoImprove graceful manager code/comment (#28063)
wxiaoguang [Wed, 15 Nov 2023 14:02:46 +0000 (22:02 +0800)]
Improve graceful manager code/comment (#28063)

The graceful manager has some bugs (#27643, #28062). This is a
preparation for further fixes.

11 months agoRevert "packages: Calculate package size quota using package creator ID instead of...
Lunny Xiao [Tue, 14 Nov 2023 15:03:56 +0000 (23:03 +0800)]
Revert "packages: Calculate package size quota using package creator ID instead of owner ID (#28007)" (#28049)

This reverts commit #28007 60522fc96f1fa4675e95010e4b1535e0eac21910.

11 months agoRestricted users only see repos in orgs which their team was assigned to (#28025)
6543 [Tue, 14 Nov 2023 14:23:04 +0000 (15:23 +0100)]
Restricted users only see repos in orgs which their team was assigned to (#28025)

---
*Sponsored by Kithara Software GmbH*

11 months agoFix release link in changelog for v1.21.0
6543 [Tue, 14 Nov 2023 14:03:49 +0000 (15:03 +0100)]
Fix release link in changelog for v1.21.0

11 months agoAdd v1.21.0 changelog (#28005)
Denys Konovalov [Tue, 14 Nov 2023 13:55:16 +0000 (14:55 +0100)]
Add v1.21.0 changelog (#28005)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
11 months agoFix viewing wiki commit on empty repo (#28040)
JakobDev [Tue, 14 Nov 2023 11:42:23 +0000 (12:42 +0100)]
Fix viewing wiki commit on empty repo (#28040)

Fixes https://codeberg.org/forgejo/forgejo/issues/1758

For some weird reason we need to cast this nil.

11 months agoAdd word break to the repo list in admin settings page (#28034)
yp05327 [Tue, 14 Nov 2023 04:58:01 +0000 (13:58 +0900)]
Add word break to the repo list in admin settings page (#28034)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/ed464937-e20d-4f5b-b997-e86c2d96469d)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/471e77b3-516e-4ae9-b901-0cf8745eb9aa)

11 months agofixed duplicate attachments on dump on windows (#28019)
Anudeep Reddy [Tue, 14 Nov 2023 01:15:45 +0000 (06:45 +0530)]
fixed duplicate attachments on dump on windows (#28019)

Hi,

This PR fixes #27988. The use of `path.join`(which uses `/` as the file
separator) to construct paths and comparing them with paths constructed
using `filepath.join`(which uses platform specific file separator) is
the root cause of this issue.

The desired behavior is to ignore attachments when dumping data
directory. Due to the what's mentioned above, the function
`addRecursiveExclude` is not actually ignoring the attachments directory
and is being written to the archive. The attachment directory is again
added to the archive (with different file separator as mentioned in the
issue) causing a duplicate entry on windows.

The solution is to use `filepath.join` in `addResursiveExclude` to
construct `currentAbsPath`.

11 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 14 Nov 2023 00:23:48 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

11 months agopackages: Calculate package size quota using package creator ID instead of owner...
Danila Fominykh [Mon, 13 Nov 2023 23:38:50 +0000 (20:38 -0300)]
packages: Calculate package size quota using package creator ID instead of owner ID (#28007)

Changed behavior to calculate package quota limit using package `creator
ID` instead of `owner ID`.

Currently, users are allowed to create an unlimited number of
organizations, each of which has its own package limit quota, resulting
in the ability for users to have unlimited package space in different
organization scopes. This fix will calculate package quota based on
`package version creator ID` instead of `package version owner ID`
(which might be organization), so that users are not allowed to take
more space than configured package settings.

Also, there is a side case in which users can publish packages to a
specific package version, initially published by different user, taking
that user package size quota. Version in fix should be better because
the total amount of space is limited to the quota for users sharing the
same organization scope.

11 months agoDont leak private users via extensions (#28023)
6543 [Mon, 13 Nov 2023 22:30:24 +0000 (23:30 +0100)]
Dont leak private users via extensions (#28023)

11 months agoImprove profile for Organizations (#27982)
yp05327 [Mon, 13 Nov 2023 14:33:22 +0000 (23:33 +0900)]
Improve profile for Organizations (#27982)

Fixes some problems in #27955:
- autofocus of the search box
before:
if access the home page will jump to the search box

![image](https://github.com/go-gitea/gitea/assets/18380374/7f100e8d-2bd6-4563-85ba-d6008ffc71d7)
after:
will not jump to the search box

![image](https://github.com/go-gitea/gitea/assets/18380374/9aab382c-8ebe-4d18-b990-4adbb6c341ad)

- incorrect display of overview tab
before:

![image](https://github.com/go-gitea/gitea/assets/18380374/b24c79e8-9b79-4576-9276-43bd19172043)
after:

![image](https://github.com/go-gitea/gitea/assets/18380374/7aab5827-f086-4874-bd84-39bd81b872f3)

- improve the permission check to the private profile repo
In #26295, we simply added access control to the private profile.
But if user have access to the private profile repo , we should also
display the profile.

- add a button which can jump to the repo list?
I agree @wxiaoguang 's opinion here:
https://github.com/go-gitea/gitea/pull/27955#issuecomment-1803178239
But it seems that this feature is sponsored.
So can we add a button which can quickly jump to the repo list or just
move profile to the `overview` page?

---------

Co-authored-by: silverwind <me@silverwind.io>
11 months agoEnable system users search via the API (#28013)
Earl Warren [Mon, 13 Nov 2023 14:31:38 +0000 (15:31 +0100)]
Enable system users search via the API (#28013)

Refs: https://codeberg.org/forgejo/forgejo/issues/1403

(cherry picked from commit dd4d17c159eaf8b642aa9e6105b0532e25972bb7)

11 months agoEnable system users for comment.LoadPoster (#28014)
Earl Warren [Mon, 13 Nov 2023 14:30:08 +0000 (15:30 +0100)]
Enable system users for comment.LoadPoster (#28014)

System users (Ghost, ActionsUser, etc) have a negative id and may be the
author of a comment, either because it was created by a now deleted user
or via an action using a transient token.

The GetPossibleUserByID function has special cases related to system
users and will not fail if given a negative id.

Refs: https://codeberg.org/forgejo/forgejo/issues/1425

(cherry picked from commit 6a2d2fa24390116d31ae2507c0a93d423f690b7b)

11 months agoChange default size of issue/pr attachments and repo file (#27946)
Nanguan Lin [Mon, 13 Nov 2023 14:19:22 +0000 (22:19 +0800)]
Change default size of issue/pr attachments and repo file (#27946)

As title. Some attachments and file sizes can easily be larger than
these limits

11 months agoFix missing mail reply address (#27997)
KN4CK3R [Mon, 13 Nov 2023 03:20:34 +0000 (04:20 +0100)]
Fix missing mail reply address (#27997)

Fixes https://codeberg.org/forgejo/forgejo/issues/1458

Some mails such as issue creation mails are missing the reply-to-comment
address. This PR fixes that and specifies which comment types should get
a reply-possibility.

11 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 13 Nov 2023 00:24:40 +0000 (00:24 +0000)]
[skip ci] Updated licenses and gitignores

11 months agoFix wrong xorm Delete usage (#27995)
Nanguan Lin [Sun, 12 Nov 2023 07:38:45 +0000 (15:38 +0800)]
Fix wrong xorm Delete usage (#27995)

## Bug in Gitea
I ran into this bug when I accidentally used the wrong redirect URL for
the oauth2 provider when using mssql. But the oauth2 provider still got
added.
Most of the time, we use `Delete(&some{id: some.id})` or
`In(condition).Delete(&some{})`, which specify the conditions. But the
function uses `Delete(source)` when `source.Cfg` is a `TEXT` field and
not empty. This will cause xorm `Delete` function not working in mssql.

https://github.com/go-gitea/gitea/blob/61ff91f9603806df2505907614b9006bf721b9c8/models/auth/source.go#L234-L240

## Reason
Because the `TEXT` field can not be compared in mssql, xorm doesn't
support it according to [this
PR](https://gitea.com/xorm/xorm/pulls/2062)
[related
code](https://gitea.com/xorm/xorm/src/commit/b23798dc987af776bec867f4537ca129fd66328e/internal/statements/statement.go#L552-L558)
in xorm
```go
if statement.dialect.URI().DBType == schemas.MSSQL && (col.SQLType.Name == schemas.Text ||
   col.SQLType.IsBlob() || col.SQLType.Name == schemas.TimeStampz) {
   if utils.IsValueZero(fieldValue) {
     continue
   }
   return nil, fmt.Errorf("column %s is a TEXT type with data %#v which cannot be as compare condition", col.Name, fieldValue.Interface())
   }
}
```
When using the `Delete` function in xorm, the non-empty fields will
auto-set as conditions(perhaps some special fields are not?). If `TEXT`
field is not empty, xorm will return an error. I only found this usage
after searching, but maybe there is something I missing.

---------

Co-authored-by: delvh <dev.lh@web.de>
11 months agoMove some JS code from `fomantic.js` to standalone files (#27994)
wxiaoguang [Sun, 12 Nov 2023 07:15:00 +0000 (15:15 +0800)]
Move some JS code from `fomantic.js` to standalone files (#27994)

To improve maintainability, this PR:

1. Rename `web_src/js/modules/aria` to `web_src/js/modules/fomantic`
(the code there are all for aria of fomantic)
2. Move api/transition related code to
`web_src/js/modules/fomantic/api.js` and
`web_src/js/modules/fomantic/transition.js`

No logic is changed.

11 months agoFix the wrong oauth2 name (#27993)
Lunny Xiao [Sat, 11 Nov 2023 10:27:02 +0000 (18:27 +0800)]
Fix the wrong oauth2 name (#27993)

Fix #27989
Regression #27798

11 months agoRender email addresses as such if followed by punctuation (#27987)
Yarden Shoham [Sat, 11 Nov 2023 04:08:19 +0000 (06:08 +0200)]
Render email addresses as such if followed by punctuation (#27987)

Added the following characters to the regular expression for the email:

- ,
- ;
- ?
- !

Also added a test case.

- Fixes #27616

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/c57eac26-f281-43ef-a51d-9c9a81b63efa)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/fc7d5c08-4350-4af0-a7f0-d1444d2d75af)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>