]> source.dussan.org Git - gitea.git/log
gitea.git
14 months agoAdd API route to list org secrets (#26485)
Bo-Yi Wu [Tue, 15 Aug 2023 12:32:43 +0000 (20:32 +0800)]
Add API route to list org secrets (#26485)

- Add a new function `CountOrgSecrets` in the file
`models/secret/secret.go`
- Add a new file `modules/structs/secret.go`
- Add a new function `ListActionsSecrets` in the file
`routers/api/v1/api.go`
- Add a new file `routers/api/v1/org/action.go`
- Add a new function `listActionsSecrets` in the file
`routers/api/v1/org/action.go`

go-sdk: https://gitea.com/gitea/go-sdk/pulls/629

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoSet "type=button" for editor's toolbar buttons (#26510)
wxiaoguang [Tue, 15 Aug 2023 11:31:48 +0000 (19:31 +0800)]
Set "type=button" for editor's toolbar buttons (#26510)

The editor usually is in a form, so the buttons should have
"type=button", avoid conflicting with the form's submit.

14 months agoApply to become a maintainer (#26514)
CaiCandong [Tue, 15 Aug 2023 09:30:06 +0000 (17:30 +0800)]
Apply to become a maintainer (#26514)

Here is my PR list:- [go-gitea/gitea/pulls (author:caicandong is:merged)](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+sort%3Aupdated-desc+author%3ACaiCandong+is%3Amerged)

14 months agoDetect ogg mime-type as audio or video (#26494)
wxiaoguang [Tue, 15 Aug 2023 02:31:25 +0000 (10:31 +0800)]
Detect ogg mime-type as audio or video (#26494)

"ogg" is just a "container" format for audio and video.

Golang's `DetectContentType` only reports "application/ogg" for
potential ogg files.

Actually it could do more "guess" to see whether it is a audio file or a
video file.

14 months agoUse `object-fit: contain` for oauth2 custom icons (#26493)
wxiaoguang [Mon, 14 Aug 2023 16:21:04 +0000 (00:21 +0800)]
Use `object-fit: contain` for oauth2 custom icons (#26493)

14 months agoadd disable workflow feature (#26413)
a1012112796 [Mon, 14 Aug 2023 15:14:30 +0000 (23:14 +0800)]
add disable workflow feature (#26413)

As title, that's simmilar with github.

![image](https://github.com/go-gitea/gitea/assets/25342410/9e8b2444-63e0-4e87-80da-730c1e4d09d6)

![image](https://github.com/go-gitea/gitea/assets/25342410/6c3a3345-3ba7-48c9-9acd-3e621632491b)

---------

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Jason Song <i@wolfogre.com>
14 months agoMove dropzone progress bar to bottom to show filename when uploading (#26492)
wxiaoguang [Mon, 14 Aug 2023 14:36:53 +0000 (22:36 +0800)]
Move dropzone progress bar to bottom to show filename when uploading (#26492)

1. Make the "filename" visible
2. Avoiding UI flicker when the uploading is completing

14 months agoHandle base64 decoding correctly to avoid panic (#26483)
wxiaoguang [Mon, 14 Aug 2023 10:30:16 +0000 (18:30 +0800)]
Handle base64 decoding correctly to avoid panic (#26483)

Fix the panic if the "base64 secret" is too long.

14 months agoAllow to archive labels (#26478)
puni9869 [Mon, 14 Aug 2023 09:56:14 +0000 (15:26 +0530)]
Allow to archive labels (#26478)

## Archived labels

This adds the structure to allow for archived labels.
Archived labels are, just like closed milestones or projects, a medium to hide information without deleting it.
It is especially useful if there are outdated labels that should no longer be used without deleting the label entirely.

## Changes

1. UI and API have been equipped with the support to mark a label as archived
2. The time when a label has been archived will be stored in the DB

## Outsourced for the future

There's no special handling for archived labels at the moment.
This will be done in the future.

## Screenshots

![image](https://github.com/go-gitea/gitea/assets/80308335/208f95cd-42e4-4ed7-9a1f-cd2050a645d4)

![image](https://github.com/go-gitea/gitea/assets/80308335/746428e0-40bb-45b3-b992-85602feb371d)

Part of https://github.com/go-gitea/gitea/issues/25237

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoUpdate zh-cn documentation (#26406)
CaiCandong [Mon, 14 Aug 2023 05:35:49 +0000 (13:35 +0800)]
Update zh-cn documentation (#26406)

14 months agoFix NuGet search endpoints (#25613)
KN4CK3R [Mon, 14 Aug 2023 02:50:55 +0000 (04:50 +0200)]
Fix NuGet search endpoints (#25613)

Fixes #25564
Fixes #23191

- Api v2 search endpoint should return only the latest version matching
the query
- Api v3 search endpoint should return `take` packages not package
versions

14 months agoFix tooltip of commit select button (#26472)
silverwind [Mon, 14 Aug 2023 02:16:40 +0000 (04:16 +0200)]
Fix tooltip of commit select button (#26472)

Previously, the tooltip for this button was only shown after opening and
closing it once because it was only set after the server response, now
it shows before opening it.

14 months agofix grab cursor on default column (#26476)
Denys Konovalov [Mon, 14 Aug 2023 01:15:16 +0000 (03:15 +0200)]
fix grab cursor on default column (#26476)

Fix https://github.com/go-gitea/gitea/pull/26448#issuecomment-1676194200

I accidentally set grab cursor for project columns instead of issue
cards, which actually turned out not to be a problem - with proper check
for the default column, which can't be moved.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoFix storage path logic especially for relative paths (#26441)
Lunny Xiao [Sun, 13 Aug 2023 20:09:25 +0000 (04:09 +0800)]
Fix storage path logic especially for relative paths (#26441)

This PR rewrites the function `getStorage` and make it more clear.

Include tests from #26435, thanks @earl-warren

---------

Co-authored-by: Earl Warren <contact@earl-warren.org>
14 months agoRename `Sync2` -> `Sync` (#26479)
delvh [Sun, 13 Aug 2023 19:17:21 +0000 (21:17 +0200)]
Rename `Sync2` -> `Sync` (#26479)

The xorm `Sync2` has already been deprecated in favor of `Sync`,
so let's do the same inside the Gitea codebase.

Command used to replace everything:
```sh
for i in $(ag Sync2 --files-with-matches); do vim $i -c ':%sno/Sync2/Sync/g' -c ':wq'; done
```

14 months agoAdd ThreadID parameter for Telegram webhooks (#25996)
Earl Warren [Sun, 13 Aug 2023 14:00:06 +0000 (16:00 +0200)]
Add ThreadID parameter for Telegram webhooks (#25996)

Telegram has recently implemented threads (channels) for group chats.

Co-authored-by: neveraskedtoexist <matikot415@gmail.com>
14 months agoFix stderr usages (#26477)
wxiaoguang [Sun, 13 Aug 2023 12:49:30 +0000 (20:49 +0800)]
Fix stderr usages (#26477)

14 months agoUse correct pull request commit link instead of a generic commit link (#26434)
Lunny Xiao [Sun, 13 Aug 2023 09:04:42 +0000 (17:04 +0800)]
Use correct pull request commit link instead of a generic commit link (#26434)

Replace #26197
Since #25528 merged, the links of pull request commits should be
redirect to pull file changes UI but not the generic one.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoClose stdout correctly for "git blame" (#26470)
wxiaoguang [Sun, 13 Aug 2023 02:11:20 +0000 (10:11 +0800)]
Close stdout correctly for "git blame" (#26470)

Close stdout correctly for "git blame", otherwise the failed "git blame"
would case the request hanging forever.

And "os.Stderr" should never (seldom) be used as git command's stderr

14 months agoRefactor tests (#26464)
wxiaoguang [Sat, 12 Aug 2023 16:30:16 +0000 (00:30 +0800)]
Refactor tests (#26464)

1. Give the global variable clear names
2. Use generic parameter for `onGiteaRun`

14 months agoRemove last newline from config file (#26468)
wxiaoguang [Sat, 12 Aug 2023 15:28:35 +0000 (23:28 +0800)]
Remove last newline from config file (#26468)

When users put the secrets into a file (GITEA__sec__KEY__FILE), the
newline sometimes is different to avoid (eg: echo/vim/...)

So the last newline could be removed when reading, it makes the users
easier to maintain the secret files.

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoAdd matrix to support (#26382)
John Olheiser [Sat, 12 Aug 2023 14:54:50 +0000 (09:54 -0500)]
Add matrix to support (#26382)

This PR adds our matrix space to the support options and alphabetizes
the list.

I also considered adding our Mastodon, however that isn't as suitable as
the other options because it's just whoever has access to the account vs
a community chat/forum.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoRefactor project templates (#26448)
Denys Konovalov [Sat, 12 Aug 2023 10:30:28 +0000 (12:30 +0200)]
Refactor project templates (#26448)

This PR refactors a bunch of projects-related code, mostly the
templates.
The following things were done:
  - rename boards to columns in frontend code
  - use the new `ctx.Locale.Tr` method
  - cleanup template, remove useless newlines, classes, comments
  - merge org-/user and repo level project template together
    - move "new column" button into project toolbar
- move issue card (shared by projects and pinned issues) to shared
template, remove useless duplicated styles
- add search function to projects (to make the layout more similar to
milestones list where it is inherited from :laughing:)
  - maybe more changes I forgot I've done :laughing:

Closes #24893

After:
![Bildschirmfoto vom 2023-08-10
23-02-00](https://github.com/go-gitea/gitea/assets/47871822/cab61456-1d23-4373-8163-e567f1b3b5f9)
![Bildschirmfoto vom 2023-08-10
23-02-26](https://github.com/go-gitea/gitea/assets/47871822/94b55d60-5572-48eb-8111-538a52d8bcc6)
![Bildschirmfoto vom 2023-08-10
23-02-46](https://github.com/go-gitea/gitea/assets/47871822/a0358f4b-4e05-4194-a7bc-6e0ecba5a9b6)

---------

Co-authored-by: silverwind <me@silverwind.io>
14 months agoAvoiding accessing undefined mentionValues (#26461)
wxiaoguang [Sat, 12 Aug 2023 08:36:23 +0000 (16:36 +0800)]
Avoiding accessing undefined mentionValues (#26461)

The `window.config.mentionValues` might be undefined:

```
{{if or .Participants .Assignees .MentionableTeams}}
    mentionValues: ...
{{end}}
```

14 months agoTweak actions menu (#26278)
silverwind [Sat, 12 Aug 2023 08:26:53 +0000 (10:26 +0200)]
Tweak actions menu (#26278)

Ressurect lost changes from
https://github.com/go-gitea/gitea/pull/24451.

- Always show icons for each entry in the menu
- Make all checkboxes toggle only their feature, e.g. "seconds" and
"timestamps" can now be toggled on together.
- Reorder the items

<img width="845" alt="Screenshot 2023-08-01 at 19 19 27"
src="https://github.com/go-gitea/gitea/assets/115237/8a76e9bf-7966-42a6-87c9-e88cdddaec82">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoAdjust minio new sequence, now it will check whether bucket exist first and then...
Lunny Xiao [Sat, 12 Aug 2023 08:03:54 +0000 (16:03 +0800)]
Adjust minio new sequence, now it will check whether bucket exist first and then create one if it doesn't exist (#26420)

For some reason, the permission of the client_id and secret may cannot
create bucket, so now we will check whether bucket does exist first and
then try to create a bucket if it doesn't exist.

Try to fix #25984

Co-authored-by: silverwind <me@silverwind.io>
14 months agoSet commit id when ref used explicitly (#26447)
Jack Hay [Sat, 12 Aug 2023 07:33:12 +0000 (03:33 -0400)]
Set commit id when ref used explicitly (#26447)

In the `RepoRefForAPI()` context function `CommitID` is not set if `ref`
is used. It is set correctly for other if/else branches where `Commit`
is set. It doesn't appear that any routes that use `RepoRefForAPI()`
also use `CommitID` but that may be the case in the future.

## Changes
- Sets `ctx.Repo.CommitID` when `ref` is explicitly used for api routes
that use `RepoRefForAPI()`

14 months agoFix 404 error when remove self from an organization (#26362)
yp05327 [Sat, 12 Aug 2023 07:02:22 +0000 (16:02 +0900)]
Fix 404 error when remove self from an organization (#26362)

Same to #24322

Not only `leave` action but also `remove` action should check whether
user still belongs to the org.

14 months agoUpdate index doc (#26455)
CaiCandong [Sat, 12 Aug 2023 00:49:23 +0000 (08:49 +0800)]
Update index doc (#26455)

In the previous feature description, numerous functionalities of Gitea
were listed, which appeared redundant and failed to highlight the unique
characteristics of Gitea. Therefore, I have rewritten this section based
on the description provided on the official Gitea website

14 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 12 Aug 2023 00:20:47 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

14 months agoremove unnecessary explore org template (#26459)
Denys Konovalov [Fri, 11 Aug 2023 20:07:04 +0000 (22:07 +0200)]
remove unnecessary explore org template (#26459)

14 months agoFix URL of padlock icon in profile (#26446)
Panagiotis "Ivory" Vasilopoulos [Fri, 11 Aug 2023 17:40:38 +0000 (17:40 +0000)]
Fix URL of padlock icon in profile (#26446)

14 months agoCount only visible repos on profile (#25928)
JakobDev [Fri, 11 Aug 2023 17:08:05 +0000 (19:08 +0200)]
Count only visible repos on profile (#25928)

Fixes #25914

14 months agoUpdate upgrade documentation to add a check for deprecated configurations (#26451)
Lunny Xiao [Fri, 11 Aug 2023 05:53:23 +0000 (13:53 +0800)]
Update upgrade documentation to add a check for deprecated configurations (#26451)

fix
https://github.com/go-gitea/gitea/issues/25995#issuecomment-1674096710

---------

Co-authored-by: silverwind <me@silverwind.io>
14 months agoFall back to esbuild for css minify (#26445)
silverwind [Fri, 11 Aug 2023 04:13:25 +0000 (06:13 +0200)]
Fall back to esbuild for css minify (#26445)

Fixes https://github.com/go-gitea/gitea/issues/26439.

The minification result is not ideal with esbuild, but it's better than
failing competely.

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoUpdate JS dependencies (#26449)
silverwind [Fri, 11 Aug 2023 00:29:15 +0000 (02:29 +0200)]
Update JS dependencies (#26449)

- Update all JS dependencies
- Tested Monaco and Swagger

14 months agoCall git.InitSimple for runRepoSyncReleases (#26396)
wxiaoguang [Thu, 10 Aug 2023 22:42:48 +0000 (06:42 +0800)]
Call git.InitSimple for runRepoSyncReleases (#26396)

Fix #26394

Otherwise, the git module is not initialized and it doesn't respect the
"timeout" config in app.ini

14 months agoTarget specific OS for devcontainer base image (#26422)
techknowlogick [Thu, 10 Aug 2023 21:57:29 +0000 (17:57 -0400)]
Target specific OS for devcontainer base image (#26422)

fixes #25842

credit to philippbeckmann for discovering this

14 months agoLock go to 1.21 on CI (#26433)
silverwind [Thu, 10 Aug 2023 21:53:44 +0000 (23:53 +0200)]
Lock go to 1.21 on CI (#26433)

To prevent unwanted surprises with new minor versions of go, lock the
version to minor version using [semver tilde
syntax](https://github.com/npm/node-semver#tilde-ranges-123-12-1). We
were already getting 1.21.0 since yesterday, so use that version now as
minimum.

14 months agoAlways show usernames in reaction tooltips (#26444)
Panagiotis "Ivory" Vasilopoulos [Thu, 10 Aug 2023 21:20:01 +0000 (21:20 +0000)]
Always show usernames in reaction tooltips (#26444)

Even if GetDisplayName() is normally preferred elsewhere, this change
provides more consistency, as usernames are also always being shown
when participating in a conversation taking place in an issue or
a pull request. This change makes conversations easier to follow, as
you would not have to have a mental association between someone's
username and someone's real name in order to follow what is happening.

This behavior matches GitHub's. Optimally, both the username and the
full name (if applicable) could be shown, but such an effort is a
much bigger task that needs to be thought out well.

14 months agoFix incorrect redirection in new issue using references (#26440)
CaiCandong [Thu, 10 Aug 2023 20:04:08 +0000 (04:04 +0800)]
Fix incorrect redirection in new issue using references (#26440)

fix #26427
related https://github.com/go-gitea/gitea/pull/25258

---

Before:

![gitea](https://github.com/go-gitea/gitea/assets/50507092/ed8d3a17-1f63-42f2-a698-3b684e70dc91)

---

After:

![After](https://github.com/go-gitea/gitea/assets/50507092/b8e1338f-c520-4abc-b0df-b812c021ac7e)

14 months agoFix the display of orgs listed in user profile (#26424)
yp05327 [Thu, 10 Aug 2023 19:28:36 +0000 (04:28 +0900)]
Fix the display of orgs listed in user profile (#26424)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/55759aad-cbf7-4d91-8559-b7781d184911)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/9de5136b-d0a0-4756-9426-125fd4b603d3)

In #26214, we changed each row's display into `flex` which caused this
problem.

![image](https://github.com/go-gitea/gitea/assets/18380374/66546e7e-a224-45e7-9008-224f0f2952c6)

![image](https://github.com/go-gitea/gitea/assets/18380374/e5190f88-e561-4361-894a-86c5fe88837e)
In old version:

![image](https://github.com/go-gitea/gitea/assets/18380374/36e58e98-7d75-4a63-844a-2beee460997a)

Maybe we can add paddings here?

![image](https://github.com/go-gitea/gitea/assets/18380374/dc61acd2-8995-46d4-b606-eb10c77dd877)
In old version;

![image](https://github.com/go-gitea/gitea/assets/18380374/478acba7-0bbc-4852-b208-3ae43fcea976)

14 months agominio: add missing region on client initialization (#26412) 25824/head
nekrondev [Thu, 10 Aug 2023 11:21:09 +0000 (13:21 +0200)]
minio: add missing region on client initialization (#26412)

The MinIO client isn't redirecting to the correct AWS endpoint if a
non-default data center is used.

In my use case I created an AWS bucket at `eu-central-1` region. Because
of the missing region initialization of the client the default
`us-east-1` API endpoint is used returning a `301 Moved Permanently`
response that's not handled properly by MinIO client. This in return
aborts using S3 storage on AWS as the `BucketExists()` call will fail
with the http moved error.

MinIO client trace shows the issue:

```text
---------START-HTTP---------
HEAD / HTTP/1.1
Host: xxxxxxxxxxx-prod-gitea-data.s3.dualstack.us-east-1.amazonaws.com
User-Agent: MinIO (windows; amd64) minio-go/v7.0.61
Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20230809/accesspoint.eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230809T141143Z

HTTP/1.1 301 Moved Permanently
Connection: close
Content-Type: application/xml
Date: Wed, 09 Aug 2023 14:11:43 GMT
Server: AmazonS3
X-Amz-Bucket-Region: eu-central-1
X-Amz-Id-2: UK7wfeYi0HcTcytNvQ3wTAZ5ZP1mOSMnvRZ9Fz4xXzeNsS47NB/KfFx2unFxo3L7XckHpMNPPVo=
X-Amz-Request-Id: S1V2MJV8SZ11GEVN
---------END-HTTP---------
```

Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
14 months agoFix wrong middleware sequence (#26428)
Lunny Xiao [Thu, 10 Aug 2023 10:51:46 +0000 (18:51 +0800)]
Fix wrong middleware sequence (#26428)

14 months agoUse template context function for avatar rendering (#26385)
wxiaoguang [Thu, 10 Aug 2023 03:19:39 +0000 (11:19 +0800)]
Use template context function for avatar rendering (#26385)

Introduce `AvatarUtils`, no need to pass `$.Context` to every
sub-template, and simplify the template helper functions.

14 months agoAdd transaction when creating pull request created dirty data (#26259)
Lunny Xiao [Thu, 10 Aug 2023 02:39:21 +0000 (10:39 +0800)]
Add transaction when creating pull request created dirty data (#26259)

Fix #26129
Replace #26258

This PR will introduce a transaction on creating pull request so that if
some step failed, it will rollback totally. And there will be no dirty
pull request exist.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoFix admin queue page title (#26409)
wxiaoguang [Thu, 10 Aug 2023 02:05:37 +0000 (10:05 +0800)]
Fix admin queue page title (#26409)

Fix #26408

```
# locale_en-US.ini
[admin]
monitor.queues = Queues
```

---------

Co-authored-by: silverwind <me@silverwind.io>
14 months agoPre-register OAuth2 applications for git credential helpers (#26291)
Denys Konovalov [Wed, 9 Aug 2023 12:24:07 +0000 (14:24 +0200)]
Pre-register OAuth2 applications for git credential helpers (#26291)

This PR is an extended implementation of #25189 and builds upon the
proposal by @hickford in #25653, utilizing some ideas proposed
internally by @wxiaoguang.

Mainly, this PR consists of a mechanism to pre-register OAuth2
applications on startup, which can be enabled or disabled by modifying
the `[oauth2].DEFAULT_APPLICATIONS` parameter in app.ini. The OAuth2
applications registered this way are being marked as "locked" and
neither be deleted nor edited over UI to prevent confusing/unexpected
behavior. Instead, they're being removed if no longer enabled in config.

![grafik](https://github.com/go-gitea/gitea/assets/47871822/81a78b1c-4b68-40a7-9e99-c272ebb8f62e)

The implemented mechanism can also be used to pre-register other OAuth2
applications in the future, if wanted.

Co-authored-by: hickford <mirth.hickford@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
---------

Co-authored-by: M Hickford <mirth.hickford@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoMake `user-content-* ` consistent with github (#26388)
CaiCandong [Wed, 9 Aug 2023 09:30:31 +0000 (17:30 +0800)]
Make `user-content-* ` consistent with github (#26388)

Fix #26367
Related #19745

Thanks @lazyky for providing  test cases

14 months agoAdd pull request review request webhook event (#26401)
Yarden Shoham [Wed, 9 Aug 2023 08:30:34 +0000 (11:30 +0300)]
Add pull request review request webhook event (#26401)

Add webhook events for pull request review requests

- Fixes #26371
- Added support for the "Pull request review requested" and "Pull
request review request removed" webhook events.
- Updated the `getPullRequestPayloadInfo` function in `general.go` to
handle these new webhook events.

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/bd942971-fb1d-40f3-8961-46638e3588fa)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/216e9c7d-0a4d-49f9-8492-2d14c88bbf4e)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoIntroduce ctx.PathParamRaw to avoid incorrect unescaping (#26392)
wxiaoguang [Wed, 9 Aug 2023 06:57:45 +0000 (14:57 +0800)]
Introduce ctx.PathParamRaw to avoid incorrect unescaping (#26392)

Fix #26389

And complete an old TODO: `ctx.Params does un-escaping,..., which is
incorrect.`

14 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 9 Aug 2023 00:26:05 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

14 months agofix artifact merging chunks path with correct slash on Windows (#26400)
FuXiaoHei [Tue, 8 Aug 2023 17:21:48 +0000 (01:21 +0800)]
fix artifact merging chunks path with correct slash on Windows (#26400)

From Discord
https://discord.com/channels/322538954119184384/1069795723178160168/1136719889684500480

Artifact chunks merging is break on Windows.

```
Gitea Log:
2023/08/03 20:51:15 ...actions/artifacts.go:271:comfirmUploadArtifact() [E] Error merge chunks: parse content range error: input does not match format
```

Artifact uses wrong slash to parse saved chunks path.

14 months agoUse flex classes in package settings (#26314)
KN4CK3R [Tue, 8 Aug 2023 16:28:24 +0000 (18:28 +0200)]
Use flex classes in package settings (#26314)

Regression of #25790
Fixes #26310

---------

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoImprove multiple strings in en-US locale (#26213)
Panagiotis "Ivory" Vasilopoulos [Tue, 8 Aug 2023 15:25:05 +0000 (15:25 +0000)]
Improve multiple strings in en-US locale (#26213)

I kept sending pull requests that consisted of one-line changes. It's
time to
settle this once and for all. (Maybe.)

- Explain Gitea behavior and the consequences of each
  setting better, so that the user does not have to consult
  the docs.
- Do not use different spellings of identical terms
  interchangeably, e.g. `e-mail` and `email`.
- Use more conventional terms to describe the same things,
  e.g. `Confirm Password` instead of `Re-Type Password`.
- Introduces additional clarification for Mirror Settings
- Small adjustments in test
- This is a cry for help.
- Grammar and spelling consistencies for en-US locale
  (e.g. cancelled -> canceled)
- Introduce tooltip improvements.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoRefactor "editorconfig" (#26391)
wxiaoguang [Tue, 8 Aug 2023 10:44:19 +0000 (18:44 +0800)]
Refactor "editorconfig" (#26391)

There are 2 kinds of ".Editorconfig" in code, one is `JSON string` for
the web edtior, another is `*editorconfig.Editorconfig` for the file
rendering (used by `TabSizeClass`)

This PR distinguish them with different names.

And by the way, change the default tab size from 8 to 4, I think few
people would like to use 8-size tabs nowadays.

14 months agofix generated source URL on rendered files (#26364)
Earl Warren [Tue, 8 Aug 2023 09:04:04 +0000 (11:04 +0200)]
fix generated source URL on rendered files (#26364)

- The permalink and 'Reference in New issue' URL of an renderable file
(those where you can see the source and a rendered version of it, such
as markdown) doesn't contain `?display=source`. This leads the issue
that the URL doesn't have any effect, as by default the rendered version
is shown and thus not the source.
- Add `?display=source` to the permalink URL and to 'Reference in New
Issue' if it's renderable file.
- Add integration testing.

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

Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoRemove unnecessary template helper DisableGravatar (#26386)
wxiaoguang [Tue, 8 Aug 2023 08:29:14 +0000 (16:29 +0800)]
Remove unnecessary template helper DisableGravatar (#26386)

And one "AllowedUserVisibilityModes" was missing, add it.

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoRemove unnecessary template helper repoAvatar (#26387)
wxiaoguang [Tue, 8 Aug 2023 07:29:35 +0000 (15:29 +0800)]
Remove unnecessary template helper repoAvatar (#26387)

And simplify the "repo/icon" code

14 months agoStart using template context function (#26254)
wxiaoguang [Tue, 8 Aug 2023 01:22:47 +0000 (09:22 +0800)]
Start using template context function (#26254)

Before:

* `{{.locale.Tr ...}}`
* `{{$.locale.Tr ...}}`
* `{{$.root.locale.Tr ...}}`
* `{{template "sub" .}}`
* `{{template "sub" (dict "locale" $.locale)}}`
* `{{template "sub" (dict "root" $)}}`
* .....

With context function: only need to `{{ctx.Locale.Tr ...}}`

The "ctx" could be considered as a super-global variable for all
templates including sub-templates.

To avoid potential risks (any bug in the template context function
package), this PR only starts using "ctx" in "head.tmpl" and
"footer.tmpl" and it has a "DataRaceCheck". If there is anything wrong,
the code can be fixed or reverted easily.

14 months agoAllow package cleanup from admin page (#25307)
KN4CK3R [Tue, 8 Aug 2023 00:46:10 +0000 (02:46 +0200)]
Allow package cleanup from admin page (#25307)

Until now expired package data gets deleted daily by a cronjob. The
admin page shows the size of all packages and the size of unreferenced
data. The users (#25035, #20631) expect the deletion of this data if
they run the cronjob from the admin page but the job only deletes data
older than 24h.

This PR adds a new button which deletes all expired data.

![grafik](https://github.com/go-gitea/gitea/assets/1666336/b3e35d73-9496-4fa7-a20c-e5d30b1f6850)

---------

Co-authored-by: silverwind <me@silverwind.io>
14 months agoFix text truncate (#26354)
Maxim Slipenko [Mon, 7 Aug 2023 20:44:04 +0000 (23:44 +0300)]
Fix text truncate (#26354)

Fixes: https://github.com/go-gitea/gitea/issues/25597
Before:

![image](https://github.com/go-gitea/gitea/assets/36362599/c8c27bcb-469f-4def-8521-d9e054c16ecb)

After:

![image](https://github.com/go-gitea/gitea/assets/36362599/2405b6e8-fc5c-4b13-b66b-007bc11edbc4)

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoFix incorrect sort link with `.profile` repository (#26374)
CaiCandong [Mon, 7 Aug 2023 19:59:17 +0000 (03:59 +0800)]
Fix incorrect sort link with  `.profile`  repository (#26374)

fix #26360

14 months agoUse more `IssueList` instead of `[]*Issue` (#26369)
Lunny Xiao [Mon, 7 Aug 2023 19:26:40 +0000 (03:26 +0800)]
Use more `IssueList` instead of `[]*Issue` (#26369)

14 months agoRename code_langauge.go to code_language.go (#26377)
cassiozareck [Mon, 7 Aug 2023 19:00:53 +0000 (16:00 -0300)]
Rename code_langauge.go to code_language.go (#26377)

14 months agoAdd changelog for 1.20.3 (#26373)
delvh [Mon, 7 Aug 2023 16:11:33 +0000 (18:11 +0200)]
Add changelog for 1.20.3 (#26373)

14 months agoDo not highlight `#number` in documents (#26365)
Earl Warren [Mon, 7 Aug 2023 13:11:25 +0000 (15:11 +0200)]
Do not highlight `#number` in documents (#26365)

- Currently the post processing will transform all issue indexes (such as `#6`) into a clickable link.
- This makes sense in an situation like issues or PRs,
where referencing to other issues is quite common
and only referencing their issue index is an handy and efficient way to do it.
- Currently this is also run for documents
(which is the user profile and viewing rendered files),
but in those situations it's less common to reference issues by their index and instead could mean something else.
- This patch disables this post processing for issue index for documents. Matches Github's behavior.
- Added unit tests.
- Resolves https://codeberg.org/Codeberg/Community/issues/1120

Co-authored-by: Gusted <postmaster@gusted.xyz>
14 months agoBypass MariaDB performance bug of the "IN" sub-query, fix incorrect IssueIndex (...
wxiaoguang [Mon, 7 Aug 2023 10:23:59 +0000 (18:23 +0800)]
Bypass MariaDB performance bug of the "IN" sub-query, fix incorrect IssueIndex (#26279)

Close #26277
Fix #26285

14 months agoFix nil pointer dereference error when open link with invalid pull index (#26353)
CaiCandong [Mon, 7 Aug 2023 03:43:18 +0000 (11:43 +0800)]
Fix nil pointer dereference  error when open link with invalid pull index (#26353)

fix #26331

Before:

![image](https://github.com/go-gitea/gitea/assets/50507092/028e6944-84d1-4404-80b6-4a4accdc7d0a)

After:

![image](https://github.com/go-gitea/gitea/assets/50507092/b78978f9-e77f-459f-96e1-3a1f36ec8abe)

14 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 7 Aug 2023 00:27:21 +0000 (00:27 +0000)]
[skip ci] Updated licenses and gitignores

14 months agoDisplay human-readable text instead of cryptic filemodes (#26352)
delvh [Sun, 6 Aug 2023 19:52:34 +0000 (21:52 +0200)]
Display human-readable text instead of cryptic filemodes (#26352)

Now, you don't need to be a git expert anymore to know what these
numbers mean.

## Before

![grafik](https://github.com/go-gitea/gitea/assets/51889757/9a964bf6-10fd-40a6-aeb2-ac8f437f8c32)

## After

![grafik](https://github.com/go-gitea/gitea/assets/51889757/84573cb9-55b6-4dde-9866-95f71b657554)

or when the mode actually changed:

![grafik](https://github.com/go-gitea/gitea/assets/51889757/0f327538-ebdc-40e7-8c99-f9e21b67f638)

14 months ago[docs] Add missing backtick in quickstart.zh-cn.md (#26349)
Track3 [Sat, 5 Aug 2023 16:28:25 +0000 (00:28 +0800)]
[docs] Add missing backtick in quickstart.zh-cn.md (#26349)

Added missing backtick in quickstart.zh-cn.md docs so inline code can
render properly.

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoFix incorrect CLI exit code and duplicate error message (#26346)
wxiaoguang [Sat, 5 Aug 2023 15:36:45 +0000 (23:36 +0800)]
Fix incorrect CLI exit code and duplicate error message (#26346)

Follow the CLI refactoring, and add tests.

14 months agoImprove CLI and messages (#26341)
wxiaoguang [Sat, 5 Aug 2023 13:24:49 +0000 (21:24 +0800)]
Improve CLI and messages (#26341)

Follow the CLI refactoring

1. Remove the "checkCommandFlags" helper
2. Unify the web startup message, make them have consistent names as `./gitea help`
3. Fine tune some other messages (see the diff)

14 months agoRemove backslashed newlines on markdown (#26344)
Lunny Xiao [Sat, 5 Aug 2023 12:48:46 +0000 (20:48 +0800)]
Remove backslashed newlines on markdown (#26344)

Fix https://gitea.com/gitea/gitea-docusaurus/issues/56

14 months agoHide `last indexed SHA` when a repo could not be indexed yet (#26340)
CaiCandong [Sat, 5 Aug 2023 11:04:14 +0000 (19:04 +0800)]
Hide `last indexed SHA` when a repo could not be indexed yet (#26340)

Now, for a new repo without any commit, the Last indexed SHA field looks like this:
Before:
![image](https://github.com/go-gitea/gitea/assets/50507092/cecc6e24-3366-4093-ae07-c361ea34b373)
After:
![image](https://github.com/go-gitea/gitea/assets/50507092/9b6ba703-b0d5-4648-ad6b-9a2341dd60f9)

Fixes #26336

14 months agoFix log typo in task.go (#26337)
cassiozareck [Sat, 5 Aug 2023 09:43:03 +0000 (06:43 -0300)]
Fix log typo in task.go (#26337)

Signed-off-by: cassiozareck <cassiomilczareck@gmail.com>
14 months agoPrevent newline errors with Debian packages (#26332)
KN4CK3R [Sat, 5 Aug 2023 08:59:52 +0000 (10:59 +0200)]
Prevent newline errors with Debian packages (#26332)

Fixes #26313

14 months agoFix the bug when getting files changed for `pull_request_target` event (#26320)
Zettat123 [Sat, 5 Aug 2023 06:26:06 +0000 (14:26 +0800)]
Fix the bug when getting files changed for `pull_request_target` event (#26320)

Follow #25229

Copy from
https://github.com/go-gitea/gitea/pull/26290#issuecomment-1663135186

The bug is that we cannot get changed files for the
`pull_request_target` event. This event runs in the context of the base
branch, so we won't get any changes if we call
`GetFilesChangedSinceCommit` with `PullRequest.Base.Ref`.

14 months agoRefactor backend SVG package and add tests (#26335)
wxiaoguang [Sat, 5 Aug 2023 04:34:59 +0000 (12:34 +0800)]
Refactor backend SVG package and add tests (#26335)

Introduce a well-tested `svg.Normalize` function.
Make `RenderHTML` faster and more stable.

14 months agoFix bug with sqlite load read (#26305)
Lunny Xiao [Sat, 5 Aug 2023 02:40:27 +0000 (10:40 +0800)]
Fix bug with sqlite load read (#26305)

Possible fix #26280

14 months agoRemove commit load branches and tags in wiki repo (#26304)
yp05327 [Fri, 4 Aug 2023 15:49:43 +0000 (00:49 +0900)]
Remove commit load branches and tags in wiki repo (#26304)

If click `load branches and tags`, you will get 500 error from backend,
as it is a wiki repo.

![image](https://github.com/go-gitea/gitea/assets/18380374/1eb2a68b-cc72-4607-a1d1-4f74f83623f6)

![image](https://github.com/go-gitea/gitea/assets/18380374/c385de25-0cfb-4084-9452-d7e9d27deea9)

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoAdd highlight to selected repos in milestone dashboard (#26300)
yp05327 [Fri, 4 Aug 2023 15:16:56 +0000 (00:16 +0900)]
Add highlight to selected repos in milestone dashboard (#26300)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/d3fa1e15-423a-4216-8a60-b02f5aa4f5d3)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/643df586-ec2f-4480-b7a0-bd252883d761)

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoDo not show Profile README when repository is private (#26295)
Nicholas Pease [Fri, 4 Aug 2023 14:45:33 +0000 (10:45 -0400)]
Do not show Profile README when repository is private (#26295)

As mentioned in the original thread (#23260) and in the enhancements PR
#24753, this PR ensures the .profile repository is public before the
README file is shown.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoFix incorrect color of selected assignees when create issue (#26324)
yp05327 [Fri, 4 Aug 2023 14:14:30 +0000 (23:14 +0900)]
Fix incorrect color of selected assignees when create issue (#26324)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/75d610b2-3823-4366-be85-c77c9106feff)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/15afc6ac-f5ad-4e24-8983-fea8ace5921f)

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoDelete `issue_service.CreateComment` (#26298)
caicandong [Fri, 4 Aug 2023 13:34:34 +0000 (21:34 +0800)]
Delete `issue_service.CreateComment` (#26298)

I noticed that `issue_service.CreateComment` adds transaction operations
on `issues_model.CreateComment`, we can merge the two functions and we
can avoid calling each other's methods in the `services` layer.

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoMake git batch operations use parent context timeout instead of default timeout ...
wxiaoguang [Fri, 4 Aug 2023 12:50:41 +0000 (20:50 +0800)]
Make git batch operations use parent context timeout instead of default timeout (#26325)

Fix #26064

Some git commands should use parent context, otherwise it would exit too
early (by the default timeout, 10m), and the "cmd.Wait" waits till the
pipes are closed.

14 months agoFix typos and grammer problems for actions documentation (#26328)
sillyguodong [Fri, 4 Aug 2023 10:04:37 +0000 (18:04 +0800)]
Fix typos and grammer problems for actions documentation (#26328)

follow #26317
fix typos and adjust grammer problems.

14 months agoUpdate documentation for 1.21 actions (#26317)
sillyguodong [Fri, 4 Aug 2023 09:06:02 +0000 (17:06 +0800)]
Update documentation for 1.21 actions (#26317)

As title.
Close #26309
Related to #24724, #24806

14 months agoFix the wrong derive path (#26271)
Lunny Xiao [Fri, 4 Aug 2023 03:41:16 +0000 (11:41 +0800)]
Fix the wrong derive path (#26271)

This PR will fix #26264, caused by #23911.

The package configuration derive is totally wrong when storage type is
local in that PR.

This PR fixed the inherit logic when storage type is local with some
unit tests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoSupport getting changed files when commit ID is `EmptySHA` (#26290)
Zettat123 [Fri, 4 Aug 2023 02:53:15 +0000 (10:53 +0800)]
Support getting changed files when commit ID is `EmptySHA` (#26290)

Fixes #26270.

Co-Author: @wxiaoguang

Thanks @lunny for providing this solution

As
https://github.com/go-gitea/gitea/issues/26270#issuecomment-1661695151
said, at present we cannot get the names of changed files correctly when
the `OldCommitID` is `EmptySHA`. In this PR, the `GetCommitFilesChanged`
method is added and will be used to get the changed files by commit ID.

References:
- https://stackoverflow.com/a/424142

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoAdd `Retry` button when creating a mirror-repo fails (#26228)
Kerwin Bryant [Fri, 4 Aug 2023 02:21:32 +0000 (10:21 +0800)]
Add `Retry` button when creating a mirror-repo fails (#26228)

fixed #26156
* Added a retry button in the frontend (only displayed when the status
is abnormal)
* After clicking Retry, the backend adds the task back to the task queue

![7UJDNM671RI})EA8~~XPL39](https://github.com/go-gitea/gitea/assets/3371163/e088fd63-5dcc-4bc6-8849-7db3086511b7)

![T83F1WL9)VGHR@MB956$VT9](https://github.com/go-gitea/gitea/assets/3371163/744425bb-dde1-4315-be2e-5c99ac3a44d4)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 4 Aug 2023 00:26:21 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

14 months agoAdd locale for deleted head branch (#26296)
yp05327 [Thu, 3 Aug 2023 22:07:15 +0000 (07:07 +0900)]
Add locale for deleted head branch (#26296)

As title.

It will be displayed in:

![image](https://github.com/go-gitea/gitea/assets/18380374/e8507a3b-14f4-4418-a347-a36689707a16)

14 months agoUse yellow if an approved review is stale (#26312)
sebastian-sauer [Thu, 3 Aug 2023 21:28:21 +0000 (23:28 +0200)]
Use yellow if an approved review is stale (#26312)

By using a different color it's clear that the review isn't pointing to
the latest commit.

**Screenshots:**
Not stale review:

![image](https://github.com/go-gitea/gitea/assets/1135157/2901ad69-e0d8-4041-b760-277d02dafd45)
Stale review:

![image](https://github.com/go-gitea/gitea/assets/1135157/500b306e-a994-42d4-a2fd-1174774ba5ee)

fixes #26306

14 months agoRemove nonsense `<a>` for commit status check icon (#26287)
yp05327 [Thu, 3 Aug 2023 17:58:41 +0000 (02:58 +0900)]
Remove nonsense `<a>` for commit status check icon (#26287)

We are using `<a>` for commit status check icon with no link. So it is
clickable but this is no sense.
I think we can convert this to `div`.

![image](https://github.com/go-gitea/gitea/assets/18380374/23db1a11-b0c7-4444-bfa6-fe68aeb1c682)

Co-authored-by: Giteabot <teabot@gitea.io>
14 months agoMake confusable character warning less jarring (#25069)
Panagiotis "Ivory" Vasilopoulos [Thu, 3 Aug 2023 14:16:06 +0000 (14:16 +0000)]
Make confusable character warning less jarring (#25069)

This commit assumes that the warning can be made more discreet
so as to make it less annoying for the people that do not actually
need the warning, without necessarily increasing the risk for those
that do need it.

This doesn't fix the underlying problem of the warning being shown
in certain cases that, say, a certain kind of whitespace character
like 0x1E could be absolutely justifiable from a technical
perspective.

---------

Co-authored-by: delvh <dev.lh@web.de>
14 months agoUpdate Gmail example (#26302)
Bård Aase [Thu, 3 Aug 2023 10:20:40 +0000 (11:20 +0100)]
Update Gmail example (#26302)

The `IS_TLS_ENABLED` option in the `mailer` section is deprecated. This
is specified by setting `PROTOCOL=smtps`

14 months agoFix the topic validation rule and suport dots (#26286)
wxiaoguang [Thu, 3 Aug 2023 09:18:06 +0000 (17:18 +0800)]
Fix the topic validation rule and suport dots (#26286)

1. Allow leading and trailing spaces by user input, these spaces have
already been trimmed at backend
2. Allow using dots in the topic

14 months agoUpgrade x/net to 0.13.0 (#26297)
Lunny Xiao [Thu, 3 Aug 2023 08:29:57 +0000 (16:29 +0800)]
Upgrade x/net to 0.13.0 (#26297)