]> source.dussan.org Git - gitea.git/log
gitea.git
17 months agoAdd icon support for safari (#24697)
Lunny Xiao [Sat, 13 May 2023 19:48:56 +0000 (03:48 +0800)]
Add icon support for safari (#24697)

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoImprove avatar uploading / resizing / compressing, remove Fomantic card module (...
wxiaoguang [Sat, 13 May 2023 18:59:11 +0000 (02:59 +0800)]
Improve avatar uploading / resizing / compressing, remove Fomantic card module (#24653)

Fixes: #8972
Fixes: #24263
And I think it also (partially) fix #24263 (no need to convert) ,
because users could upload any supported image format if it isn't larger
than AVATAR_MAX_ORIGIN_SIZE

The main idea:

* if the uploaded file size is not larger than AVATAR_MAX_ORIGIN_SIZE,
use the origin
* if the resized size is larger than the origin, use the origin

Screenshots:

JPG:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/70e98bb0-ecb9-4c4e-a89f-4a37d4e37f8e)

</details>

APNG:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/9055135b-5e2d-4152-bd72-596fcb7c6671)

![image](https://github.com/go-gitea/gitea/assets/2114189/50364caf-f7f6-4241-a289-e485fe4cd582)

</details>

WebP (animated)

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/f642eb85-498a-49a5-86bf-0a7b04089ae0)

</details>

The only exception: if a WebP image is larger than MaxOriginSize and it
is animated, then current `webp` package can't decode it, so only in
this case it isn't supported. IMO no need to support such case: why a
user would upload a 1MB animated webp as avatar? crazy .....

---------

Co-authored-by: silverwind <me@silverwind.io>
17 months agoFix docs documenting invalid `@every` for `OLDER_THAN` cron settings (#24695)
Yarden Shoham [Sat, 13 May 2023 15:22:31 +0000 (18:22 +0300)]
Fix docs documenting invalid `@every` for `OLDER_THAN` cron settings (#24695)

Looks like a copy-paste leftover

- Fixes #20868

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix `organization` field being `null` in `GET /api/v1/teams/{id}` (#24694)
Yarden Shoham [Sat, 13 May 2023 14:47:58 +0000 (17:47 +0300)]
Fix `organization` field being `null` in `GET /api/v1/teams/{id}` (#24694)

Enabled the organization loading flag.

- Fixes #20399

# Before
```json
{
  ...
  "description": "",
  "organization": null,
  "includes_all_repositories": true,
  "permission": "owner",
  ...
}
```

# After
```json
{
  ...
  "description": "",
  "organization": {
    "id": 2,
    "name": "bigorg",
    "full_name": "",
    "avatar_url": "https://3000-yardenshoham-gitea-3gfrlc9gn4h.ws-us96b.gitpod.io/avatars/e2649b0c016d9102664a7d4349503eb9",
    "description": "",
    "website": "",
    "location": "",
    "visibility": "public",
    "repo_admin_change_team_access": true,
    "username": "bigorg"
  },
  "includes_all_repositories": true,
  "permission": "owner",
  ...
}
```

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoUse standard HTTP library to serve files (#24693)
wxiaoguang [Sat, 13 May 2023 14:04:57 +0000 (22:04 +0800)]
Use standard HTTP library to serve files (#24693)

`http.ServeFile/ServeContent` handles `If-xxx`, `Content-Length`,
`Range` and `Etag` correctly

After this PR, storage files (eg: avatar) could be responded with
correct Content-Length.

17 months agoAdd `eslint-plugin-eslint-comments` (#24690)
silverwind [Fri, 12 May 2023 20:38:17 +0000 (22:38 +0200)]
Add `eslint-plugin-eslint-comments` (#24690)

Add
[eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments)
which prevents some abuse related to eslint comments.

17 months agoAdd `eslint-plugin-wc` (#24689)
silverwind [Fri, 12 May 2023 19:15:49 +0000 (21:15 +0200)]
Add `eslint-plugin-wc` (#24689)

Add [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc),
another small set of eslint rules covering web components.

17 months agoAdd Alpine package registry (#23714)
KN4CK3R [Fri, 12 May 2023 17:27:50 +0000 (19:27 +0200)]
Add Alpine package registry (#23714)

This PR adds an Alpine package registry. You can follow [this
tutorial](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package)
to build a *.apk package for testing.

This functionality is similar to the Debian registry (#22854) and
therefore shares some methods. I marked this PR as blocked because it
should be merged after #22854.

![grafik](https://user-images.githubusercontent.com/1666336/227779595-b76163aa-eea1-4a79-9583-775c24ad74e8.png)

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoOnly hide tooltip tippy instances (#24688)
silverwind [Fri, 12 May 2023 16:58:55 +0000 (18:58 +0200)]
Only hide tooltip tippy instances (#24688)

Fix regression from https://github.com/go-gitea/gitea/pull/24648 where
it was hiding non-tooltip tippy instances, like for example in the
review panel which itself is a tippy instance, but with a different
`role`.

17 months agoUpdate JS dependencies (#24685)
silverwind [Fri, 12 May 2023 15:47:48 +0000 (17:47 +0200)]
Update JS dependencies (#24685)

- Update all JS dependencies
- Tested citation and various vue components

Also this includes the fix for
https://github.com/webpack/webpack-cli/issues/3778.

17 months agoRename ".button-link" to ".button-ghost" (#24670)
wxiaoguang [Fri, 12 May 2023 14:58:44 +0000 (22:58 +0800)]
Rename ".button-link" to ".button-ghost" (#24670)

Mainstream frameworks:

* https://getbootstrap.com/docs/5.0/components/buttons/
* https://primer.style/css/components/buttons#link-button
* https://nextui.org/docs/components/button#light
* https://coreui.io/react/docs/components/button/
* https://design-system.hpe.design/components/button
* https://chakra-ui.com/docs/components/button/usage#button-variants
* https://mui.com/material-ui/react-button/

All (at least most?) of them make "link" button have "underline" when
hovering.

So, a "link" is a "link", when it's hovered, it should have the
underline by default. To be strict, Gitea's "button-link" is not
link-style, so it needs a better name.

Actually, for the "plain" button, there are some different approaches:

* Some frameworks just make "default" button as no style (not feasible
in Gitea/Fomantic UI)
* Primer uses "btn-invisible", which is not a proper word
* NextUI uses "light", which is not a proper word, either ...
* CoreUI / ChakraUI uses "ghost", I think this name is acceptable.

Welcome to suggest better name for such button.

Or, we just call it ".button-plain" or ".button-simple", in fact I
prefer such simple and clear name.

17 months agoMake testlogger output "TestLogger" prefix (#24683)
wxiaoguang [Fri, 12 May 2023 14:20:29 +0000 (22:20 +0800)]
Make testlogger output "TestLogger" prefix (#24683)

Make testlogger output "TestLogger" prefix instead of "Unknown Test"
when there is no running test case.

17 months agoSupport migrating storage for actions log via command line (#24679)
Jason Song [Fri, 12 May 2023 13:30:28 +0000 (21:30 +0800)]
Support migrating storage for actions log via command line (#24679)

Close #24677

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoAdd markdown preview to Submit Review Textarea (#24672)
yp05327 [Fri, 12 May 2023 10:53:41 +0000 (19:53 +0900)]
Add markdown preview to Submit Review Textarea (#24672)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/2909352c-b2ab-4d77-b410-9f08c2f5a154)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/9448fa75-e29b-4f95-a30f-03c73c083a83)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoRemove svg.svg class, restore .rss-icon (#24667)
silverwind [Fri, 12 May 2023 10:23:53 +0000 (12:23 +0200)]
Remove svg.svg class, restore .rss-icon (#24667)

Fix regression from https://github.com/go-gitea/gitea/pull/24476 where
the `svg.svg` class misaligns SVG icons across the site and streched
buttons unintentionally in vertical height.

Before (button 30.3px):
<img width="157" alt="Screenshot 2023-05-11 at 22 09 42"
src="https://github.com/go-gitea/gitea/assets/115237/0fd137ab-ab52-4cf8-afca-c45776d526d0">

After (button 30px):
<img width="160" alt="Screenshot 2023-05-11 at 22 09 59"
src="https://github.com/go-gitea/gitea/assets/115237/4b741f4b-0fd2-4fae-9bee-16a7deb098e8">

[vertical-align:
middle](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align)
is not suitable to align icons to text because

> Aligns the middle of the element with the baseline plus half the
x-height of the parent.

Example of `vertical-align: middle` from MDN:

<img width="232" alt="Screenshot 2023-05-11 at 22 29 28"
src="https://github.com/go-gitea/gitea/assets/115237/179fb756-85a1-4cab-8219-1a4958f333e2">

So I think the
[existing](https://github.com/go-gitea/gitea/blob/365bb77a5497d492836bf823cf780c823db27e8c/web_src/css/svg.css#L3)
`vertical-align: text-top` is generally still the best bet:

<img width="241" alt="Screenshot 2023-05-11 at 22 34 24"
src="https://github.com/go-gitea/gitea/assets/115237/0cd6edf5-12c0-4bdb-8771-a900f5ba2d35">

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoSupport SSH for go get (#24664)
rune [Fri, 12 May 2023 09:44:37 +0000 (17:44 +0800)]
Support SSH for go get (#24664)

fix #12192 Support SSH for go get

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: mfk <mfk@hengwei.com.cn>
Co-authored-by: silverwind <me@silverwind.io>
17 months agoDisplay owner of a runner as a tooltip instead of static text (#24377)
yp05327 [Fri, 12 May 2023 08:43:27 +0000 (17:43 +0900)]
Display owner of a runner as a tooltip instead of static text (#24377)

Before:

![image](https://user-images.githubusercontent.com/18380374/234779250-8bbd325c-190e-4a30-ac3e-766498d17df5.png)

After:

![image](https://user-images.githubusercontent.com/18380374/234779094-e232ecba-d9f4-4d62-a702-6d5e4a522782.png)

![image](https://user-images.githubusercontent.com/18380374/234779120-0293af17-a566-4b69-b454-af4e95844e3b.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
17 months agoRemove highlight in repo list (#24675)
yp05327 [Fri, 12 May 2023 08:00:17 +0000 (17:00 +0900)]
Remove highlight in repo list (#24675)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/aa5e9f1f-48ff-4e9f-a693-23a34e390760)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/a4b58a6c-4ea3-4ded-80df-2e650d39a1d3)

private or internal repos have `lock` icon, no need to add highlights to
them.

17 months agoUpdate pin and add pin-slash (#24669) 24225/head
yp05327 [Fri, 12 May 2023 06:38:59 +0000 (15:38 +0900)]
Update pin and add pin-slash (#24669)

Continue #23531
Thanks for the update in https://github.com/primer/octicons/issues/940,
@CameronFoxly

![image](https://github.com/go-gitea/gitea/assets/18380374/bc512b20-b656-4bd7-8e70-3a2b7eca9d65)

![image](https://github.com/go-gitea/gitea/assets/18380374/a3863267-6a7a-48d5-8157-9f361fec3fed)

17 months agoImprove empty notifications display (#24668)
silverwind [Fri, 12 May 2023 04:06:23 +0000 (06:06 +0200)]
Improve empty notifications display (#24668)

- Add icon and padding to empty notification list, center it
- Add icon to header
- Remove border below header

#### Before
<img width="1250" alt="Screenshot 2023-05-11 at 23 34 53"
src="https://github.com/go-gitea/gitea/assets/115237/7c1990a1-e48d-40e5-8762-462d8c3ac0ea">

#### After

<img width="1249" alt="Screenshot 2023-05-12 at 00 24 02"
src="https://github.com/go-gitea/gitea/assets/115237/e0bcdf81-8468-4047-b92c-6625f00a22aa">

17 months agoGitHub Actions cleanups (#24620)
silverwind [Fri, 12 May 2023 01:21:28 +0000 (03:21 +0200)]
GitHub Actions cleanups (#24620)

- Remove actions name where command is descriptive enough
- Use kebab-case instead of snake-case for step names
- Use shorter job names because to make PR checks more readable
- Remove duplicate `checks-backend`

---------

Co-authored-by: Yarden Shoham <git@yardenshoham.com>
17 months agoFix issues list page multiple selection update milestones (#24660)
Lunny Xiao [Thu, 11 May 2023 13:19:42 +0000 (21:19 +0800)]
Fix issues list page multiple selection update milestones (#24660)

Fix #24651

17 months agoMake repo migration cancelable and fix various bugs (#24605)
wxiaoguang [Thu, 11 May 2023 08:25:46 +0000 (16:25 +0800)]
Make repo migration cancelable and fix various bugs (#24605)

Replace #12917

Close #24601
Close #12845

![image](https://github.com/go-gitea/gitea/assets/2114189/39378118-064d-40fb-8396-4579ebf33917)

![image](https://github.com/go-gitea/gitea/assets/2114189/faf37418-191c-46a6-90a8-353141e00e2d)

![image](https://github.com/go-gitea/gitea/assets/2114189/fdc8ee4d-125f-4737-9990-89bcdf9eb388)

![image](https://github.com/go-gitea/gitea/assets/2114189/9a3bd2c2-fe20-4011-81f0-990ed869d139)

---------

Co-authored-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoImprove queue & process & stacktrace (#24636)
wxiaoguang [Thu, 11 May 2023 07:45:47 +0000 (15:45 +0800)]
Improve queue & process & stacktrace (#24636)

Although some features are mixed together in this PR, this PR is not
that large, and these features are all related.

Actually there are more than 70 lines are for a toy "test queue", so
this PR is quite simple.

Major features:

1. Allow site admin to clear a queue (remove all items in a queue)
* Because there is no transaction, the "unique queue" could be corrupted
in rare cases, that's unfixable.
* eg: the item is in the "set" but not in the "list", so the item would
never be able to be pushed into the queue.
* Now site admin could simply clear the queue, then everything becomes
correct, the lost items could be re-pushed into queue by future
operations.
3. Split the "admin/monitor" to separate pages
4. Allow to download diagnosis report
* In history, there were many users reporting that Gitea queue gets
stuck, or Gitea's CPU is 100%
    * With diagnosis report, maintainers could know what happens clearly

The diagnosis report sample:
[gitea-diagnosis-20230510-192913.zip](https://github.com/go-gitea/gitea/files/11441346/gitea-diagnosis-20230510-192913.zip)
, use "go tool pprof profile.dat" to view the report.

Screenshots:

![image](https://github.com/go-gitea/gitea/assets/2114189/320659b4-2eda-4def-8dc0-5ea08d578063)

![image](https://github.com/go-gitea/gitea/assets/2114189/c5c46fae-9dc0-44ca-8cd3-57beedc5035e)

![image](https://github.com/go-gitea/gitea/assets/2114189/6168a811-42a1-4e64-a263-0617a6c8c4fe)

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix missing badges in org settings page (#24654)
yp05327 [Thu, 11 May 2023 06:56:25 +0000 (15:56 +0900)]
Fix missing badges in org settings page (#24654)

Improve #24232

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/e5c5a7b8-e071-4713-b622-5ae8e272d6fd)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/5a9e38b5-384e-46c5-8400-dafebbd08fee)

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoOnly show one tippy at a time (#24648)
silverwind [Thu, 11 May 2023 05:40:54 +0000 (07:40 +0200)]
Only show one tippy at a time (#24648)

Because our tippy instances have an `interactiveBorder`, it's possible
to bring up two instances at once, which is undesirable.

<img width="256" alt="Screenshot 2023-05-10 at 23 03 04"
src="https://github.com/go-gitea/gitea/assets/115237/3a9a1775-78c1-46d4-a8a5-503ab7dca0d8">

Prevent this by keeping track of visible tippy instances and hiding
others when one is shown. Tippy also has the [singleton
addon](https://atomiks.github.io/tippyjs/v6/addons/#singleton) for the
same purpose, but it's unsuitable to us because we don't init all
tooltips at once.

17 months agoReenable creating default webhooks. (#24626)
Nick [Thu, 11 May 2023 02:10:57 +0000 (22:10 -0400)]
Reenable creating default webhooks. (#24626)

Fixes #24624

This seems to have been broken in
https://github.com/go-gitea/gitea/pull/21563

Previously, this code read

```
                // Are we looking at default webhooks?
                if ctx.Params(":configType") == "default-hooks" {
                        return &orgRepoCtx{
                                IsAdmin:     true,
                                Link:        path.Join(setting.AppSubURL, "/admin/hooks"),
                                LinkNew:     path.Join(setting.AppSubURL, "/admin/default-hooks"),
                                NewTemplate: tplAdminHookNew,
                        }, nil
                }

                // Must be system webhooks instead
                return &orgRepoCtx{
                        IsAdmin:         true,
                        IsSystemWebhook: true,
                        Link:            path.Join(setting.AppSubURL, "/admin/hooks"),
                        LinkNew:         path.Join(setting.AppSubURL, "/admin/system-hooks"),
                        NewTemplate:     tplAdminHookNew,
                }, nil
```

but was simplified to

```
                return &ownerRepoCtx{
                        IsAdmin:         true,
                        IsSystemWebhook: ctx.Params(":configType") == "system-hooks",
                        Link:            path.Join(setting.AppSubURL, "/admin/hooks"),
                        LinkNew:         path.Join(setting.AppSubURL, "/admin/system-hooks"),
                        NewTemplate:     tplAdminHookNew,
                }, nil
```

In other words, combining the `IsSystemWebhook` check into a one-liner
and forgetting that `LinkNew` also depended on it. This meant the
rendered `<form>` always POSTed to `/admin/system-hooks`, even when you
had GETed `/admin/default-hooks/gitea/new`.

17 months agoKd/fix redis unit test (#24650)
Kyle D [Thu, 11 May 2023 02:09:37 +0000 (22:09 -0400)]
Kd/fix redis unit test (#24650)

Replaces #24641

Currently, unit tests fail when run locally (unless users have minio
instance running). This PR only requires redis unit tests if in CI.

- Only run redis unit tests when `CI` env variable is set
- Add minio as a service in unit tests actions

17 months agoFix typo in act-runner file (#24652)
Kerwin Bryant [Thu, 11 May 2023 01:04:42 +0000 (09:04 +0800)]
Fix typo in act-runner file (#24652)

Misspelled instance_url as intence_url

17 months agoRSS icon fixes (#24476)
silverwind [Wed, 10 May 2023 22:27:02 +0000 (00:27 +0200)]
RSS icon fixes (#24476)

Fix regression from https://github.com/go-gitea/gitea/pull/24471 where
CSS rules for `.icon.grey` were removed which were in use by the RSS
icons.

Gave them their own class instead, removed a wrapper and also fixed
vertical alignment on them. Additionally, did a few related fixes on the
org header for alignment.

Fixes: https://github.com/go-gitea/gitea/issues/24584
<img width="196" alt="Screenshot 2023-05-01 at 22 39 40"
src="https://user-images.githubusercontent.com/115237/235528228-959e2385-c1d2-4d5c-baec-e3784d459653.png">
<img width="216" alt="Screenshot 2023-05-01 at 22 44 20"
src="https://user-images.githubusercontent.com/115237/235528231-95cbff86-5672-48eb-b214-8bdcefa1612c.png">
<img width="120" alt="Screenshot 2023-05-01 at 22 56 36"
src="https://user-images.githubusercontent.com/115237/235529844-b94ab554-3259-4d0c-b040-82aed7d1a111.png">

<img width="372" alt="Screenshot 2023-05-01 at 22 54 25"
src="https://user-images.githubusercontent.com/115237/235529744-1a9c201b-5692-4122-9765-2f201a322a9e.png">
<img width="477" alt="Screenshot 2023-05-01 at 22 55 28"
src="https://user-images.githubusercontent.com/115237/235529748-62188554-9927-42ef-bc94-7052bce266e2.png">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoNotification list enhancements, fix striped tables on dark theme (#24639)
silverwind [Wed, 10 May 2023 21:59:58 +0000 (23:59 +0200)]
Notification list enhancements, fix striped tables on dark theme (#24639)

- Make code block rendering via backticks work
- Remove link color unless hovered
- Remove table stripes and fix stripes rendering on dark theme for other
tables
- Introduce new `button-link` class discussed previously for buttons
that look and act like links and apply it to the two right-side buttons
- Reduce box padding by 8px on each side
- Fix "Mark all read" button margin-right
- brighten `--color-markup-code-block` on arc-green

### Before
<img width="1216" alt="Screenshot 2023-05-10 at 20 00 30"
src="https://github.com/go-gitea/gitea/assets/115237/66da9ec2-dd09-4ef0-8f1d-1822a18b6b43">
<img width="1211" alt="Screenshot 2023-05-10 at 20 00 48"
src="https://github.com/go-gitea/gitea/assets/115237/f48e30a2-9a00-4723-93aa-79b97ca0ba0c">

### After
<img width="1222" alt="Screenshot 2023-05-10 at 20 09 59"
src="https://github.com/go-gitea/gitea/assets/115237/c956e0d0-b3d9-42a4-a3ed-f0431c22bf3f">
<img width="1218" alt="Screenshot 2023-05-10 at 20 05 34"
src="https://github.com/go-gitea/gitea/assets/115237/f72c1628-3961-4c28-9263-07cdf7531316">

17 months agoImprove "goto issue by number" button (#24577)
wxiaoguang [Wed, 10 May 2023 15:50:58 +0000 (23:50 +0800)]
Improve "goto issue by number" button (#24577)

Follow #24479

![image](https://user-images.githubusercontent.com/2114189/236694114-c5cb42ff-456d-465a-bcb9-89ed5959d346.png)

![image](https://user-images.githubusercontent.com/2114189/236694119-052e689c-6264-4468-9ab3-0e5c97521bec.png)

![image](https://user-images.githubusercontent.com/2114189/236694139-f8940765-42ce-462d-b49e-50a416cc6f85.png)

![image](https://user-images.githubusercontent.com/2114189/236694154-6d8a000c-9ef3-4d07-af1c-59b0cf8f4d33.png)

![image](https://user-images.githubusercontent.com/2114189/236694166-3bc3e585-7955-44aa-af34-b33ae91e132f.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoIncrease default LFS auth timeout from 20m to 24h (#24628)
wxiaoguang [Wed, 10 May 2023 14:23:47 +0000 (22:23 +0800)]
Increase default LFS auth timeout from 20m to 24h (#24628)

According to the discussion with DanielGibson, the default "20m" seems
too short. It would make LFS fail if the file is large / network is
slow.

I think relaxing this timeout doesn't have side affect. So change the
default value to 24h, IMO that should be long enough.

## :warning: BREAKING

If admins want the previous timeout, they should set the setting
`[server].LFS_HTTP_AUTH_EXPIRY`.

17 months agoFix typo in the swift package documentation (#24637)
ericLemanissier [Wed, 10 May 2023 13:43:56 +0000 (15:43 +0200)]
Fix typo in the swift package documentation (#24637)

17 months agoFix broken links in documents (#24630)
Jason Song [Wed, 10 May 2023 12:34:16 +0000 (20:34 +0800)]
Fix broken links in documents (#24630)

Before:

<img width="837" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/90c1c484-2d8d-4a57-8e86-2f4df0e7fbba">

After:

<img width="822" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/e27f6b63-9e7b-4894-b315-7be0cfebe8ca">

17 months agoImprove updating Actions tasks (#24600)
Jason Song [Wed, 10 May 2023 11:54:18 +0000 (19:54 +0800)]
Improve updating Actions tasks (#24600)

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoModify luminance calculation and extract related functions into single files (#24586)
Hester Gong [Wed, 10 May 2023 11:19:03 +0000 (19:19 +0800)]
Modify luminance calculation and extract related functions into single files (#24586)

Close #24508

Main changes:
As discussed in the issue

1. Change luminance calculation function to use [Relative
Luminance](https://www.w3.org/WAI/GL/wiki/Relative_luminance)
2. Move the luminance related functions into color.go/color.js
3. Add tests for both the files (Not sure if test cases are too many
now)

Before (tests included by `UseLightTextOnBackground` are labels started
with `##`):
https://try.gitea.io/HesterG/testrepo/labels

After:
<img width="1307" alt="Screen Shot 2023-05-08 at 13 37 55"
src="https://user-images.githubusercontent.com/17645053/236742562-fdfc3a4d-2fab-466b-9613-96f2bf96b4bc.png">
<img width="1289" alt="Screen Shot 2023-05-08 at 13 38 06"
src="https://user-images.githubusercontent.com/17645053/236742570-022db68e-cec0-43bb-888a-fc54f5332cc3.png">
<img width="1299" alt="Screen Shot 2023-05-08 at 13 38 20"
src="https://user-images.githubusercontent.com/17645053/236742572-9af1de45-fb7f-460b-828d-ba25fae20f51.png">

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoDo not send "registration success email" for external auth sources (#24632)
wxiaoguang [Wed, 10 May 2023 10:49:47 +0000 (18:49 +0800)]
Do not send "registration success email" for external auth sources (#24632)

Co-author: @pboguslawski

"registration success email" is only used for notifying a user that "you
have a new account now" when the account is created by admin manually.

When a user uses external auth source, they already knows that they has
the account, so do not send such email.

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix typo in Actions demo file (#24631)
Jason Song [Wed, 10 May 2023 09:51:25 +0000 (17:51 +0800)]
Fix typo in Actions demo file (#24631)

Reported by @kerwin612.

17 months agoReview fixes and enhancements (#24526)
silverwind [Wed, 10 May 2023 09:16:44 +0000 (11:16 +0200)]
Review fixes and enhancements (#24526)

- Fix regression with icons wrapping from
https://github.com/go-gitea/gitea/pull/24459
- Fix box misalignment on small screen
- Fix avatar misalignment on review comment
- Fix incorrect underline hover effect on review icons
- Move status icon to left side in review box
- Enhance review icon colors, add helper function for it
- Add missing inline avatars in review comments
- Tweak icon sizes because some octicons have inconsistent sizing

### Before
<img width="655" alt="Screenshot 2023-05-04 at 20 50 28"
src="https://user-images.githubusercontent.com/115237/236301230-92325507-6e03-47ac-bfb4-c9ddde310571.png">
<img width="260" alt="Screenshot 2023-05-04 at 20 50 42"
src="https://user-images.githubusercontent.com/115237/236301236-0dfa50e7-b8fc-4179-ae68-d872bc90f1f3.png">

### After
<img width="498" alt="Screenshot 2023-05-04 at 20 55 08"
src="https://user-images.githubusercontent.com/115237/236301810-23862c2c-c0a9-43a4-a3eb-ee611c14a7f4.png">
<img width="219" alt="Screenshot 2023-05-04 at 20 55 16"
src="https://user-images.githubusercontent.com/115237/236301817-d0de02ea-6ab5-43e1-9183-6b3848b72995.png">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoRemove fluid on compare diff page (#24627)
Hester Gong [Wed, 10 May 2023 08:46:17 +0000 (16:46 +0800)]
Remove fluid on compare diff page (#24627)

As discuessed in
https://github.com/go-gitea/gitea/pull/24598/files#r1189290462

After:

Diff Page
<img width="1426" alt="Screen Shot 2023-05-10 at 10 44 48"
src="https://github.com/go-gitea/gitea/assets/17645053/bc1a5f78-ec17-4ac2-8390-081a5fc059d1">

New PR Page
<img width="1428" alt="Screen Shot 2023-05-10 at 10 45 17"
src="https://github.com/go-gitea/gitea/assets/17645053/ce94a28e-39d5-4534-9e78-c0edd4c7a339">

<img width="1432" alt="Screen Shot 2023-05-10 at 10 45 27"
src="https://github.com/go-gitea/gitea/assets/17645053/047809e1-abb2-4c16-ae62-63b71094c1c7">

17 months agoMake the actions control button look like an actual button (#24611)
Yarden Shoham [Wed, 10 May 2023 08:09:23 +0000 (11:09 +0300)]
Make the actions control button look like an actual button (#24611)

- Follows #24595

# Before

![image](https://user-images.githubusercontent.com/20454870/236889690-d1dfd74d-ad7d-4571-b712-69f0dc630c6e.png)

![image](https://user-images.githubusercontent.com/20454870/236903320-3b415619-8aff-4e5d-994e-6faa671990db.png)

![image](https://user-images.githubusercontent.com/20454870/236885823-0734216d-b450-4a43-bfe3-e88525a8822a.png)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/b0745b3f-5f7a-49d9-903a-fd2675baaa1a)

![image](https://github.com/go-gitea/gitea/assets/20454870/88789c78-2764-4be4-9a03-b080f1028c78)

![image](https://github.com/go-gitea/gitea/assets/20454870/a6e23400-4445-40c5-adbe-460c90fae36a)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoAdd a tooltip to the job rerun button (#24617)
Yarden Shoham [Wed, 10 May 2023 07:37:10 +0000 (10:37 +0300)]
Add a tooltip to the job rerun button (#24617)

This one doesn't look very good as a real button (at least not in the
ways I tried), so I've opted to simply add a tooltip for it.
# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/05afe362-b914-42ce-9db3-e3471bc6ec4b)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/c99c88d4-bf43-46b0-911e-9ea17ff6977e)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoImprove reverse-proxy document and fix nginx config bug (#24616)
wxiaoguang [Wed, 10 May 2023 05:28:44 +0000 (13:28 +0800)]
Improve reverse-proxy document and fix nginx config bug (#24616)

Close #23711, thanks to @ghnp5 !
Close  #24612, thanks to @DanielGibson !

Major changes:

* the default value of nginx's client_max_body_size is too small, so put
a 512M here
* move `Resolving Error: 413 Request Entity Too Large` to a sub-section
of `Nginx` section
* make nginx use unescaped the URI and keep "%2F" as is when using
sub-path
* add details for General sub-path configuration

17 months agoRemove unnecessary code (#24610)
Lunny Xiao [Wed, 10 May 2023 04:57:06 +0000 (12:57 +0800)]
Remove unnecessary code (#24610)

As title, remove unnecessary code.

17 months agoFix commits pushed with deploy keys not shown in dashboard (#24521)
Zettat123 [Wed, 10 May 2023 04:14:58 +0000 (12:14 +0800)]
Fix commits pushed with deploy keys not shown in dashboard (#24521)

Fix #21324

In the current logic, if the `Actor` user is not an admin user, all
activities from private organizations won't be shown even if the `Actor`
user is a member of the organization.

As mentioned in the issue, when using deploy key to make a commit and
push, the activity's `act_user_id` will be the id of the organization so
the activity won't be shown to non-admin users because the visibility of
the organization is private.

https://github.com/go-gitea/gitea/blob/55a57177600028ba8e4a480a08f1ee4d69d219d6/models/activities/action.go#L490-L503

This PR improves this logic so the activities of private organizations
can be shown.

17 months agofix: release page for empty or non-existing target (#24470)
oliverpool [Wed, 10 May 2023 03:43:55 +0000 (05:43 +0200)]
fix: release page for empty or non-existing target (#24470)

Fixes #24145

To solve the bug, I added a "computed" `TargetBehind` field to the
`Release` model, which indicates the target branch of a release.
This is particularly useful if the target branch was deleted in the
meantime (or is empty).

I also did a micro-optimization in `calReleaseNumCommitsBehind`. Instead
of checking that a branch exists and then call `GetBranchCommit`, I
immediately call `GetBranchCommit` and handle the `git.ErrNotExist`
error.

This optimization is covered by the added unit test.

17 months agoFilter get single commit (#24613)
Matthew Walowski [Wed, 10 May 2023 01:34:07 +0000 (18:34 -0700)]
Filter get single commit (#24613)

Pretty much the same thing as #24568 but for getting a single commit
instead of getting a list of commits

17 months agoAttach a tooltip to the action status icon (#24614)
Yarden Shoham [Tue, 9 May 2023 19:39:16 +0000 (22:39 +0300)]
Attach a tooltip to the action status icon (#24614)

To clearly communicate the current state of the action

![image](https://github.com/go-gitea/gitea/assets/20454870/5d6de6b9-f34f-417d-b08e-fcd1b99b3079)
![image](https://github.com/go-gitea/gitea/assets/20454870/b976676a-4525-43e7-866f-8933be1a5dfd)
![image](https://github.com/go-gitea/gitea/assets/20454870/2e0a55fe-658f-4242-83de-b857a8b55f31)
![image](https://github.com/go-gitea/gitea/assets/20454870/6b42bcd1-c499-41ac-8419-1c4e60085d47)
![image](https://github.com/go-gitea/gitea/assets/20454870/363fcff8-fe61-4363-a04b-2db93cfc4fa3)
![image](https://github.com/go-gitea/gitea/assets/20454870/f8f59b68-93de-4f31-b9b0-24d94990d1d0)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoUse official Vue extension in Gitpod (#24609)
Yarden Shoham [Tue, 9 May 2023 18:03:50 +0000 (21:03 +0300)]
Use official Vue extension in Gitpod (#24609)

The previous one didn't work well

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
17 months agoCreate a branch directly from commit on the create branch API (#22956)
来自村里的小螃蟹 [Tue, 9 May 2023 10:22:32 +0000 (18:22 +0800)]
Create a branch directly from commit on the create branch API (#22956)

#### Added
- API: Create a branch directly from commit on the create branch API
- Added `old_ref_name` parameter to allow creating a new branch from a
specific commit, tag, or branch.
- Deprecated `old_branch_name` parameter in favor of the new
`old_ref_name` parameter.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
17 months agoMake repository response support HTTP range request (#24592)
wxiaoguang [Tue, 9 May 2023 07:34:36 +0000 (15:34 +0800)]
Make repository response support HTTP range request (#24592)

Replace #20480
Replace #18448

Close #16414

17 months agoAdd Gitea Profile Readmes (#23260)
Nicholas Pease [Tue, 9 May 2023 05:57:24 +0000 (01:57 -0400)]
Add Gitea Profile Readmes (#23260)

Implements displaying a README.md file present in a users ```.profile```
repository on the users profile page. If no such repository/file is
present, the user's profile page remains unchanged.

Example of user with ```.profile/README.md```

![image](https://user-images.githubusercontent.com/34464552/222757202-5d53ac62-60d9-432f-b9e3-2537ffa91041.png)

Example of user without ```.profile/README.md```

![image](https://user-images.githubusercontent.com/34464552/222759972-576e058b-acd4-47ac-be33-38a7cb58cc81.png)

This pull request closes the feature request in #12233

Special thanks to @techknowlogick for the help in the Gitea discord!

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
17 months agoMake diff view full width again (#24598)
wxiaoguang [Tue, 9 May 2023 05:21:03 +0000 (13:21 +0800)]
Make diff view full width again (#24598)

Regression of #24459 , [the related
line](https://github.com/go-gitea/gitea/pull/24459/files#diff-f255004de8d715ff40852710390429bf2a06e7e33a4e3f8ad568af636557ac71L8)

The PR file diff view needs to be full-screen width.

17 months agoAdd permission check for moving issue action in project view page (#24589)
yp05327 [Tue, 9 May 2023 04:50:16 +0000 (13:50 +0900)]
Add permission check for moving issue action in project view page (#24589)

Fix #22954
Only users who have write permission can move issues in the project view page.

17 months agoUpdate JS dependencies, add new eslint rules (#24597)
silverwind [Tue, 9 May 2023 02:35:49 +0000 (04:35 +0200)]
Update JS dependencies, add new eslint rules (#24597)

- Update all JS dependencies
- Enable new eslint rules, fix issue (some via autofix)
- Fix some missed eslint rule renames from [unicorn
v25](https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v25.0.0)
- Tested Monaco, Katex, Swagger UI

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFilters for GetAllCommits (#24568)
Matthew Walowski [Tue, 9 May 2023 01:06:05 +0000 (18:06 -0700)]
Filters for GetAllCommits (#24568)

The `GetAllCommits` endpoint can be pretty slow, especially in repos
with a lot of commits. The issue is that it spends a lot of time
calculating information that may not be useful/needed by the user.

The `stat` param was previously added in #21337 to address this, by
allowing the user to disable the calculating stats for each commit. But
this has two issues:
1. The name `stat` is rather misleading, because disabling `stat`
disables the Stat **and** Files. This should be separated out into two
different params, because getting a list of affected files is much less
expensive than calculating the stats
2. There's still other costly information provided that the user may not
need, such as `Verification`

This PR, adds two parameters to the endpoint, `files` and `verification`
to allow the user to explicitly disable this information when listing
commits. The default behavior is true.

17 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 9 May 2023 00:24:20 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

17 months agoAttach a tooltip to the action control button (#24595)
Yarden Shoham [Mon, 8 May 2023 23:59:59 +0000 (02:59 +0300)]
Attach a tooltip to the action control button (#24595)

The first time I saw the big red X button I thought something failed but
apparently, it was just a "Cancel" button

# Before

![image](https://user-images.githubusercontent.com/20454870/236889564-3729926a-cfb3-4e47-a8ed-51389c4f193f.png)

![image](https://user-images.githubusercontent.com/20454870/236886259-b0ab0d55-28c3-41f5-8709-8cfc6819423f.png)

![image](https://user-images.githubusercontent.com/20454870/236886081-b7a97f01-6108-4c18-9adb-11cbafd8c19c.png)

# After

![image](https://user-images.githubusercontent.com/20454870/236889690-d1dfd74d-ad7d-4571-b712-69f0dc630c6e.png)

![image](https://user-images.githubusercontent.com/20454870/236885823-0734216d-b450-4a43-bfe3-e88525a8822a.png)

![image](https://user-images.githubusercontent.com/20454870/236903320-3b415619-8aff-4e5d-994e-6faa671990db.png)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
17 months agoImprove Gitea's web context, decouple "issue template" code into service package...
wxiaoguang [Mon, 8 May 2023 23:30:14 +0000 (07:30 +0800)]
Improve Gitea's web context, decouple "issue template" code into service package (#24590)

1. Remove unused fields/methods in web context.
2. Make callers call target function directly instead of the light
wrapper like "IsUserRepoReaderSpecific"
3. The "issue template" code shouldn't be put in the "modules/context"
package, so move them to the service package.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoSupport markdown editor for issue template (#24400)
yp05327 [Mon, 8 May 2023 22:22:52 +0000 (07:22 +0900)]
Support markdown editor for issue template (#24400)

Fixes #24398

Task:
- [x] Reusing "textarea" like GitHub seems more friendly to users.
- [x] ^V image pasting and file uploading handling.

<details><summary>screenshots</summary>

![image](https://user-images.githubusercontent.com/18380374/235418877-00090552-ebda-411c-8e39-b47246bc8746.png)

![image](https://user-images.githubusercontent.com/18380374/235419073-dc33cad7-7626-4bce-9161-eb205c7384b5.png)
Display only one markdown editor:

![image](https://user-images.githubusercontent.com/18380374/235419098-ee21386d-2b2d-432e-bdb2-18646cc031e7.png)
Support file upload and ^V image pasting

![image](https://user-images.githubusercontent.com/18380374/235419364-7b390fa4-da56-437d-b55e-3847fbc049e7.png)

</details>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
17 months agoDo not select line numbers when selecting text from the action run logs (#24594)
Yarden Shoham [Mon, 8 May 2023 18:50:05 +0000 (21:50 +0300)]
Do not select line numbers when selecting text from the action run logs (#24594)

- Fixes #24578

# Before

![image](https://user-images.githubusercontent.com/20454870/236873942-26e97f28-6595-4be9-88fa-158870eda253.png)

# After

![image](https://user-images.githubusercontent.com/20454870/236874171-8f0182a5-e953-4740-b875-f3542dee8325.png)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoIn TestViewRepo2, convert computed timezones to local time (#24579)
Nick [Mon, 8 May 2023 13:07:41 +0000 (09:07 -0400)]
In TestViewRepo2, convert computed timezones to local time (#24579)

This fixes up https://github.com/go-gitea/gitea/pull/10446; in that, the
*expected* timezone was changed to the local timezone, but the computed
timezone was left in UTC.

The result was this failure, when run on a non-UTC system:

```
Diff:
    --- Expected
    +++ Actual
    @@ -5,3 +5,3 @@
       commitMsg: (string) (len=12) "init project",
    -  commitTime: (string) (len=29) "Wed, 14 Jun 2017 09:54:21 EDT"
    +  commitTime: (string) (len=29) "Wed, 14 Jun 2017 13:54:21 UTC"
      },
    @@ -11,3 +11,3 @@
       commitMsg: (string) (len=12) "init project",
    -  commitTime: (string) (len=29) "Wed, 14 Jun 2017 09:54:21 EDT"
    +  commitTime: (string) (len=29) "Wed, 14 Jun 2017 13:54:21 UTC"
      }
    Test:        TestViewRepo2
```

I assume this was probably missed since the CI servers all run in UTC?

The Format() string "Mon, 02 Jan 2006 15:04:05 UTC" was incorrect: 'UTC'
isn't recognized as a variable placeholder, but was just being copied
verbatim. It should use 'MST' in order to command Format() to output the
attached timezone, which is what `time.RFC1123` has.

17 months agoFix close org projects (#24588)
yp05327 [Mon, 8 May 2023 12:19:27 +0000 (21:19 +0900)]
Fix close org projects (#24588)

A part of #22865
We can not close org projects now. This PR will fix it.

17 months agoRewrite queue (#24505)
wxiaoguang [Mon, 8 May 2023 11:49:59 +0000 (19:49 +0800)]
Rewrite queue (#24505)

# ⚠️ Breaking

Many deprecated queue config options are removed (actually, they should
have been removed in 1.18/1.19).

If you see the fatal message when starting Gitea: "Please update your
app.ini to remove deprecated config options", please follow the error
messages to remove these options from your app.ini.

Example:

```
2023/05/06 19:39:22 [E] Removed queue option: `[indexer].ISSUE_INDEXER_QUEUE_TYPE`. Use new options in `[queue.issue_indexer]`
2023/05/06 19:39:22 [E] Removed queue option: `[indexer].UPDATE_BUFFER_LEN`. Use new options in `[queue.issue_indexer]`
2023/05/06 19:39:22 [F] Please update your app.ini to remove deprecated config options
```

Many options in `[queue]` are are dropped, including:
`WRAP_IF_NECESSARY`, `MAX_ATTEMPTS`, `TIMEOUT`, `WORKERS`,
`BLOCK_TIMEOUT`, `BOOST_TIMEOUT`, `BOOST_WORKERS`, they can be removed
from app.ini.

# The problem

The old queue package has some legacy problems:

* complexity: I doubt few people could tell how it works.
* maintainability: Too many channels and mutex/cond are mixed together,
too many different structs/interfaces depends each other.
* stability: due to the complexity & maintainability, sometimes there
are strange bugs and difficult to debug, and some code doesn't have test
(indeed some code is difficult to test because a lot of things are mixed
together).
* general applicability: although it is called "queue", its behavior is
not a well-known queue.
* scalability: it doesn't seem easy to make it work with a cluster
without breaking its behaviors.

It came from some very old code to "avoid breaking", however, its
technical debt is too heavy now. It's a good time to introduce a better
"queue" package.

# The new queue package

It keeps using old config and concept as much as possible.

* It only contains two major kinds of concepts:
    * The "base queue": channel, levelqueue, redis
* They have the same abstraction, the same interface, and they are
tested by the same testing code.
* The "WokerPoolQueue", it uses the "base queue" to provide "worker
pool" function, calls the "handler" to process the data in the base
queue.
* The new code doesn't do "PushBack"
* Think about a queue with many workers, the "PushBack" can't guarantee
the order for re-queued unhandled items, so in new code it just does
"normal push"
* The new code doesn't do "pause/resume"
* The "pause/resume" was designed to handle some handler's failure: eg:
document indexer (elasticsearch) is down
* If a queue is paused for long time, either the producers blocks or the
new items are dropped.
* The new code doesn't do such "pause/resume" trick, it's not a common
queue's behavior and it doesn't help much.
* If there are unhandled items, the "push" function just blocks for a
few seconds and then re-queue them and retry.
* The new code doesn't do "worker booster"
* Gitea's queue's handlers are light functions, the cost is only the
go-routine, so it doesn't make sense to "boost" them.
* The new code only use "max worker number" to limit the concurrent
workers.
* The new "Push" never blocks forever
* Instead of creating more and more blocking goroutines, return an error
is more friendly to the server and to the end user.

There are more details in code comments: eg: the "Flush" problem, the
strange "code.index" hanging problem, the "immediate" queue problem.

Almost ready for review.

TODO:

* [x] add some necessary comments during review
* [x] add some more tests if necessary
* [x] update documents and config options
* [x] test max worker / active worker
* [x] re-run the CI tasks to see whether any test is flaky
* [x] improve the `handleOldLengthConfiguration` to provide more
friendly messages
* [x] fine tune default config values (eg: length?)

## Code coverage:

![image](https://user-images.githubusercontent.com/2114189/236620635-55576955-f95d-4810-b12f-879026a3afdf.png)

17 months agoSplit "modules/context.go" to separate files (#24569)
wxiaoguang [Mon, 8 May 2023 09:36:54 +0000 (17:36 +0800)]
Split "modules/context.go" to separate files (#24569)

The "modules/context.go" is too large to maintain.

This PR splits it to separate files, eg: context_request.go,
context_response.go, context_serve.go

This PR will help:

1. The future refactoring for Gitea's web context (eg: simplify the context)
2. Introduce proper "range request" support
3. Introduce context function

This PR only moves code, doesn't change any logic.

17 months agoPass 'not' to commit count (#24473)
Matthew Walowski [Mon, 8 May 2023 07:10:53 +0000 (00:10 -0700)]
Pass 'not' to commit count (#24473)

Due to #24409 , we can now specify '--not' when getting all commits from
a repo to exclude commits from a different branch.

When I wrote that PR, I forgot to also update the code that counts the
number of commits in the repo. So now, if the --not option is used, it
may return too many commits, which can indicate that another page of
data is available when it is not.

This PR passes --not to the commands that count the number of commits in
a repo

17 months agoRefresh the refernce of the closed PR when reopening (#24231)
sillyguodong [Mon, 8 May 2023 06:39:32 +0000 (14:39 +0800)]
Refresh the refernce of the closed PR when reopening (#24231)

Close #24213
Replace #23830

#### Cause

- Before, in order to making PR can get latest commit after reopening,
the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR
will be updated when pushing commits to the `head branch` of the closed
PR.

#### Changes

- For closed PR , won't perform these behavior: insert`comment`, push
`notification` (UI and email), exectue
[pushToBaseRepo](https://github.com/go-gitea/gitea/blob/74225033413dc0f2b308bbe069f6d185b551e364/services/pull/pull.go#L409)
function and trigger `action` any more when pushing to the `head branch`
of the closed PR.
- Refresh the reference of the PR when reopening the closed PR (**even
if the head branch has been deleted before**). Make the reference of PR
consistent with the `head branch`.

17 months agoFix broken link in tests/e2e/README (#24576)
Steve Russo [Mon, 8 May 2023 00:52:11 +0000 (17:52 -0700)]
Fix broken link in tests/e2e/README (#24576)

17 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 8 May 2023 00:23:39 +0000 (00:23 +0000)]
[skip ci] Updated licenses and gitignores

17 months agoAdd goto issue id function (#24479)
Tyrone Yeh [Sun, 7 May 2023 15:44:16 +0000 (23:44 +0800)]
Add goto issue id function (#24479)

for
https://github.com/go-gitea/gitea/issues/4109#issuecomment-1527104992

Supports format:
`#1234`
`Org/Repo#1234`

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
17 months agoImprove decryption failure message (#24573)
wxiaoguang [Sun, 7 May 2023 11:29:43 +0000 (19:29 +0800)]
Improve decryption failure message (#24573)

Help some users like #16832 #1851

There are many users reporting similar problem: if the SECRET_KEY
mismatches, some operations (like 2FA login) only reports unclear 500
error and unclear "base64 decode error" log (some maintainers ever spent
a lot of time on debugging such problem)

The SECRET_KEY was not well-designed and it is also a kind of technical
debt. Since it couldn't be fixed easily, it's good to add clearer error
messages, then at least users could know what the real problem is.

---------

Co-authored-by: delvh <dev.lh@web.de>
17 months agoSimplify template helper functions (#24570)
wxiaoguang [Sun, 7 May 2023 09:49:46 +0000 (17:49 +0800)]
Simplify template helper functions (#24570)

To avoid bloating the template helper functions, some functions could be
provided by type methods.

And the new code `data-line-type="{{.GetHTMLDiffLineType}}"` reads
better than `data-line-type="{{DiffLineTypeToStr .GetType}}"`

After the fix, screenshots (the same as before):

<details>

![image](https://user-images.githubusercontent.com/2114189/236657918-20ce01e0-1192-443e-aeb4-6b3fe1aa2102.png)

![image](https://user-images.githubusercontent.com/2114189/236657950-ee19727f-a1fc-4133-afc7-e5d1a8c1783f.png)

</details>

17 months agoMakefile: Use portable !, not GNUish -not, with find(1). (#24565)
riastradh [Sun, 7 May 2023 04:41:33 +0000 (04:41 +0000)]
Makefile: Use portable !, not GNUish -not, with find(1). (#24565)

fix https://github.com/go-gitea/gitea/issues/24564

Co-authored-by: Taylor R Campbell <campbell+gitea@mumble.net>
17 months agoAdd org visibility label to non-organization's dashboard (#24558)
Hester Gong [Sun, 7 May 2023 00:33:43 +0000 (08:33 +0800)]
Add org visibility label to non-organization's dashboard (#24558)

17 months agoSort users and orgs on explore by recency by default (#24279)
techknowlogick [Sat, 6 May 2023 14:04:55 +0000 (10:04 -0400)]
Sort users and orgs on explore by recency by default (#24279)

This gives more "freshness" to the explore page. So it's not just the
same X users on the explore page by default, now it matches the same
sort as the repos on the explore page.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
17 months agoChange `add_on` translation to `added_on` and include placeholder for the date (...
Yarden Shoham [Sat, 6 May 2023 13:11:27 +0000 (16:11 +0300)]
Change `add_on` translation to `added_on` and include placeholder for the date (#24562)

- Very similar to #24550

The correct thing to do is to translate the entire phrase into a single
string. The previous translation assumed all languages have a space
between the "added on" and the date (and that "added on" comes before
the date).

Some languages, like Hebrew, have no space between the "added on" and
the date. For example:
```ini
added_on=נוסף ב-%s
```
("added" becomes נוסף, "on" is ב and when paired with a date we use a
dash to connect ב with the date)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: delvh <dev.lh@web.de>
17 months agoChange `valid_until` translation to `valid_until_date` and include placeholder for...
Yarden Shoham [Sat, 6 May 2023 12:37:02 +0000 (15:37 +0300)]
Change `valid_until` translation to `valid_until_date` and include placeholder for the date (#24563)

- Similar to #24550
- Similar to #24562

The correct thing to do is to translate the entire phrase into a single
string. The previous translation assumed all languages have a space
between the "valid until" and the date (and that "valid until" comes
before the date).

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoFix docs failing the build on `main` (#24561)
Yarden Shoham [Sat, 6 May 2023 11:52:44 +0000 (14:52 +0300)]
Fix docs failing the build on `main` (#24561)

Regression from https://github.com/go-gitea/gitea/pull/23380

First failing build: https://drone.gitea.io/go-gitea/gitea/74565
https://github.com/go-gitea/gitea/actions/runs/4897332409/jobs/8745242395

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoImprove wiki user title test (#24559)
wxiaoguang [Sat, 6 May 2023 11:24:18 +0000 (19:24 +0800)]
Improve wiki user title test (#24559)

The `..` should be covered by TestUserTitleToWebPath.

Otherwise, if the random string is "..", it causes unnecessary failure
in TestUserWebGitPathConsistency

17 months agoFix incorrect user visibility (#24557)
Zettat123 [Sat, 6 May 2023 10:54:26 +0000 (18:54 +0800)]
Fix incorrect user visibility (#24557)

Fix #24555

17 months agoChange `join_on` translation to `joined_on` and include placeholder for the date...
Yarden Shoham [Sat, 6 May 2023 10:10:30 +0000 (13:10 +0300)]
Change `join_on` translation to `joined_on` and include placeholder for the date (#24550)

The correct thing to do is to translate the entire phrase into a single
string. The previous translation assumed all languages have a space
between the "joined on" and the date (and that "joined on" comes before
the date).

Some languages, like Hebrew, have no space between the "joined on" and
the date. For example:
```ini
joined_on=נרשם ב-%s
```
("joined" becomes נרשם, "on" is ב and when paired with a date we use a
dash to connect ב with the date)

17 months agoRequire at least one unit to be enabled (#24189)
Lunny Xiao [Sat, 6 May 2023 09:39:06 +0000 (17:39 +0800)]
Require at least one unit to be enabled (#24189)

Don't remember why the previous decision that `Code` and `Release` are
non-disable units globally. Since now every unit include `Code` could be
disabled, maybe we should have a new rule that the repo should have at
least one unit. So any unit could be disabled.

Fixes #20960
Fixes #7525

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: yp05327 <576951401@qq.com>
17 months agoFix broken `README` link (#24546)
JakobDev [Sat, 6 May 2023 08:16:06 +0000 (10:16 +0200)]
Fix broken `README` link (#24546)

17 months agoCheck latest version on CI (#24556)
Lunny Xiao [Sat, 6 May 2023 07:43:56 +0000 (15:43 +0800)]
Check latest version on CI (#24556)

17 months agoAdd RPM registry (#23380)
KN4CK3R [Fri, 5 May 2023 20:33:37 +0000 (22:33 +0200)]
Add RPM registry (#23380)

Fixes #20751

This PR adds a RPM package registry. You can follow [this
tutorial](https://opensource.com/article/18/9/how-build-rpm-packages) to
build a *.rpm package for testing.

This functionality is similar to the Debian registry (#22854) and
therefore shares some methods. I marked this PR as blocked because it
should be merged after #22854.

![grafik](https://user-images.githubusercontent.com/1666336/223806549-d8784fd9-9d79-46a2-9ae2-f038594f636a.png)

17 months agoDocs for Gitea Actions (#24405)
Jason Song [Fri, 5 May 2023 20:07:20 +0000 (04:07 +0800)]
Docs for Gitea Actions (#24405)

A new documentation section for Gitea Actions.

Some content comes from:

- [Hacking on Gitea
Actions](https://blog.gitea.io/2023/03/hacking-on-gitea-actions/)
- The README of [act_runner](https://gitea.com/gitea/act_runner)
- @ChristopherHX's excellent overview of the differences between Gitea
Actions and GitHub Actions in [this
comment](https://github.com/go-gitea/gitea/issues/13539#issuecomment-1448888850).

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
17 months agoUpdate LDAP filters to include both username and email address (#24547)
Gary Moon [Fri, 5 May 2023 18:18:53 +0000 (14:18 -0400)]
Update LDAP filters to include both username and email address (#24547)

Since the login form label for user_name unconditionally displays
`Username or Email Address` for the `user_name` field, bring matching
LDAP filters to more prominence in the documentation/placeholders.

Signed-off-by: Gary Moon <gary@garymoon.net>
17 months agoTemporarily disable PATs until next release (#24527)
Kyle D [Fri, 5 May 2023 15:41:44 +0000 (11:41 -0400)]
Temporarily disable PATs until next release (#24527)

This might be a bit contentious, but I think we should try to limit the
impact of deprecating scoped PATs with the rewrite proposed here we're
working on for v1.20: https://github.com/go-gitea/gitea/issues/24501

We should have a PR opened shortly to re-scope the routes.

17 months agoReplace placeholders in licenses (#24354)
Jason Song [Fri, 5 May 2023 13:46:17 +0000 (21:46 +0800)]
Replace placeholders in licenses (#24354)

Replace #22117. Implement it in a more maintainable way.

Some licenses have placeholders e.g. the BSD licenses start with this
line:
```
Copyright (c) <year> <owner>.
```
This PR replaces the placeholders with the correct value when initialize
a new repo.

### FAQ

- Why not use a regex?
It will be a pretty complicated regex which could be hard to maintain.

- There're still missing placeholders.
There are over 500 licenses, it's impossible for anyone to inspect all
of them alone. Please help to add them if you find any, and it is also
OK to leave them for the future.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix the permission of team's `Actions` unit issue (#24536)
sillyguodong [Fri, 5 May 2023 12:02:30 +0000 (20:02 +0800)]
Fix the permission of team's `Actions` unit issue (#24536)

close #24449

The unit of `Actions` should be contorlled not only by
`repository.DISABLED_REPO_UNITS` but also by `actions.ENABLED`
in the `app.ini`.
Previously, the permission of the team's `Actions` unit was not
controlled by `actions.Enabled`. So, even if the user sets
`actions.Enabled` to false, he can still select the permission of the
`Actions` unit for the team.

This PR makes the permissions of the team's `Actions` unit also
controlled by `actions.Enabled`. Just append`TypeActions` into
`DisabledRepoUnits` slice when initializing if `actions.Enabled` is
false.

### Changes:

If `Actions` is set disbaled in `app.ini`, like below:
```yaml
[actions]
ENABLED = false
```

1. If user try to create/edit a team, will prompt user that `Actions` is disabled.

![image](https://user-images.githubusercontent.com/33891828/236370415-961082b2-82d2-4d9e-8025-83872ad08cbb.png)

2. `actions` is not displayed in the sidebar on the team details page

![image](https://user-images.githubusercontent.com/33891828/236371817-f39f9bc9-5926-4b88-b5e6-d93617fcfb07.png)

17 months agoBump golang deps (#24533)
techknowlogick [Fri, 5 May 2023 09:17:19 +0000 (05:17 -0400)]
Bump golang deps (#24533)

17 months agoFix mirrors repository disapeared on user dashboard (#24520)
Lunny Xiao [Fri, 5 May 2023 08:41:21 +0000 (16:41 +0800)]
Fix mirrors repository disapeared on user dashboard (#24520)

Fix regression from #23405

17 months agoRevert "Prevent a user with a different email from accepting the team invite" (#24531)
Lunny Xiao [Fri, 5 May 2023 07:59:12 +0000 (15:59 +0800)]
Revert "Prevent a user with a different email from accepting the team invite" (#24531)

Reverts go-gitea/gitea#24491

17 months agoFix form method/class (#24535)
wxiaoguang [Fri, 5 May 2023 05:14:22 +0000 (13:14 +0800)]
Fix form method/class (#24535)

Fix #24534

17 months agoFix typo in rename branch dialog (#24537)
sillyguodong [Fri, 5 May 2023 04:44:59 +0000 (12:44 +0800)]
Fix typo in rename branch dialog (#24537)

Fix https://github.com/go-gitea/gitea/pull/24512#discussion_r1185664695

17 months agoCheck length of `LogIndexes` in case it is outdated (#24516)
Jason Song [Fri, 5 May 2023 03:37:43 +0000 (11:37 +0800)]
Check length of `LogIndexes` in case it is outdated (#24516)

Fix #24458

17 months agoHarmonize title formatting in `docs/content/doc/development/api-usage.en-us.md` ...
Benjamin Loison [Fri, 5 May 2023 03:11:54 +0000 (05:11 +0200)]
Harmonize title formatting in `docs/content/doc/development/api-usage.en-us.md` (#24529)

17 months agoautomate locking closed threads (#24525)
techknowlogick [Fri, 5 May 2023 02:17:29 +0000 (22:17 -0400)]
automate locking closed threads (#24525)

With comments happening on closed issues/prs this locks issues that have
been closed for >45days. This allows for comments on recently closed
issues/prs to still happen.

---------

Co-authored-by: silverwind <me@silverwind.io>
17 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 5 May 2023 00:22:45 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin