]> source.dussan.org Git - gitea.git/log
gitea.git
16 months agoRemove stars when repo goes private (#19904)
Wim [Mon, 5 Jun 2023 13:25:43 +0000 (15:25 +0200)]
Remove stars when repo goes private (#19904)

Fixes #18600

16 months agoUse correct selector for hiding RSS icon link in the branch selector dropdown (#25080)
wxiaoguang [Mon, 5 Jun 2023 12:34:25 +0000 (20:34 +0800)]
Use correct selector for hiding RSS icon link in the branch selector dropdown (#25080)

Fix  #25079

![image](https://github.com/go-gitea/gitea/assets/2114189/5d3f2f49-018a-4b75-8c90-ffafd898697a)

![image](https://github.com/go-gitea/gitea/assets/2114189/3e9dcf2e-eca7-4e96-be79-3b26f222cdb9)

![image](https://github.com/go-gitea/gitea/assets/2114189/855fffa4-0220-4ca2-a5e0-58c376fdc378)

![image](https://github.com/go-gitea/gitea/assets/2114189/f5ffa7e6-a974-4698-a45d-e38091903be1)

16 months agoFix parallelly generating index failure with Mysql (#24567)
Lunny Xiao [Mon, 5 Jun 2023 10:33:47 +0000 (18:33 +0800)]
Fix parallelly generating index failure with Mysql (#24567)

16 months agoUse git command instead of the ini package to remove the `origin` remote (#25066)
Lunny Xiao [Mon, 5 Jun 2023 10:05:31 +0000 (18:05 +0800)]
Use git command instead of the ini package to remove the `origin` remote (#25066)

16 months agoimprove permission documentation (#23942)
Lunny Xiao [Mon, 5 Jun 2023 07:43:17 +0000 (15:43 +0800)]
improve permission documentation (#23942)

16 months agoUse RepositoryList instead of []*Repository (#25074)
Lunny Xiao [Mon, 5 Jun 2023 07:25:47 +0000 (15:25 +0800)]
Use RepositoryList instead of []*Repository (#25074)

16 months agoAdd ability to set multiple redirect URIs in OAuth application UI (#25072)
Denys Konovalov [Mon, 5 Jun 2023 07:00:12 +0000 (09:00 +0200)]
Add ability to set multiple redirect URIs in OAuth application UI (#25072)

OAuth applications can already have multiple redirect URIs if
created/edited over API.

This change allows for setting multiple redirect URIs through the UI as
a comma-separated list (e. g.
`https://example.org/redirect,https://redirect.example.org`)

<details>
<summary>Screenshots</summary>

![Bildschirmfoto vom 2023-06-04
17-14-40](https://github.com/go-gitea/gitea/assets/47871822/2206dc32-e7e4-4953-9ecb-e098890b3f54)
![Bildschirmfoto vom 2023-06-04
17-14-50](https://github.com/go-gitea/gitea/assets/47871822/cd97c73c-9310-44ee-a83a-b927a1ef94da)

</details>

Closes #25068

16 months agoAdd Progressbar to Milestone Page (#25050)
JakobDev [Mon, 5 Jun 2023 06:25:46 +0000 (08:25 +0200)]
Add Progressbar to Milestone Page (#25050)

This is adds the progress bar, which is already on the Milestone List,
also to the Page of a Single Milestone.

![grafik](https://github.com/go-gitea/gitea/assets/15185051/24e0fa28-369b-4bb9-807a-ee823b46ba81)

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 5 Jun 2023 00:27:49 +0000 (00:27 +0000)]
[skip ci] Updated licenses and gitignores

16 months agoRedesign Scoped Access Tokens (#24767)
Jack Hay [Sun, 4 Jun 2023 18:57:16 +0000 (14:57 -0400)]
Redesign Scoped Access Tokens (#24767)

## Changes
- Adds the following high level access scopes, each with `read` and
`write` levels:
    - `activitypub`
    - `admin` (hidden if user is not a site admin)
    - `misc`
    - `notification`
    - `organization`
    - `package`
    - `issue`
    - `repository`
    - `user`
- Adds new middleware function `tokenRequiresScopes()` in addition to
`reqToken()`
  -  `tokenRequiresScopes()` is used for each high-level api section
- _if_ a scoped token is present, checks that the required scope is
included based on the section and HTTP method
  - `reqToken()` is used for individual routes
- checks that required authentication is present (but does not check
scope levels as this will already have been handled by
`tokenRequiresScopes()`
- Adds migration to convert old scoped access tokens to the new set of
scopes
- Updates the user interface for scope selection

### User interface example
<img width="903" alt="Screen Shot 2023-05-31 at 1 56 55 PM"
src="https://github.com/go-gitea/gitea/assets/23248839/654766ec-2143-4f59-9037-3b51600e32f3">
<img width="917" alt="Screen Shot 2023-05-31 at 1 56 43 PM"
src="https://github.com/go-gitea/gitea/assets/23248839/1ad64081-012c-4a73-b393-66b30352654c">

## tokenRequiresScopes  Design Decision
- `tokenRequiresScopes()` was added to more reliably cover api routes.
For an incoming request, this function uses the given scope category
(say `AccessTokenScopeCategoryOrganization`) and the HTTP method (say
`DELETE`) and verifies that any scoped tokens in use include
`delete:organization`.
- `reqToken()` is used to enforce auth for individual routes that
require it. If a scoped token is not present for a request,
`tokenRequiresScopes()` will not return an error

## TODO
- [x] Alphabetize scope categories
- [x] Change 'public repos only' to a radio button (private vs public).
Also expand this to organizations
- [X] Disable token creation if no scopes selected. Alternatively, show
warning
- [x] `reqToken()` is missing from many `POST/DELETE` routes in the api.
`tokenRequiresScopes()` only checks that a given token has the correct
scope, `reqToken()` must be used to check that a token (or some other
auth) is present.
   -  _This should be addressed in this PR_
- [x] The migration should be reviewed very carefully in order to
minimize access changes to existing user tokens.
   - _This should be addressed in this PR_
- [x] Link to api to swagger documentation, clarify what
read/write/delete levels correspond to
- [x] Review cases where more than one scope is needed as this directly
deviates from the api definition.
   - _This should be addressed in this PR_
   - For example:
   ```go
m.Group("/users/{username}/orgs", func() {
m.Get("", reqToken(), org.ListUserOrgs)
m.Get("/{org}/permissions", reqToken(), org.GetUserOrgsPermissions)
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryUser,
auth_model.AccessTokenScopeCategoryOrganization),
context_service.UserAssignmentAPI())
   ```

## Future improvements
- [ ] Add required scopes to swagger documentation
- [ ] Redesign `reqToken()` to be opt-out rather than opt-in
- [ ] Subdivide scopes like `repository`
- [ ] Once a token is created, if it has no scopes, we should display
text instead of an empty bullet point
- [ ] If the 'public repos only' option is selected, should read
categories be selected by default

Closes #24501
Closes #24799

Co-authored-by: Jonathan Tran <jon@allspice.io>
Co-authored-by: Kyle D <kdumontnu@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
16 months agoUse a separate admin page to show global stats, remove `actions` stat (#25062)
wxiaoguang [Sat, 3 Jun 2023 14:03:41 +0000 (22:03 +0800)]
Use a separate admin page to show global stats, remove `actions` stat (#25062)

Before, Gitea shows the database table stats on the `admin dashboard`
page.

It has some problems:

* `count(*)` is quite heavy. If tables have many records, this blocks
loading the admin page blocks for a long time
* Some users had even reported issues that they can't visit their admin
page because this page causes blocking or `50x error (reverse proxy
timeout)`
* The `actions` stat is not useful. The table is simply too large. Does
it really matter if it contains 1,000,000 rows or 9,999,999 rows?
* The translation `admin.dashboard.statistic_info` is difficult to
maintain.

So, this PR uses a separate page to show the stats and removes the
`actions` stat.

![image](https://github.com/go-gitea/gitea/assets/2114189/babf7c61-b93b-4a62-bfaa-22983636427e)

## :warning: BREAKING

The `actions` Prometheus metrics collector has been removed for the
reasons mentioned beforehand.
Please do not rely on its output anymore.

16 months agoRemove cancel button from branch protection form (#25063)
Yarden Shoham [Sat, 3 Jun 2023 12:06:09 +0000 (15:06 +0300)]
Remove cancel button from branch protection form (#25063)

It caused bugs. To cancel, just navigate away.

- Follows #21381 and #21872
- Resolves #25038

## Before

![image](https://github.com/go-gitea/gitea/assets/20454870/068c8d96-fc50-4725-8af2-d953e9f39024)

## After

![image](https://github.com/go-gitea/gitea/assets/20454870/105d5c50-e490-456a-a253-269b174c09ab)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
16 months agoAllow for PKCE flow without client secret + add docs (#25033)
Denys Konovalov [Sat, 3 Jun 2023 03:59:28 +0000 (05:59 +0200)]
Allow for PKCE flow without client secret + add docs (#25033)

The PKCE flow according to [RFC
7636](https://datatracker.ietf.org/doc/html/rfc7636) allows for secure
authorization without the requirement to provide a client secret for the
OAuth app.

It is implemented in Gitea since #5378 (v1.8.0), however without being
able to omit client secret.
Since #21316 Gitea supports setting client type at OAuth app
registration.

As public clients are already forced to use PKCE since #21316, in this
PR the client secret check is being skipped if a public client is
detected. As Gitea seems to implement PKCE authorization correctly
according to the spec, this would allow for PKCE flow without providing
a client secret.

Also add some docs for it, please check language as I'm not a native
English speaker.

Closes #17107
Closes #25047

16 months agoFix link to customizing-gitea (#25056)
kodermho [Sat, 3 Jun 2023 02:27:40 +0000 (22:27 -0400)]
Fix link to customizing-gitea (#25056)

The link to customizing-gitea in the label documentation is broken. This
PR should adjust the relative path to fix the link

16 months agoGitLab migration: Sanitize response for reaction list (#25054)
6543 [Fri, 2 Jun 2023 20:35:50 +0000 (22:35 +0200)]
GitLab migration: Sanitize response for reaction list (#25054)

16 months agoAdd up and down arrows to selected lookup repositories (#24727)
Tyrone Yeh [Fri, 2 Jun 2023 18:39:07 +0000 (02:39 +0800)]
Add up and down arrows to selected lookup repositories (#24727)

Use up and down arrow key to select repositories

![image](https://github.com/go-gitea/gitea/assets/1255041/3f3bce64-86d9-4b37-994b-3d129ebf48d9)

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoShow file tree by default (#25052)
Kyle D [Fri, 2 Jun 2023 15:39:01 +0000 (11:39 -0400)]
Show file tree by default (#25052)

Feel free to close this if there isn't interest.

The tree view looks amazing, and all of our users are really enjoying it
(major kudos to developers!), but only IF I tell them it exists!

Essentially, the file tree view as it is effectively undiscoverable.

This PR changes the default state for the tree view to open, which
should significantly help with discoverability.

An alternative could be to reserve more horizontal space, as a typical
accordion panel would look (eg. VS Code), eg.

![image](https://github.com/go-gitea/gitea/assets/12700993/505ea40c-42b1-4111-b306-48e51e8e2130)

16 months agoMinor UI improvements: logo alignment, auth map editor, auth name display (#25043)
wxiaoguang [Fri, 2 Jun 2023 10:02:20 +0000 (18:02 +0800)]
Minor UI improvements: logo alignment, auth map editor, auth name display (#25043)

Some minor UI improvements together (then no need to review 3 small PRs)

# The Map for auth sources

Close #24826

Now the LDAP and OAuth2 both have multiple line editor for the map (and
it can be resized by the handler)

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/7eed1618-0d71-4df2-84bd-ca20a06c02db)

![image](https://github.com/go-gitea/gitea/assets/2114189/a94dc6dc-0e3b-4185-bac1-8d16561b8e62)

</details>

# The account link display

Before, the UI is misaligned

This PR fixes the misalignment, remove "float right", and show the auth
source name and auth type (in the tooltip).

And the "active" color is changed from dark red to primary color.

Before:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/3bb4a8f2-2f66-4d62-ac96-096f14aeb819)

</details>

After:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/05ca46ae-7769-422d-a52a-b7402679cd05)

</details>

# The UI logo alignment

Changed file: `css/base.css`.

Before, there were some "fine tunes", these "fine tunes" only causes
misalignment.

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/395b03c2-6e8c-4742-abf9-8d548dab908d)

</details>

After this PR:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/3339acdc-7391-45bc-b6ec-a5b3bc7830a6)

![image](https://github.com/go-gitea/gitea/assets/2114189/656a7bee-cdfb-4232-aee9-25b76cae8e00)

</details>

16 months agoRefactor INI package (first step) (#25024)
wxiaoguang [Fri, 2 Jun 2023 09:27:30 +0000 (17:27 +0800)]
Refactor INI package (first step) (#25024)

The INI package has many bugs and quirks, and in fact it is
unmaintained.

This PR is the first step for the INI package refactoring:

* Use Gitea's "config_provider" to provide INI access
* Deprecate the INI package by golangci.yml rule

16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 2 Jun 2023 00:26:50 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

16 months agoAdd button on diff header to copy file name, misc diff header tweaks (#24986)
silverwind [Thu, 1 Jun 2023 10:47:28 +0000 (12:47 +0200)]
Add button on diff header to copy file name, misc diff header tweaks (#24986)

1. Add this button:

<img width="232" alt="Screenshot 2023-05-29 at 15 21 47"
src="https://github.com/go-gitea/gitea/assets/115237/5eaf6bd1-83db-4ffc-9503-eda0c59807d2">
<img width="297" alt="Screenshot 2023-05-29 at 15 20 22"
src="https://github.com/go-gitea/gitea/assets/115237/708a344f-f6d7-4229-bfda-76e1571b42c8">

2. Correct `button-link` styles to not have a background hover effect.
3. Tweak `.ui.container` padding to be the same for fluid and non-fluid.

4. Misc enhancements to diff header:

Before:
<img width="984" alt="Screenshot 2023-05-29 at 15 38 53"
src="https://github.com/go-gitea/gitea/assets/115237/c7926f6a-bd0a-4b05-97ad-c91fc25c62d5">

After:
<img width="987" alt="Screenshot 2023-05-29 at 15 43 10"
src="https://github.com/go-gitea/gitea/assets/115237/0149f545-45f8-42cf-b443-e1c76bd5cdeb">

16 months agoFix users cannot visit issue attachment bug (#25019)
Lunny Xiao [Wed, 31 May 2023 17:06:17 +0000 (01:06 +0800)]
Fix users cannot visit issue attachment bug (#25019)

Caused by #24362

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix incorrect issuel filter menu style (#25018)
wxiaoguang [Wed, 31 May 2023 10:44:28 +0000 (18:44 +0800)]
Fix incorrect issuel filter menu style (#25018)

Before:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/b67b3a83-ebe4-4dac-b4b2-de93401d7ab2)

</details>

After:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/fbf34418-2ddf-4d47-82da-155823501d31)

![image](https://github.com/go-gitea/gitea/assets/2114189/1b275de3-8c16-4873-b056-0df430c882f0)

</details>

16 months agoUpdate repo's default branch when adding new files in an empty one (#25017)
wxiaoguang [Wed, 31 May 2023 09:07:51 +0000 (17:07 +0800)]
Update repo's default branch when adding new files in an empty one (#25017)

Fix #25014

Only API needs this fix. On the Web UI, users could only add new file on
the default branch.

16 months agoRename NotifyPullReviewRequest to NotifyPullRequestReviewRequest (#24988)
谈笑风生间 [Wed, 31 May 2023 07:54:46 +0000 (15:54 +0800)]
Rename NotifyPullReviewRequest to NotifyPullRequestReviewRequest (#24988)

after #24481

To keep consistent, maybe pull_request_review_request is better.

## what my pull request does

Rename NotifyPullReviewRequest to NotifyPullRequestReviewRequest.

<img width="1087" alt="image"
src="https://github.com/go-gitea/gitea/assets/75628309/2cf91f02-74f2-42fe-a998-0a039b821d8d">

16 months agoMerge `new project` templates into one (#24985)
delvh [Wed, 31 May 2023 06:50:18 +0000 (08:50 +0200)]
Merge `new project` templates into one (#24985)

Additionally simplify the `new project` template slightly.

Review hint: Disable whitespace changes.

<details><summary>Before</summary>

## New repo project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/4de977e8-3688-45cd-8832-49b001e6f249)

## Edit repo project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/daaf353f-6c99-48bd-b37a-a3bc64459079)

## New user/org project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/6a5a3be5-f51a-4599-b75c-7adb9710d2fa)

## Edit user/org project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/a4768f49-cf46-4773-8a0f-54dfdcc1c1b8)
</details>

<details><summary>After</summary>

## New repo project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/3d0ac8a0-850a-4743-963c-71c66ef38d07)

## Edit repo project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/6b86a1cd-e360-4a9b-aaf7-af032d0d991a)

## New user/org project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/a7b0964c-e4c7-4924-842a-52a58499bc36)

## Edit user/org project

![grafik](https://github.com/go-gitea/gitea/assets/51889757/0fbc5605-afee-49bd-a44a-8646f8c55681)
</details>

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAdd chinese documentations for `cran package registry` (#25012)
sillyguodong [Wed, 31 May 2023 06:14:31 +0000 (14:14 +0800)]
Add chinese documentations for `cran package registry` (#25012)

As title.

16 months agoRemove the service worker (#25010)
silverwind [Wed, 31 May 2023 02:07:04 +0000 (04:07 +0200)]
Remove the service worker (#25010)

It's been disabled by default since 1.17
(https://github.com/go-gitea/gitea/pull/18914), and it never really
delivered any benefit except being another cache layer that has its own
unsolved invalidation issues. HTTP cache works, we don't need two cache
layers at the browser for assets.

## :warning: BREAKING

You can remove the config `[ui].USE_SERVICE_WORKER` from your `app.ini`
now.

16 months agoAdd user level action runners (#24995)
HesterG [Wed, 31 May 2023 01:39:54 +0000 (09:39 +0800)]
Add user level action runners (#24995)

Used similar logic to organization.

<img width="1437" alt="Screen Shot 2023-05-30 at 10 18 06"
src="https://github.com/go-gitea/gitea/assets/17645053/49f3800a-44ae-4188-b1e6-91d49e3d7868">

<img width="1331" alt="Screen Shot 2023-05-30 at 10 31 18"
src="https://github.com/go-gitea/gitea/assets/17645053/221b2068-e9b9-4e34-bb4a-d390594b2f35">

16 months agoUpdate github.com/google/go-github to v52 (#24004)
6543 [Wed, 31 May 2023 00:31:51 +0000 (02:31 +0200)]
Update github.com/google/go-github to v52 (#24004)

based on https://github.com/google/go-github/pull/2743

because of
https://github.com/go-gitea/gitea/pull/23946#discussion_r1160317554

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agovarious style fixes (#25008)
Denys Konovalov [Tue, 30 May 2023 22:28:25 +0000 (00:28 +0200)]
various style fixes (#25008)

- fixing various style issues (border color/radius, margin)
- added indent at some radio input blocks
---
### Before:
![Bildschirmfoto vom 2023-05-30
17-14-15](https://github.com/go-gitea/gitea/assets/47871822/59963646-d34f-4032-bd02-dbb48747b96d)

![Bildschirmfoto vom 2023-05-30
17-13-21](https://github.com/go-gitea/gitea/assets/47871822/87b67a35-8fbf-47ad-9903-499403dcebb5)

![Bildschirmfoto vom 2023-05-30
17-12-54](https://github.com/go-gitea/gitea/assets/47871822/6c92b427-ee54-42b1-b206-400e33d705ed)

![Bildschirmfoto vom 2023-05-30
17-05-29](https://github.com/go-gitea/gitea/assets/47871822/bd8d201d-bbc3-4c71-84fb-fb393d3c36bb)

![Bildschirmfoto vom 2023-05-30
17-04-36](https://github.com/go-gitea/gitea/assets/47871822/5f7a4e2a-f140-4162-8f3e-294356b42dee)

![Bildschirmfoto vom 2023-05-30
17-06-05](https://github.com/go-gitea/gitea/assets/47871822/d09e46b5-5e8f-41f1-af4b-24bc8cc12c21)

![Bildschirmfoto vom 2023-05-30
17-09-35](https://github.com/go-gitea/gitea/assets/47871822/179dd3f5-914d-4593-8698-46fdffd02d54)

### After:

![Bildschirmfoto vom 2023-05-30
17-14-03](https://github.com/go-gitea/gitea/assets/47871822/a404c53e-cd25-41bb-aece-bedf90c2e8ed)

![Bildschirmfoto vom 2023-05-30
17-13-35](https://github.com/go-gitea/gitea/assets/47871822/2ea8779c-9d13-44e7-8ad6-ebac10fac465)

![Bildschirmfoto vom 2023-05-30
17-12-45](https://github.com/go-gitea/gitea/assets/47871822/b34ffeb9-a7e8-4900-97ee-1894f91e189c)

![Bildschirmfoto vom 2023-05-30
17-05-18](https://github.com/go-gitea/gitea/assets/47871822/f8d18360-db3e-472a-9e86-575e6dcb4f36)

![Bildschirmfoto vom 2023-05-30
17-04-49](https://github.com/go-gitea/gitea/assets/47871822/12fc20d6-4fa5-4ac4-b788-a1506647ef47)

![Bildschirmfoto vom 2023-05-30
17-06-23](https://github.com/go-gitea/gitea/assets/47871822/2a82f8e9-3455-4619-9a2e-352c40c4e0b6)

![Bildschirmfoto vom 2023-05-30
17-11-26](https://github.com/go-gitea/gitea/assets/47871822/ab408878-45fb-4713-84c4-5777705a98ab)

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoAdd show timestamp/seconds and fullscreen options to action page (#24876)
HesterG [Tue, 30 May 2023 20:38:55 +0000 (04:38 +0800)]
Add show timestamp/seconds and fullscreen options to action page (#24876)

Part of #24728

- The timestamp shows local time and is parsed by `date.toLocaleString`;
- "show seconds" and "show timestamps" are mutually exclusive, and they
can be both hidden.

https://github.com/go-gitea/gitea/assets/17645053/89531e54-37b7-4400-a6a0-bb3cc69eb6f5

Update for timestamp format:

<img width="306" alt="Screen Shot 2023-05-25 at 09 07 47"
src="https://github.com/go-gitea/gitea/assets/17645053/2d99768d-d39c-4c9e-81a2-7bc7470399dd">

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
16 months agoFix markdown link to awesome gitea (#25009)
John Olheiser [Tue, 30 May 2023 18:10:51 +0000 (13:10 -0500)]
Fix markdown link to awesome gitea (#25009)

Fixes the markdown link and uses title case like the other
translations.

16 months agoFollowup to pinned Issues (#24945)
JakobDev [Tue, 30 May 2023 15:26:51 +0000 (17:26 +0200)]
Followup to pinned Issues (#24945)

This addressees some things from #24406 that came up after the PR was
merged. Mostly from @delvh.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
16 months agorevert the removed method to fix tmpl break on graph page (#25005)
Lunny Xiao [Tue, 30 May 2023 13:36:58 +0000 (21:36 +0800)]
revert the removed method to fix tmpl break on graph page (#25005)

Fix #24996
Caused by #24634

16 months agoRefactor diffFileInfo / DiffTreeStore (#24998)
wxiaoguang [Tue, 30 May 2023 10:53:15 +0000 (18:53 +0800)]
Refactor diffFileInfo / DiffTreeStore  (#24998)

Follow  #21012, #22399

Replace #24983, fix #24938

Help #24956

Now, the `window.config.pageData.diffFileInfo` itself is a reactive
store, so it's quite easy to sync values/states by it, no need to do
"doLoadMoreFiles" or "callback".

Screenshot: these two buttons both work. After complete loading, the UI
is also right.

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/cc6310fd-7f27-45ea-ab4f-24952a87b421)

![image](https://github.com/go-gitea/gitea/assets/2114189/4c11dd67-ac03-4568-8541-91204d27a4e3)

![image](https://github.com/go-gitea/gitea/assets/2114189/38a22cec-41be-41e6-a209-f347b7a4c1de)

</details>

16 months agoFix delete user account modal (#25004)
HesterG [Tue, 30 May 2023 10:08:09 +0000 (18:08 +0800)]
Fix delete user account modal (#25004)

Before:

<img width="953" alt="Screen Shot 2023-05-30 at 17 08 57"
src="https://github.com/go-gitea/gitea/assets/17645053/f379b2c9-7d9a-492e-b0e4-5a8be1c3a025">

After:

<img width="875" alt="Screen Shot 2023-05-30 at 17 06 17"
src="https://github.com/go-gitea/gitea/assets/17645053/75d3c9b5-201b-4001-a27e-64c932e2e34a">

16 months agoClean up github actions (#24984)
silverwind [Tue, 30 May 2023 05:31:00 +0000 (07:31 +0200)]
Clean up github actions (#24984)

- Merge the file filters into `files-changed.yml`
- Remove unused yaml anchors like `&backend`
- Merge the `compliance-docs` workflow into `compliance`
- Add actions linting
- Misc cleanups for whitespace and step names

16 months agoRemove unnecessary content on docs (#24976)
Lunny Xiao [Tue, 30 May 2023 01:30:56 +0000 (09:30 +0800)]
Remove unnecessary content on docs (#24976)

16 months agoUpgrade snap to node 20 (#24990)
silverwind [Mon, 29 May 2023 20:41:56 +0000 (22:41 +0200)]
Upgrade snap to node 20 (#24990)

Followup to https://github.com/go-gitea/gitea/pull/24524. Now there is a
[node 20 snap](https://snapcraft.io/node), so let's upgrade to it.

16 months agoDisplay file mode for new file and file mode changes (#24966)
Yevhen Pavlov [Mon, 29 May 2023 17:56:08 +0000 (20:56 +0300)]
Display file mode for new file and file mode changes (#24966)

This MR introduces the addition of file mode display support for both
new file creation and file mode changes, following a similar approach as
GitLab.

GitLab:

![изображение](https://github.com/go-gitea/gitea/assets/1969460/4c0d0d74-30b2-486c-ac12-ef2355b04c96)

Gitea:

![изображение](https://github.com/go-gitea/gitea/assets/1969460/8237fe99-2507-42c0-a40c-cd52ad355ab7)

Replaces: https://github.com/go-gitea/gitea/pull/23159
Closes: https://github.com/go-gitea/gitea/issues/23021
---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoEnable `vue/html-closing-bracket-spacing` eslint rule (#24987)
silverwind [Mon, 29 May 2023 16:58:53 +0000 (18:58 +0200)]
Enable `vue/html-closing-bracket-spacing` eslint rule (#24987)

Enable
[`vue/html-closing-bracket-spacing`](https://eslint.vuejs.org/rules/html-closing-bracket-spacing.html)
and set it to never add any useless spaces inside tags. All issues were
fixed automatically with `make lint-js-fix`.

16 months agoFix repo level project - edit column (#24982)
HesterG [Mon, 29 May 2023 16:32:15 +0000 (00:32 +0800)]
Fix repo level project - edit column  (#24982)

Right now edit column of repo level project is not working, because edit
button does not have the `edit-column-button` class, which is used in
the [js
selector](https://github.com/go-gitea/gitea/blob/28077e66c0a5593f001e89ef1ff02627dbe029a1/web_src/js/features/repo-projects.js#L106)

After:

https://github.com/go-gitea/gitea/assets/17645053/e1fba190-477d-4814-87f2-0fd979376840

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAdd v3.18 to TestPackageAlpine (#24972)
Yevhen Pavlov [Mon, 29 May 2023 15:45:32 +0000 (18:45 +0300)]
Add v3.18 to TestPackageAlpine (#24972)

Add Alpine 3.18 to TestPackageAlpine

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix admin config page error, use tests to cover the admin config and 500 error page...
wxiaoguang [Mon, 29 May 2023 15:00:21 +0000 (23:00 +0800)]
Fix admin config page error, use tests to cover the admin config and 500 error page (#24965)

The admin config page has been broken for many many times, a little
refactoring would make this page panic.

So, add a test for it, and add another test to cover the 500 error page.

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoImprove dropdown menus, remove inline styles (#24954)
silverwind [Mon, 29 May 2023 14:10:06 +0000 (16:10 +0200)]
Improve dropdown menus, remove inline styles (#24954)

Before:

<img width="190" alt="Screenshot 2023-05-27 at 10 46 43"
src="https://github.com/go-gitea/gitea/assets/115237/b9331fcd-db1d-476e-87f0-f79bae48b1a5">

After:

<img width="154" alt="Screenshot 2023-05-28 at 19 29 03"
src="https://github.com/go-gitea/gitea/assets/115237/8b7f99a2-01a8-4665-9342-a6201b51d30f">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoUnify doc links to use paths relative to doc folder (#24979)
HesterG [Mon, 29 May 2023 13:27:16 +0000 (21:27 +0800)]
Unify doc links to use paths relative to doc folder (#24979)

Changes:

1. Use uniform links types relative to doc folder (start with `doc/`)
2. According to [docusaurus
links](https://docusaurus.io/docs/markdown-features/links), if `<a>` is
used, the `href` is resolved as URL location, but not file location. So
need to use `[text]({{< relref "path" >}})` instead.

16 months agoRework button coloring, add focus and active colors (#24507)
silverwind [Mon, 29 May 2023 12:45:22 +0000 (14:45 +0200)]
Rework button coloring, add focus and active colors (#24507)

We were missing overrides for `:focus` and `:active` styles which I've
added here along with two new color variants `dark-1` and `dark-2` for
them. Fomantic UI has 4 different colors but I think 3 are sufficient. I
also changed it on arc-green so button goes darker when pressed.

<img width="129" alt="Screenshot 2023-05-04 at 01 21 43"
src="https://user-images.githubusercontent.com/115237/236072060-7389276a-275b-4d3e-aa52-20b37c6e6d92.png">
<img width="130" alt="Screenshot 2023-05-04 at 01 17 59"
src="https://user-images.githubusercontent.com/115237/236071818-0e46414a-33db-4bb2-a3bd-35b514a8a2d0.png">
<img width="129" alt="Screenshot 2023-05-04 at 01 18 07"
src="https://user-images.githubusercontent.com/115237/236071819-562b1e38-541f-432b-b3b6-48e6d7594d00.png">
<img width="131" alt="Screenshot 2023-05-04 at 01 18 13"
src="https://user-images.githubusercontent.com/115237/236071820-89b7dba9-ce6c-48e5-a075-9053063e6ad3.png">
<img width="133" alt="Screenshot 2023-05-04 at 01 18 30"
src="https://user-images.githubusercontent.com/115237/236071823-b6fe2df4-b3f0-4dc8-97a8-f90ba6d19bec.png">
<img width="133" alt="Screenshot 2023-05-04 at 01 18 40"
src="https://user-images.githubusercontent.com/115237/236071824-b02ce61a-2367-4c29-8a25-45f231f5e5ee.png">

One misc change includes some fixes to editor and slightly darker
selection.

<img width="1245" alt="Screenshot 2023-05-28 at 19 16 19"
src="https://github.com/go-gitea/gitea/assets/115237/1ea4a4b6-26ba-45af-9cbc-5b8c476c2338">

16 months agoAdd PDF rendering via PDFObject (#24086)
silverwind [Mon, 29 May 2023 12:10:00 +0000 (14:10 +0200)]
Add PDF rendering via PDFObject (#24086)

Use [PDFObject](https://pdfobject.com/) to embed PDFs, replacing our
outdated PDF.js copy we vendor (the last non-webpack vendoring).

[Commit
1](https://github.com/go-gitea/gitea/pull/24086/commits/673e0263da64b72565ff59b990ab1b8e87271872)
is the PDFObject integration
[Commit
2](https://github.com/go-gitea/gitea/pull/24086/commits/9336f5769d54445bba0e16776164f6a2fe2c32ac)
is the removal of PDF.js

<img width="1251" alt="Screenshot 2023-05-27 at 09 57 52"
src="https://github.com/go-gitea/gitea/assets/115237/169ce50c-bd1d-4bb0-86e5-1710bd0400a9">
<img width="1257" alt="Screenshot 2023-05-27 at 10 12 50"
src="https://github.com/go-gitea/gitea/assets/115237/318f7ee9-fb11-4093-83e7-17475aa70629">

Fallback for unsupporting browsers (most mobile ones, except Firefox
Mobile):

<img width="358" alt="Screenshot 2023-05-27 at 09 43 34"
src="https://github.com/go-gitea/gitea/assets/115237/8c12d7ba-57d6-4228-89a0-5fef9fad0cbb">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoHide 'Mirror Settings' when unneeded, improve hints (#24433)
Panagiotis "Ivory" Vasilopoulos [Mon, 29 May 2023 11:32:52 +0000 (11:32 +0000)]
Hide 'Mirror Settings' when unneeded, improve hints (#24433)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoConsolidate the two review boxes into one (#24738)
silverwind [Mon, 29 May 2023 10:44:03 +0000 (12:44 +0200)]
Consolidate the two review boxes into one (#24738)

View diff:
https://github.com/go-gitea/gitea/pull/24738/files?diff=unified&w=1

Improve layout and functionality in review area:

<img width="439" alt="Screenshot 2023-05-15 at 20 10 01"
src="https://github.com/go-gitea/gitea/assets/115237/be10452b-5829-4927-8801-7b26a57b3dbd">

Remove the "Reviewers" timeline box that appears before the merge box.
it's a duplicate of the top-right review area and all functionality of
it has been moved to the other box:

<img width="868" alt="Screenshot 2023-05-15 at 19 39 31"
src="https://github.com/go-gitea/gitea/assets/115237/35489445-e54b-40d3-b3cf-38d029478f96">

Increase timeline item vertical padding from 12px to 16px:

<img width="449" alt="Screenshot 2023-05-15 at 19 43 50"
src="https://github.com/go-gitea/gitea/assets/115237/919c4f9d-a485-4f51-b08c-2c0fc714a413">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAPI endpoint for changing/creating/deleting multiple files (#24887)
Denys Konovalov [Mon, 29 May 2023 09:41:35 +0000 (11:41 +0200)]
API endpoint for changing/creating/deleting multiple files (#24887)

This PR creates an API endpoint for creating/updating/deleting multiple
files in one API call similar to the solution provided by
[GitLab](https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions).

To archive this, the CreateOrUpdateRepoFile and DeleteRepoFIle functions
in files service are unified into one function supporting multiple files
and actions.

Resolves #14619

16 months agoRepo list improvements, fix bold helper classes (#24935)
silverwind [Mon, 29 May 2023 08:55:23 +0000 (10:55 +0200)]
Repo list improvements, fix bold helper classes (#24935)

- Fix bold helper classes that were broken because of CSS syntax error
- Refined the repo list CSS and layout
- Removing bold
- Downsize the mirror icon to fit
- Fix icon positions
- Adapted the org list to match
- Center the '+' icon and mute it

<img width="385" alt="Screenshot 2023-05-25 at 18 38 31"
src="https://github.com/go-gitea/gitea/assets/115237/ac8d6efb-5751-4845-a4ab-db1ddaf36ec3">
<img width="384" alt="Screenshot 2023-05-25 at 18 30 29"
src="https://github.com/go-gitea/gitea/assets/115237/bbd39ae7-da9d-4c6f-bfe3-42f28b7a74c3">

16 months agoAdd step start time to `ViewStepLog` (#24980)
Zettat123 [Mon, 29 May 2023 08:18:36 +0000 (16:18 +0800)]
Add step start time to `ViewStepLog` (#24980)

Part of #24876

According to
https://github.com/go-gitea/gitea/pull/24876#discussion_r1205565622 , we
need the start time of the step to get the log time offset.

16 months agoUpdate from-binary.en-us.md (#24975)
epk [Mon, 29 May 2023 07:46:38 +0000 (03:46 -0400)]
Update from-binary.en-us.md (#24975)

Fixed link to the creating a systemd service in Ubuntu document.

16 months agoTest query must have "order by" explicitly to avoid unstable results (#24963)
wxiaoguang [Mon, 29 May 2023 03:20:57 +0000 (11:20 +0800)]
Test query must have "order by" explicitly to avoid unstable results (#24963)

The query must have the "ORDER BY", otherwise the result is not
deterministic.

Replace "interface{}" with "any" by the way.

16 months agoHelp to recover from corrupted levelqueue (#24912)
wxiaoguang [Mon, 29 May 2023 02:52:32 +0000 (10:52 +0800)]
Help to recover from corrupted levelqueue (#24912)

gitea.com experienced the corrupted LevelQueue bug again.

I think the problem is clear now: if the keys in LevelDB went
out-of-sync, the LevelQueue itself doesn't have the ability to recover,
eg:

* LevelQueue.Len() reports 100
* LevelQueue.LPop() reports ErrNotFound = errors.New("no key found")

So it needs to dive into the LevelDB to remove all keys to recover the
corrupted LevelQueue.

More comments are in TestCorruptedLevelQueue.

16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 29 May 2023 00:24:30 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

16 months agoRemove meta tags `theme-color` and `default-theme` (#24960)
silverwind [Sun, 28 May 2023 22:33:17 +0000 (00:33 +0200)]
Remove meta tags `theme-color` and `default-theme` (#24960)

As discussed in
https://github.com/go-gitea/gitea/pull/24953#issuecomment-1565630156.

## :warning: BREAKING :warning:

1. The `ui.THEME_COLOR_META_TAG` setting has been removed. If you still
need to set the `theme-color` meta tag, add it via
`$GITEA_CUSTOM/templates/custom/header.tmpl` instead.

2. The non-standard `default-theme` meta-tag added in
https://github.com/go-gitea/gitea/pull/13809 has been removed. Third
party code that needs to obtain the currently loaded theme should use
the `theme-<name>` class on the `<html>` node instead, which reflect the
currently active theme.

16 months agoAdd dark mode to API Docs (#24971)
silverwind [Sun, 28 May 2023 21:37:34 +0000 (23:37 +0200)]
Add dark mode to API Docs (#24971)

Add a dark mode to Swagger UI via CSS `invert`. No toggle or anything,
but I think it's better than nothing. Users can toggle via their OS.

Also includes a few misc CSS cleanups on the page.

<img width="1264" alt="Screenshot 2023-05-28 at 20 25 06"
src="https://github.com/go-gitea/gitea/assets/115237/de761b85-ca0c-4220-bee4-73798a4360a0">
<img width="1260" alt="Screenshot 2023-05-28 at 20 02 54"
src="https://github.com/go-gitea/gitea/assets/115237/29188ed2-c167-47f5-bf28-46193d1da22c">

16 months agoUpdate JS dependencies (#24969)
silverwind [Sun, 28 May 2023 19:47:03 +0000 (21:47 +0200)]
Update JS dependencies (#24969)

- Update all JS dependencies
- Tested Build, Mermaid and Swagger

16 months agoReplace Fomantic reset module with our own (#24948)
silverwind [Sun, 28 May 2023 18:04:35 +0000 (20:04 +0200)]
Replace Fomantic reset module with our own (#24948)

Replace the `reset` module with a modern version based on
[modern-normalize](https://github.com/sindresorhus/modern-normalize).
The only things I removed from that module are the `font-family` rules
we don't need. Otherwise, it's similar to Fomantic's reset, but with the
legacy IE stuff removed.

I documented every change done to the module.

Also this introduces a new `--tab-size` variable but it has no real
effect on code yet.

16 months agosimple docs fixes: 'pull request' page (en-us & zh-tw) link path to 'issue-pull-reque...
Jon Keim [Sun, 28 May 2023 08:47:05 +0000 (04:47 -0400)]
simple docs fixes: 'pull request' page (en-us & zh-tw) link path to 'issue-pull-request-templates' (#24961)

Co-authored-by: silverwind <me@silverwind.io>
16 months agoRemove reference to caddy v1 in docs (#24962)
techknowlogick [Sun, 28 May 2023 08:39:16 +0000 (04:39 -0400)]
Remove reference to caddy v1 in docs (#24962)

caddy v1 is loong eol. v2 should be used.

16 months agoImprove and fix bugs surrounding reactions (#24760)
silverwind [Sun, 28 May 2023 01:34:18 +0000 (03:34 +0200)]
Improve and fix bugs surrounding reactions (#24760)

- Slightly decrease size of reaction buttons
- Remove tooltip inside menu, it's obvious by the picture alone
- Fix top menu triangle
- Use `display: grid` to align icons in menu
- Use regular tooltip for reaction users
- Fix bug that deleted the reaction bar on clicking already reacted
reaction in dropdown

<img width="490" alt="Screenshot 2023-05-17 at 00 03 42"
src="https://github.com/go-gitea/gitea/assets/115237/61588b37-facb-4829-b75b-e1cb5dda8ca4">

<img width="67" alt="Screenshot 2023-05-17 at 00 11 14"
src="https://github.com/go-gitea/gitea/assets/115237/29605589-3b5f-40c6-8ad4-09923094bb8e">

<img width="211" alt="Screenshot 2023-05-17 at 00 29 30"
src="https://github.com/go-gitea/gitea/assets/115237/7d2725da-6a3d-4e42-a351-53647f79f762">
<img width="210" alt="Screenshot 2023-05-17 at 00 29 54"
src="https://github.com/go-gitea/gitea/assets/115237/b50f8364-033c-4445-ba25-61a814bb2d92">

<img width="892" alt="Screenshot 2023-05-17 at 00 12 20"
src="https://github.com/go-gitea/gitea/assets/115237/30a46424-406a-46e5-b4de-47172eb8679d">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoUse `[git.config]` for reflog cleaning up (#24958)
wxiaoguang [Sun, 28 May 2023 01:07:14 +0000 (09:07 +0800)]
Use `[git.config]` for reflog cleaning up (#24958)

Follow
https://github.com/go-gitea/gitea/pull/24860#discussion_r1200589651

Use `[git.config]` for reflog cleaning up, the new options are more
flexible.

*
https://git-scm.com/docs/git-config#Documentation/git-config.txt-corelogAllRefUpdates
*
https://git-scm.com/docs/git-config#Documentation/git-config.txt-gcreflogExpire

## :warning: BREAKING

The section `[git.reflog]` is now obsolete and its keys have been moved
to the following replacements:
- `[git.reflog].ENABLED` → `[git.config].core.logAllRefUpdates`
- `[git.reflog].EXPIRATION` → `[git.config].gc.reflogExpire`

16 months agoImprove logger Pause handling (#24946)
wxiaoguang [Sat, 27 May 2023 20:35:44 +0000 (04:35 +0800)]
Improve logger Pause handling (#24946)

The old EventWriter's Run does:

```go
for {
    handlePause()
    select {
    case event <- Queue:
         write the log event ...
    }
}
```

So, if an event writer is started before the logger is paused, there is
a chance that the logger isn't paused for the first message.

The new logic is:

```go
for {
    select {
    case event <- Queue:
         handlePause()
         write the log event ...
    }
}
```

Then the event writer can be correctly paused

16 months agoDo not output "Trace" level logs from process manager by default (#24952)
wxiaoguang [Sat, 27 May 2023 10:55:24 +0000 (18:55 +0800)]
Do not output "Trace" level logs from process manager by default (#24952)

The old process manager's `Trace` function by default calls `log.Printf`
to output "trace" level logs. That's not ideal because by default the
trace level logs should not be outputted. In history it didn't cause
problems because there was no other call to the process manager before
the logger system's initialization.

But if there is any package using the process manager before the "Trace"
function gets assigned to the logger system's trace function, the
process manager will outputs unexpected verbose messages, this behavior
is not expected in most cases.

Now, the logger system also uses process manager to manage its goroutine
contexts, so it's the time to fix the old "trace" behavior: by default,
do not output the trace level messages. Fix #24951

16 months agoMake the 500 page load themes (#24953)
silverwind [Sat, 27 May 2023 10:06:08 +0000 (12:06 +0200)]
Make the 500 page load themes (#24953)

The 500 page was not loading theme CSS, so always appeared in light
theme. This extracts the stylesheets into a shared template used by all
pages.

<img width="1262" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/72222b8d-a523-40d0-aa91-b9db32e5625d">

Small related rant: I think there should only be one `<head>` in all of
the templates, but I see it was deliberatly done that the 500 page has
its own `<head>` because "it should only depend the minimal template
functions", but I disagree because we are missing a lot of things that
are in the regular `<head>`.

16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 27 May 2023 00:25:56 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

16 months agodocs: remove an extraneous whitespace (#24949)
谈笑风生间 [Fri, 26 May 2023 18:16:48 +0000 (02:16 +0800)]
docs: remove an extraneous whitespace (#24949)

16 months agoShow `bot` label next to username when rendering autor link if the user is a bot...
Yarden Shoham [Fri, 26 May 2023 16:58:11 +0000 (19:58 +0300)]
Show `bot` label next to username when rendering autor link if the user is a bot (#24943)

If the user is a bot, we'll add a label next to the author link that
says `bot`. I didn't localize `bot` because passing `locale` into the
`autorlink` template would require changing all calls.

# Example
`yardenshoham` is a bot.
## Before

![image](https://github.com/go-gitea/gitea/assets/20454870/77390780-b763-4f0f-b358-bbccdbf17a5d)

## After

![image](https://github.com/go-gitea/gitea/assets/20454870/72af342f-ee76-4337-95ad-4ecaba853fed)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
16 months agoImprove some Forms (#24878)
JakobDev [Fri, 26 May 2023 09:42:54 +0000 (11:42 +0200)]
Improve some Forms (#24878)

Don't really know a better name for this. I've gone through some Forms
and added missing HTML attributes (mostly `maxlength`). I tried to fill
the Forms with dummy Data and see if Gitea throws a Error (e.g. maximum
length). If yes, I added the missing HTML attribute.

While working on this, I discovered that the Form to add OAuth2 Apps
just silently fails when filled with invalid data, so I fixed that too.

16 months agoImprove queue and logger context (#24924)
wxiaoguang [Fri, 26 May 2023 07:31:55 +0000 (15:31 +0800)]
Improve queue and logger context (#24924)

Before there was a "graceful function": RunWithShutdownFns, it's mainly
for some modules which doesn't support context.

The old queue system doesn't work well with context, so the old queues
need it.

After the queue refactoring, the new queue works with context well, so,
use Golang context as much as possible, the `RunWithShutdownFns` could
be removed (replaced by RunWithCancel for context cancel mechanism), the
related code could be simplified.

This PR also fixes some legacy queue-init problems, eg:

* typo : archiver: "unable to create codes indexer queue" => "unable to
create repo-archive queue"
* no nil check for failed queues, which causes unfriendly panic

After this PR, many goroutines could have better display name:

![image](https://github.com/go-gitea/gitea/assets/2114189/701b2a9b-8065-4137-aeaa-0bda2b34604a)

![image](https://github.com/go-gitea/gitea/assets/2114189/f1d5f50f-0534-40f0-b0be-f2c9daa5fe92)

16 months agoFix ref type error (#24941)
Lunny Xiao [Fri, 26 May 2023 07:00:27 +0000 (15:00 +0800)]
Fix ref type error (#24941)

16 months agoUse the type RefName for all the needed places and fix pull mirror sync bugs (#24634)
Lunny Xiao [Fri, 26 May 2023 01:04:48 +0000 (09:04 +0800)]
Use the type RefName for all the needed places and fix pull mirror sync bugs (#24634)

This PR replaces all string refName as a type `git.RefName` to make the
code more maintainable.

Fix #15367
Replaces #23070
It also fixed a bug that tags are not sync because `git remote --prune
origin` will not remove local tags if remote removed.

We in fact should use `git fetch --prune --tags origin` but not `git
remote update origin` to do the sync.

Some answer from ChatGPT as ref.

> If the git fetch --prune --tags command is not working as expected,
there could be a few reasons why. Here are a few things to check:
>
>Make sure that you have the latest version of Git installed on your
system. You can check the version by running git --version in your
terminal. If you have an outdated version, try updating Git and see if
that resolves the issue.
>
>Check that your Git repository is properly configured to track the
remote repository's tags. You can check this by running git config
--get-all remote.origin.fetch and verifying that it includes
+refs/tags/*:refs/tags/*. If it does not, you can add it by running git
config --add remote.origin.fetch "+refs/tags/*:refs/tags/*".
>
>Verify that the tags you are trying to prune actually exist on the
remote repository. You can do this by running git ls-remote --tags
origin to list all the tags on the remote repository.
>
>Check if any local tags have been created that match the names of tags
on the remote repository. If so, these local tags may be preventing the
git fetch --prune --tags command from working properly. You can delete
local tags using the git tag -d command.

---------

Co-authored-by: delvh <dev.lh@web.de>
16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 26 May 2023 00:24:37 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

16 months agoAdd Link to Stars and Forks Page to Repo List (#24931)
JakobDev [Thu, 25 May 2023 16:57:49 +0000 (18:57 +0200)]
Add Link to Stars and Forks Page to Repo List (#24931)

The Repolist contains the Number of Stars and Forks. Now these Numbers
are a Link to the corresponding pages of the Repo.

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix documentation ref (#24934)
Lunny Xiao [Thu, 25 May 2023 16:19:13 +0000 (00:19 +0800)]
Fix documentation ref (#24934)

Fix documentation ref

16 months agoAdd Chinese docs for help, contribution and development (#24925)
HesterG [Thu, 25 May 2023 16:01:01 +0000 (00:01 +0800)]
Add Chinese docs for help, contribution and development (#24925)

16 months agoMerge two translation contributing documents (#23939)
Lunny Xiao [Thu, 25 May 2023 15:49:54 +0000 (23:49 +0800)]
Merge two translation contributing documents (#23939)

This PR also adjusts the weights.

---------

Co-authored-by: delvh <dev.lh@web.de>
16 months agoAdd the ability to pin Issues (#24406)
JakobDev [Thu, 25 May 2023 13:17:19 +0000 (15:17 +0200)]
Add the ability to pin Issues (#24406)

This adds the ability to pin important Issues and Pull Requests. You can
also move pinned Issues around to change their Position. Resolves #2175.

## Screenshots

![grafik](https://user-images.githubusercontent.com/15185051/235123207-0aa39869-bb48-45c3-abe2-ba1e836046ec.png)

![grafik](https://user-images.githubusercontent.com/15185051/235123297-152a16ea-a857-451d-9a42-61f2cd54dd75.png)

![grafik](https://user-images.githubusercontent.com/15185051/235640782-cbfe25ec-6254-479a-a3de-133e585d7a2d.png)

The Design was mostly copied from the Projects Board.

## Implementation
This uses a new `pin_order` Column in the `issue` table. If the value is
set to 0, the Issue is not pinned. If it's set to a bigger value, the
value is the Position. 1 means it's the first pinned Issue, 2 means it's
the second one etc. This is dived into Issues and Pull requests for each
Repo.

## TODO
- [x] You can currently pin as many Issues as you want. Maybe we should
add a Limit, which is configurable. GitHub uses 3, but I prefer 6, as
this is better for bigger Projects, but I'm open for suggestions.
- [x] Pin and Unpin events need to be added to the Issue history.
- [x] Tests
- [x] Migration

**The feature itself is currently fully working, so tester who may find
weird edge cases are very welcome!**

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoUse `shared/issueicon` template in projects (#24922)
silverwind [Thu, 25 May 2023 12:25:31 +0000 (14:25 +0200)]
Use `shared/issueicon` template in projects (#24922)

We can reuse the recently created subtemplate here. I also checked the
whole templates for similar constructs, these appear to be the only one.

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAllow skipping forks and mirrors from being indexed (#23187)
techknowlogick [Thu, 25 May 2023 08:13:47 +0000 (04:13 -0400)]
Allow skipping forks and mirrors from being indexed (#23187)

This PR adds two new options to disable repo/code search indexing of
both forks and mirrors.

Related: #22842

16 months agoAdd Chinese documentations for Actions (#24902)
HesterG [Thu, 25 May 2023 05:52:12 +0000 (13:52 +0800)]
Add Chinese documentations for Actions (#24902)

16 months ago`zh-cn` translation for usage docs (#24897)
Zettat123 [Thu, 25 May 2023 04:33:38 +0000 (12:33 +0800)]
`zh-cn` translation for usage docs (#24897)

16 months agoAdd chinese documentations for installation (#24904)
sillyguodong [Thu, 25 May 2023 04:32:39 +0000 (12:32 +0800)]
Add chinese documentations for installation (#24904)

16 months agoImprove RunMode / dev mode (#24886)
wxiaoguang [Thu, 25 May 2023 03:47:30 +0000 (11:47 +0800)]
Improve RunMode / dev mode (#24886)

1. non-dev mode is treated as prod mode, to protect users from
accidentally running in dev mode if there is a typo in this value.
2. in dev mode, do not need to really exit if there are template errors,
because the template errors could be fixed by developer soon and the
templates get reloaded, help:
* https://github.com/go-gitea/gitea/issues/24845#issuecomment-1557615382
3. Fine tune the mail template loading message.

16 months agoAdd chinese documentations for `Packages` (#24914)
sillyguodong [Thu, 25 May 2023 03:22:45 +0000 (11:22 +0800)]
Add chinese documentations for `Packages` (#24914)

16 months agoRework notifications list (#24812)
silverwind [Thu, 25 May 2023 02:31:26 +0000 (04:31 +0200)]
Rework notifications list (#24812)

- Replace `<table>` with flexbox
- Add issue modification time and issue number
- Remove big title
- Replace tabs with menu items
- Add clicked item deletion on back button cache restoration

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
16 months agoNew webhook trigger for receiving Pull Request review requests (#24481)
谈笑风生间 [Thu, 25 May 2023 02:06:27 +0000 (10:06 +0800)]
New webhook trigger for receiving Pull Request review requests (#24481)

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

Provided a webhook trigger for requesting someone to review the Pull
Request.

Some modifications have been made to the returned `PullRequestPayload`
based on the GitHub webhook settings, including:
- add a description of the current reviewer object as
`RequestedReviewer` .
- setting the action to either **review_requested** or
**review_request_removed** based on the operation.
- adding the `RequestedReviewers` field to the issues_model.PullRequest.
This field will be loaded into the PullRequest through
`LoadRequestedReviewers()` when `ToAPIPullRequest` is called.

After the Pull Request is merged, I will supplement the relevant
documentation.

16 months agoUse file filters action instead of Github's files filter (#24877)
Lunny Xiao [Thu, 25 May 2023 01:33:31 +0000 (09:33 +0800)]
Use file filters action instead of Github's files filter (#24877)

Inspired by
https://github.com/go-gitea/gitea/pull/24530#issuecomment-1558815301

This PR use a file filter action to do different CI jobs according
changed files types. All types are defined in
`.github/file-filters.yml`. Now there are 4 types, `docs`, `backend`,
`frontend` and `build`. Then if a PR only changed docs files, those CI
jobs which passed the conditions will run, and other types are also like
this.

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoUpdate Asciidoc markup example with safe defaults (#24920)
Mike Rochefort [Thu, 25 May 2023 01:24:05 +0000 (21:24 -0400)]
Update Asciidoc markup example with safe defaults (#24920)

The cheat sheet uses the `asciidoc` markup language to demonstrate how
to set up third party markup renderers. The current example has the
following issues:

- It promotes a legacy tool that does not handle modern AsciiDoc
specifications
- It does not account for embedded preview renders
- It has no safety restrictions

By switching to `asciidoctor`, uses are suggested to utilize de
facto/standard tooling for AsciiDoc.

The `--embedded` parameter will strip out HTML tags that contain the
document (such as `<html></html>`) which aren't necessary for the
render, and actually end up as text in the document if left in.

The `--safe-mode` parameter (of which there are several profiles)
imposes [certain
policies](https://docs.asciidoctor.org/asciidoctor/latest/safe-modes/)
on the files it ingests and what the resulting output looks like. GitHub
itself uses the `secure` profile (the highest), which can be a good
starting point for those who are uncertain of what to do. By default, if
no mode is specified when `asciidoctor` runs it defaults to `unsafe`,
i.e. no safety guidelines at all.

16 months agoAdd self to maintainers (#23644)
Philip Peterson [Wed, 24 May 2023 23:58:38 +0000 (19:58 -0400)]
Add self to maintainers (#23644)

Hi all,

I've very much enjoyed working on Gitea and was hoping to make it
official by requesting maintainership. :) Excited to see what the future
holds for this project.

My [merged PRs
list](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Aphilip-peterson+is%3Amerged+)

Cheers,
Phil

---------

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
16 months agoCreate pull request for base after editing file, if not enabled on fork (#24841)
Brecht Van Lommel [Wed, 24 May 2023 21:36:02 +0000 (23:36 +0200)]
Create pull request for base after editing file, if not enabled on fork (#24841)

Currently if pull requests are disabled on a fork but enabled on a base
repo, creating/editing/deleting files does not offer the option to
create a pull request. This change enables creating a pull request for
the base repo in that case.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoReduce verbosity of dev commands (#24917)
silverwind [Wed, 24 May 2023 20:11:04 +0000 (22:11 +0200)]
Reduce verbosity of dev commands (#24917)

### Before

```
$ make watch
bash build/watch.sh
make[1]: Entering directory '/Users/silverwind/git/gitea'
make[1]: Entering directory '/Users/silverwind/git/gitea'
GITEA_RUN_MODE=dev go run github.com/cosmtrek/air@v1.43.0 -c .air.toml
rm -rf public/js public/css public/fonts public/img/webpack public/serviceworker.js
NODE_ENV=development npx webpack --watch --progress
```

### After

```
$ make watch
GITEA_RUN_MODE=dev go run github.com/cosmtrek/air@v1.43.0 -c .air.toml
NODE_ENV=development npx webpack --watch --progress
```

16 months agoMerge different languages for language stats (#24900)
wxiaoguang [Wed, 24 May 2023 19:37:36 +0000 (03:37 +0800)]
Merge different languages for language stats (#24900)

Fix #24896

If users set different languages by `linguist-language`, the `stats` map
could be: `java: 100, Java: 200`.

Language stats are stored as case-insensitive in database and there is a
unique key.

So, the different language names should be merged to one unique name:
`Java: 300`

16 months agoAdd missing test case and fix typo in tests (#24915)
Philip Peterson [Wed, 24 May 2023 19:06:04 +0000 (15:06 -0400)]
Add missing test case and fix typo in tests (#24915)

This PR adds a missing assertion in the `TestGetOrgUsersByOrgID`
function. It also incidentally fixes a small typo.

16 months agoImprove confusable character string (#24911)
Panagiotis "Ivory" Vasilopoulos [Wed, 24 May 2023 14:39:33 +0000 (14:39 +0000)]
Improve confusable character string (#24911)

Very small UX change, "confusable" is a word that is indeed valid, but
when you look it up online, it doesn't take long for this adjective to
appear in [its technical Unicode-related
context](https://util.unicode.org/UnicodeJsps/confusables.jsp). I think
that it throws me off as a person that doesn't speak English natively.

I think that this could be replaced with "can be confused with". As the
change is very small and purely a matter of preference, if you (the
maintainer) believe that this shouldn't be included, feel free to close
this without any further discussion, as your time would probably be
better used elsewhere.

16 months agoImprove Actions CSS (#24864)
silverwind [Wed, 24 May 2023 09:00:29 +0000 (11:00 +0200)]
Improve Actions CSS (#24864)

- Various color tweaks
- Add sticky positioning to left sidebar, right header and right step
header
- Adjust margins and border radiuses

<img width="1235" alt="Screenshot 2023-05-23 at 11 18 06"
src="https://github.com/go-gitea/gitea/assets/115237/f601b00d-c7f2-43de-89f2-3ac55f2d9cdc">
<img width="1239" alt="Screenshot 2023-05-23 at 11 18 18"
src="https://github.com/go-gitea/gitea/assets/115237/a2d24cc9-29fa-4c17-906b-84feea14b889">

![](https://github.com/go-gitea/gitea/assets/115237/643910f2-a582-405d-bc93-36f2e54b5fda)

![](https://github.com/go-gitea/gitea/assets/115237/382a8a54-f1e3-4f08-affc-ea3108c02352)

---------

Co-authored-by: yp05327 <576951401@qq.com>