]> source.dussan.org Git - gitea.git/log
gitea.git
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

17 months agoDisplay warning when user try to rename default branch (#24512)
sillyguodong [Thu, 4 May 2023 22:54:38 +0000 (06:54 +0800)]
Display warning when user try to rename default branch (#24512)

Follow #24380

It's better to warn users when they try to rename the default branch.

![image](https://user-images.githubusercontent.com/33891828/236107929-c8ac2854-dd0f-4500-a0a7-800c8fe48861.png)

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoUpgrade to Node 20 on CI, enable actions cancellation (#24524)
silverwind [Thu, 4 May 2023 22:21:48 +0000 (00:21 +0200)]
Upgrade to Node 20 on CI, enable actions cancellation (#24524)

- Upgrade node, the
[snap](https://github.com/go-gitea/gitea/blob/7abe958f5b507efa676fb3b2e27d30517f6d1908/snap/snapcraft.yaml#L47)
is excluded from this because [there is no Node 20 snap
yet](https://snapcraft.io/node).
- Add actions build cancellation based on
[this](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value).

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
17 months agoFix incorrectly quoted translation (#24514)
Lunny Xiao [Thu, 4 May 2023 18:46:47 +0000 (02:46 +0800)]
Fix incorrectly quoted translation (#24514)

Looks like crowdin cannot recognize a value starting with a double quote but
not end with a double quote.

17 months agoFix color for transfer related buttons when having no permission to act (#24510)
Hester Gong [Thu, 4 May 2023 13:21:30 +0000 (21:21 +0800)]
Fix color for transfer related buttons when having no permission to act (#24510)

Before:

<img width="1410" alt="Screen Shot 2023-05-04 at 09 28 23"
src="https://user-images.githubusercontent.com/17645053/236100146-2b64d274-2d79-4b4c-827c-3906a2a9dbb7.png">
<img width="1413" alt="Screen Shot 2023-05-04 at 09 28 30"
src="https://user-images.githubusercontent.com/17645053/236100157-15c12e83-a4f5-4b4e-b26b-73a8ce8bc0db.png">

After:

With no permission:

<img width="1409" alt="Screen Shot 2023-05-04 at 12 17 12"
src="https://user-images.githubusercontent.com/17645053/236144666-c2bb6ca2-59e1-45ae-93cd-d43545500d06.png">
<img width="1402" alt="Screen Shot 2023-05-04 at 12 17 17"
src="https://user-images.githubusercontent.com/17645053/236144677-c51a65cf-8aef-4566-b265-14b2ebb46d0b.png">

With permission:

<img width="1412" alt="Screen Shot 2023-05-04 at 12 16 45"
src="https://user-images.githubusercontent.com/17645053/236144565-9c5aa9a6-1424-49e3-a2b2-a129fecb856c.png">
<img width="1420" alt="Screen Shot 2023-05-04 at 12 16 51"
src="https://user-images.githubusercontent.com/17645053/236144573-a4064136-80d9-4c41-8f98-f51b4352bdf7.png">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix some mistakes when using `ignSignIn` (#24415)
wxiaoguang [Thu, 4 May 2023 12:07:15 +0000 (20:07 +0800)]
Fix some mistakes when using `ignSignIn` (#24415)

Some old code doesn't respect the definition of `RequireSignInView` (the
`ignSignIn` is forgotten).

After #24413, this PR will do more fixes, ~~and rename the strange
`ignSignIn` to `optSignIn`.~~

This PR is ready for review, I think we can postpone the "ignSignIn"
renaming to another, to make this PR simple and clear.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoRemove unused zapx replace statement on go.mod (#24515)
Lunny Xiao [Thu, 4 May 2023 10:37:39 +0000 (18:37 +0800)]
Remove unused zapx replace statement on go.mod (#24515)

Fix #23617

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoDon't display creating page button in a mirror wiki repository (#24395)
Lunny Xiao [Thu, 4 May 2023 07:27:15 +0000 (15:27 +0800)]
Don't display creating page button in a mirror wiki repository (#24395)

A mirror repository with wiki is also a mirror. So creating page from UI
should be disabled. This PR hides the button like other places.

17 months agoImprove template system and panic recovery (#24461)
wxiaoguang [Thu, 4 May 2023 06:36:34 +0000 (14:36 +0800)]
Improve template system and panic recovery (#24461)

Partially for #24457

Major changes:

1. The old `signedUserNameStringPointerKey` is quite hacky, use
`ctx.Data[SignedUser]` instead
2. Move duplicate code from `Contexter` to `CommonTemplateContextData`
3. Remove incorrect copying&pasting code `ctx.Data["Err_Password"] =
true` in API handlers
4. Use one unique `RenderPanicErrorPage` for panic error page rendering
5. Move `stripSlashesMiddleware` to be the first middleware
6. Install global panic recovery handler, it works for both `install`
and `web`
7. Make `500.tmpl` only depend minimal template functions/variables,
avoid triggering new panics

Screenshot:

<details>

![image](https://user-images.githubusercontent.com/2114189/235444895-cecbabb8-e7dc-4360-a31c-b982d11946a7.png)

</details>

17 months agoFaster git.GetDivergingCommits (#24482)
oliverpool [Thu, 4 May 2023 05:08:41 +0000 (07:08 +0200)]
Faster git.GetDivergingCommits (#24482)

Using `git rev-list --left-right` is almost 2x faster than calling `git
rev-list` twice.

Co-authored-by: silverwind <me@silverwind.io>
17 months agoMerge setting.InitXXX into one function with options (#24389)
Lunny Xiao [Thu, 4 May 2023 03:55:35 +0000 (11:55 +0800)]
Merge setting.InitXXX into one function with options (#24389)

This PR will merge 3 Init functions on setting packages as 1 and
introduce an options struct.

17 months agoChangelog for 1.19.3 (#24495) (#24506)
Yarden Shoham [Thu, 4 May 2023 02:05:47 +0000 (05:05 +0300)]
Changelog for 1.19.3 (#24495) (#24506)

Frontport #24495

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
17 months agoUse Actions for DB & E2E tests (#24494)
techknowlogick [Thu, 4 May 2023 02:04:02 +0000 (22:04 -0400)]
Use Actions for DB & E2E tests (#24494)

following https://github.com/go-gitea/gitea/pull/24314 and
https://github.com/go-gitea/gitea/pull/24434, this PR moves drone cron
pipelines to (GitHub) Actions. As these are mostly compatible with Gitea
Actions, when we start to dogfood, these will already be migrated.

---------

Co-authored-by: silverwind <me@silverwind.io>
17 months agoFix intermittent CI failure in EmptyQueue (#23753)
zeripath [Thu, 4 May 2023 01:37:30 +0000 (02:37 +0100)]
Fix intermittent CI failure in EmptyQueue (#23753)

The ordering of the final token causing a close of the queue in this
test may be out of sync due to concurrency. Instead just use ensure that
the queue is closed when everything expected is done.

Fixes: https://github.com/go-gitea/gitea/issues/23608
Fixes: https://github.com/go-gitea/gitea/issues/23977
---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
17 months agoPrevent a user with a different email from accepting the team invite (#24491)
Jack Hay [Thu, 4 May 2023 01:21:58 +0000 (21:21 -0400)]
Prevent a user with a different email from accepting the team invite (#24491)

## Changes
- Fixes the case where a logged in user can accept an email invitation
even if their email address does not match the address in the invitation

17 months agoFix incorrect webhook time and use relative-time to display it (#24477)
yp05327 [Wed, 3 May 2023 23:53:43 +0000 (08:53 +0900)]
Fix incorrect webhook time and use relative-time to display it (#24477)

Fixes #24414
After click replay this webhook, it will display `now`

![image](https://user-images.githubusercontent.com/18380374/235559399-05a23927-13f5-442d-8f10-2c7cd24022a0.png)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoMake Issue/PR/projects more compact, misc CSS tweaks (#24459)
silverwind [Wed, 3 May 2023 21:58:59 +0000 (23:58 +0200)]
Make Issue/PR/projects more compact, misc CSS tweaks (#24459)

- Remove various horizontal dividers on repo pages that didn't provide
visual benefit
- Remove label/milestone pills on single issue/pr page
- Remove issue-related pill buttons on projects page
- Increase contrast of color-secondary on arc-green
- Improve notifications icon, make circle bigger
- Remove some inline styles
- Fix focus in issue/pr title edit and select all text on button click

### Issue and PR before and after

<img width="1249" alt="Screenshot 2023-05-01 at 11 44 22"
src="https://user-images.githubusercontent.com/115237/235436662-a708288e-84fb-4b2e-a5a2-3a1c17d28f6c.png">
<img width="1248" alt="Screenshot 2023-05-01 at 11 58 51"
src="https://user-images.githubusercontent.com/115237/235437992-f863e483-f3cc-4cc1-8204-fd223647a0c9.png">

### Projects before and after

<img width="1255" alt="Screenshot 2023-05-01 at 11 41 02"
src="https://user-images.githubusercontent.com/115237/235436433-0deb85d6-4e7d-4e74-847f-254cc70a0cf9.png">
<img width="1267" alt="Screenshot 2023-05-01 at 11 40 03"
src="https://user-images.githubusercontent.com/115237/235436431-715b13cb-f78c-4d86-b27a-9229f9738c5b.png">

### Releases before and after

<img width="1243" alt="Screenshot 2023-05-01 at 11 41 12"
src="https://user-images.githubusercontent.com/115237/235436457-b655ee6f-03b8-4595-8d8c-b15ea469e988.png">
<img width="1240" alt="Screenshot 2023-05-01 at 11 40 10"
src="https://user-images.githubusercontent.com/115237/235436456-05a2a0dd-7cbb-4f26-b0d3-4f667df4bb95.png">

### Misc

<img width="58" alt="Screenshot 2023-05-01 at 10 49 13"
src="https://user-images.githubusercontent.com/115237/235432494-936ce995-6e22-47bc-ab2d-c9e93d31987d.png">
<img width="57" alt="Screenshot 2023-05-01 at 18 57 08"
src="https://user-images.githubusercontent.com/115237/235492430-1d32cfe0-0f2c-467c-b2fa-925b27e30e0e.png">

Issue title edit and wrap:

<img width="1238" alt="Screenshot 2023-05-01 at 12 34 40"
src="https://user-images.githubusercontent.com/115237/235441407-d5067a57-e586-4865-a652-282e5944abb4.png">
<img width="1232" alt="Screenshot 2023-05-01 at 12 06 24"
src="https://user-images.githubusercontent.com/115237/235438710-1a543dda-220f-4d87-8f93-f1710c0695f0.png">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoImplement Cargo HTTP index (#24452)
KN4CK3R [Wed, 3 May 2023 20:58:43 +0000 (22:58 +0200)]
Implement Cargo HTTP index (#24452)

This implements the HTTP index
[RFC](https://rust-lang.github.io/rfcs/2789-sparse-index.html) for Cargo
registries.

Currently this is a preview feature and you need to use the nightly of
`cargo`:

`cargo +nightly -Z sparse-registry update`

See https://github.com/rust-lang/cargo/issues/9069 for more information.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoClean up polluted styles and remove dead CSS code (#24497)
wxiaoguang [Wed, 3 May 2023 18:32:10 +0000 (02:32 +0800)]
Clean up polluted styles and remove dead CSS code (#24497)

Follow #24393

The funny history:

* At the beginning, `.ui.message` was polluted by `text-align: center`
* Then people do `<div class="ui ... message text left">`
* But `.ui.left` is polluted by `float: left`
* Then people do `#xxx .ui.message { width: 100% !important;}`

The code just becomes more and more hacky.

After removing the pollution,  everything becomes clear and straight.

And, this PR also does:

1. Remove the `package.css`, its styles could be provided by `top
aligned`
2. Remove `#avatar-arrow`, dead code

Screenshot:

![image](https://user-images.githubusercontent.com/2114189/235862130-a9eb5d8f-7d01-457c-99f7-21d0abc3075e.png)

![image](https://user-images.githubusercontent.com/2114189/235862222-139709a7-95c2-4f89-a40f-100b2d76d9bb.png)

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoImprove pull request merge box when pull request merged and branch deleted. (#24397)
Lunny Xiao [Wed, 3 May 2023 13:52:19 +0000 (21:52 +0800)]
Improve pull request merge box when pull request merged and branch deleted. (#24397)

This PR hide the pull request merge box totally if it's merged and branch deleted.

It's also add a bold for merge base commit id in merged message comment

Before:

<img width="989" alt="图片"
src="https://user-images.githubusercontent.com/81045/235066590-28deb506-e824-4a42-a9a2-791cd136756e.png">

After:

<img width="1030" alt="图片"
src="https://user-images.githubusercontent.com/81045/235080749-11d5efe8-a06e-4528-a75f-f6c6d191db50.png">

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoFix EasyMDE toolbar (#24489)
silverwind [Wed, 3 May 2023 05:23:39 +0000 (07:23 +0200)]
Fix EasyMDE toolbar (#24489)

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

The "clean block" button is gone because I could not find a matching
octicon. Order of buttons is roughly equal to textarea.

<img width="824" alt="Screenshot 2023-05-02 at 21 10 00"
src="https://user-images.githubusercontent.com/115237/235762593-ceccb260-e665-4932-ac8a-ef6fe8406a3c.png">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoEnhance stylelint rule config, remove dead CSS (#24472)
silverwind [Wed, 3 May 2023 03:15:52 +0000 (05:15 +0200)]
Enhance stylelint rule config, remove dead CSS (#24472)

Make this stylelint rule match on more properties.

The dead CSS relates to the navbar, which currently has classes:

```
ui top secondary stackable main menu following bar light
```

Which means `.following.bar .top.menu` can never match, so remove this
dead CSS as well as inactive `z-index` and `left` on it.

Commits table striping becomes more visible on dark theme, but I don't
think it's worth introducing a new color until
https://github.com/go-gitea/gitea/pull/24423 is ready, which would have
to remove it again:

<img width="668" alt="Screenshot 2023-05-01 at 18 41 49"
src="https://user-images.githubusercontent.com/115237/235489873-6b272899-1d78-443a-872c-ee7731c269f9.png">
<img width="680" alt="Screenshot 2023-05-01 at 18 41 41"
src="https://user-images.githubusercontent.com/115237/235489878-1b9468af-c74f-48a6-a469-9eba57cfcb4d.png">

17 months agoFix api error message if fork exists (#24487)
Otto Richter (fnetX) [Wed, 3 May 2023 00:26:38 +0000 (02:26 +0200)]
Fix api error message if fork exists (#24487)

On the @Forgejo instance of Codeberg, we discovered that forking a repo
which is already forked now returns a 500 Internal Server Error, which
is unexpected. This is an attempt at fixing this.

The error message in the log:
~~~
2023/05/02 08:36:30 .../api/v1/repo/fork.go:147:CreateFork() [E]
[6450cb8e-113] ForkRepository: repository is already forked by user
[uname: ...., repo path: .../..., fork path: .../...]
~~~

The service that is used for forking returns a custom error message
which is not checked against.

About the order of options:
The case that the fork already exists should be more common, followed by
the case that a repo with the same name already exists for other
reasons. The case that the global repo limit is hit is probably not the
likeliest.

Co-authored-by: Otto Richter <otto@codeberg.org>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoAdd ntlm authentication support for mail (#23811)
木木田 [Tue, 2 May 2023 21:40:46 +0000 (05:40 +0800)]
Add ntlm authentication support for mail (#23811)

Add ntlm authentication support for mail
use "github.com/Azure/go-ntlmssp"

---------

Co-authored-by: yangtan_win <YangTan@Fitsco.com.cn>
Co-authored-by: silverwind <me@silverwind.io>
17 months agoFix test delivery button in repo webhook settings page (#24478)
yp05327 [Tue, 2 May 2023 19:58:18 +0000 (04:58 +0900)]
Fix test delivery button in repo webhook settings page (#24478)

Caused by
https://github.com/go-gitea/gitea/pull/24246/files#diff-2bfe41d93dbb409583a4f945902e46bb513f60f1c9301649c1689200c4f1466eR1

Class `new` was removed in #24246, but in function
`initCompWebHookEditor`, it will check `.new.webhook`.
So in repo webhook settings page, `initCompWebHookEditor` will init
nothing, and no response after click the test delivery button.

https://github.com/go-gitea/gitea/blob/da65b7ad47e8d0d82f47cb24ee9ac2a0ec50dc25/web_src/js/features/comp/WebHookEditor.js#L6-L9

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoAdd Debian package registry (#24426)
KN4CK3R [Tue, 2 May 2023 16:31:35 +0000 (18:31 +0200)]
Add Debian package registry (#24426)

Co-authored-by: @awkwardbunny
This PR adds a Debian package registry.
You can follow [this
tutorial](https://www.baeldung.com/linux/create-debian-package) to build
a *.deb package for testing.
Source packages are not supported at the moment and I did not find
documentation of the architecture "all" and how these packages should be
treated.

![grafik](https://user-images.githubusercontent.com/1666336/218126879-eb80a866-775c-4c8e-8529-5797203a64e6.png)

Part of #20751.

Revised copy of #22854.

---------

Co-authored-by: Brian Hong <brian@hongs.me>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoEnable whitespace rendering on selection in Monaco (#24444)
silverwind [Tue, 2 May 2023 13:31:38 +0000 (15:31 +0200)]
Enable whitespace rendering on selection in Monaco (#24444)

Remove the
[renderWhitespace](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IEditorOptions.html#renderWhitespace)
override, so the default value of `selection` takes over and makes
whitespace visible on selection.

<img width="128" alt="Screenshot 2023-04-30 at 19 09 41"
src="https://user-images.githubusercontent.com/115237/235366707-d598268d-03cc-4839-a195-c460bddae99b.png">

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoReplace `N/A` with `-` everywhere (#24474)
silverwind [Tue, 2 May 2023 09:54:29 +0000 (11:54 +0200)]
Replace `N/A` with `-` everywhere (#24474)

Followup to https://github.com/go-gitea/gitea/pull/24427.

Reasoning is that `N/A` is specific to english while `-` is
language-neutral and does not need translation.

Before:
<img width="891" alt="Screenshot 2023-05-01 at 20 58 20"
src="https://user-images.githubusercontent.com/115237/235511592-8a36d0f2-34ff-4dbe-b642-67c0ade644fe.png">

After:
<img width="901" alt="Screenshot 2023-05-01 at 20 59 59"
src="https://user-images.githubusercontent.com/115237/235511594-d49f6d09-92e8-4e99-be7b-2a37f5d24129.png">

17 months agoFix invite display (#24447)
KN4CK3R [Tue, 2 May 2023 07:59:31 +0000 (09:59 +0200)]
Fix invite display (#24447)

Regression of #23901

Before

![grafik](https://user-images.githubusercontent.com/1666336/235371271-f4d06df5-97a0-43bc-b905-5fcdc5666b29.png)

After

![grafik](https://user-images.githubusercontent.com/1666336/235371311-5c03003e-b628-4721-93a6-4e2b1ada4d87.png)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 2 May 2023 00:23:19 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

17 months agoreplace PR docker dry run in drone with Actions (#24475)
techknowlogick [Mon, 1 May 2023 20:39:36 +0000 (16:39 -0400)]
replace PR docker dry run in drone with Actions (#24475)

As before with past PRs to switch Drone pipelines to use (GitHub)
Actions.

---------

Co-authored-by: silverwind <me@silverwind.io>
17 months agocorrect env vars
techknowlogick [Mon, 1 May 2023 18:31:11 +0000 (14:31 -0400)]
correct env vars

17 months agonightly image tag for releases
techknowlogick [Mon, 1 May 2023 18:18:56 +0000 (14:18 -0400)]
nightly image tag for releases

17 months agoRemove `font-awesome` and fomantic `icon` module (#24471)
silverwind [Mon, 1 May 2023 17:25:54 +0000 (19:25 +0200)]
Remove `font-awesome` and fomantic `icon` module (#24471)

Fixes https://github.com/go-gitea/gitea/issues/10410.
This PR removes around 120kB of CSS.

17 months agoImprove "new-menu" (#24465)
wxiaoguang [Mon, 1 May 2023 16:08:37 +0000 (00:08 +0800)]
Improve "new-menu" (#24465)

I am not sure what "new-menu" means, but I think we need to fix these
problems:

1. it shouldn't have "stackable", which makes the items stacked when
width is small. the `new-menu` already has `overflow: auto`
2. `justify-content: center` doesn't work with `overflow: auto` (for
small width), so use `margin: auto`
*
https://bhch.github.io/posts/2021/04/centring-flex-items-and-allowing-overflow-scroll/
3. `runner-new-menu` is dead code (copying & pasting ?)

17 months agoRemove fomantic breadcrumb module (#24463)
silverwind [Mon, 1 May 2023 15:40:02 +0000 (17:40 +0200)]
Remove fomantic breadcrumb module (#24463)

### File path before/after

<img width="522" alt="Screenshot 2023-05-01 at 13 23 33"
src="https://user-images.githubusercontent.com/115237/235445636-57776038-c98e-4cab-8abe-045138a76958.png">
<img width="522" alt="Screenshot 2023-05-01 at 13 24 08"
src="https://user-images.githubusercontent.com/115237/235445638-70bef62a-1b70-41f8-ba51-728db4d54402.png">

### File edit before/after

<img width="499" alt="Screenshot 2023-05-01 at 13 24 46"
src="https://user-images.githubusercontent.com/115237/235445676-7b3cc23e-289b-40a6-8d4f-0d7fb2efb55e.png">
<img width="497" alt="Screenshot 2023-05-01 at 13 24 52"
src="https://user-images.githubusercontent.com/115237/235445677-db9f3974-8456-46de-a32b-9198110c0540.png">

### Cherry-pick before/after

<img width="590" alt="Screenshot 2023-05-01 at 13 25 30"
src="https://user-images.githubusercontent.com/115237/235445717-99445024-1bb2-46d4-9bd8-8086bad57d34.png">
<img width="582" alt="Screenshot 2023-05-01 at 13 25 37"
src="https://user-images.githubusercontent.com/115237/235445720-9c1dc497-eb23-4e10-a727-27f4d6df69e6.png">

17 months agoAdd rerun workflow button and refactor to use SVG octicons (#24350)
yp05327 [Mon, 1 May 2023 14:14:20 +0000 (23:14 +0900)]
Add rerun workflow button and refactor to use SVG octicons (#24350)

Changes:
- Add rerun workflow button. Then users can rerun the whole workflow by
only one-click.
- Refactor to use SVG octicons in RepoActionView.vue

![image](https://user-images.githubusercontent.com/18380374/234736083-dea9b333-ec11-4095-a113-763f3716fba7.png)

![image](https://user-images.githubusercontent.com/18380374/234736107-d657d19c-f70a-42f4-985f-156a8c7efb7a.png)

![image](https://user-images.githubusercontent.com/18380374/234736160-9ad372df-7089-4d18-9bab-48bca3f01878.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoRemove .lgtm and reference to old bot (#24464)
silverwind [Mon, 1 May 2023 12:49:30 +0000 (14:49 +0200)]
Remove .lgtm and reference to old bot (#24464)

Since we now use
[gitea-backporter](https://github.com/GiteaBot/gitea-backporter) for
LGTM, we no longer need this.

17 months agoRemove unnecessary g-menu-stackable-scrollable (#24462)
wxiaoguang [Mon, 1 May 2023 10:51:14 +0000 (18:51 +0800)]
Remove unnecessary g-menu-stackable-scrollable (#24462)

Fix #24460

That's a mistake but ..... no idea why I wrote so ... remove it.

17 months agoReplace remaining fontawesome dropdown icons with SVG (#24455)
silverwind [Mon, 1 May 2023 09:35:02 +0000 (11:35 +0200)]
Replace remaining fontawesome dropdown icons with SVG (#24455)

- Replace leftover dropdown triangles with SVG
- Replace remove icon with SVG and add styling for it:

<img width="817" alt="Screenshot 2023-05-01 at 00 40 05"
src="https://user-images.githubusercontent.com/115237/235379271-4674d4f7-b11e-4d6d-90f9-1478325443ca.png">
<img width="816" alt="Screenshot 2023-05-01 at 00 46 56"
src="https://user-images.githubusercontent.com/115237/235379451-b515afb3-9773-4f6f-a259-e7048235bcba.png">

17 months agoMove links out of translation (#24446)
KN4CK3R [Mon, 1 May 2023 07:17:27 +0000 (09:17 +0200)]
Move links out of translation (#24446)

Addition to
https://github.com/go-gitea/gitea/pull/24426#discussion_r1181261215

I updated all existing translations too because otherwise they would
show something like

> For more information on the Container registry, see [the
documentation](#).%!(EXTRA
string=https://docs.gitea.io/en-us/packages/container/)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agotarget correct conditional
techknowlogick [Mon, 1 May 2023 04:31:50 +0000 (00:31 -0400)]
target correct conditional

17 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 1 May 2023 00:25:30 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

17 months agoSet stop_on_error (#24453)
KN4CK3R [Sun, 30 Apr 2023 22:31:16 +0000 (00:31 +0200)]
Set stop_on_error (#24453)

Current air version runs the old binary if the build fails. This
restores the old behaviour.

```
...
code.gitea.io/gitea/services/cron
code.gitea.io/gitea/routers/web/user/setting
code.gitea.io/gitea/routers/web/org
make[2]: *** [Makefile:814: gitea] Error 1
make[2]: Leaving directory '/src'
failed to build, error: exit status 2
running...
2023/04/30 21:04:11 cmd/web.go:125:runWeb() [I] Starting Gitea on PID: 29153
2023/04/30 21:04:11 cmd/web.go:178:runWeb() [I] Global init
...
```

Reference: https://github.com/cosmtrek/air/pull/336

17 months agoRemove all direct references to font-awesome (#24448)
Yarden Shoham [Sun, 30 Apr 2023 22:02:56 +0000 (01:02 +0300)]
Remove all direct references to font-awesome (#24448)

- Related #10410
- I had to add an SVG for an empty checkbox
https://github.com/primer/octicons/issues/942

# Before

![image](https://user-images.githubusercontent.com/20454870/235374683-13f355c3-1245-40db-adda-4c710fc80288.png)

# After

![image](https://user-images.githubusercontent.com/20454870/235374655-cc637132-f314-424d-9243-13d45b8915d5.png)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoAdd `ui-monospace` and `SF Mono` to `--fonts-monospace` (#24442)
silverwind [Sun, 30 Apr 2023 18:58:32 +0000 (20:58 +0200)]
Add `ui-monospace` and `SF Mono` to `--fonts-monospace` (#24442)

- Add `ui-monospace` to support Safari 13.4+.
- Add `SF Mono` variant to support the font on non-mac.
- Quote fonts as per [W3C
recommendation](https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#propdef-font-family).

> it is recommended to quote font family names that contain white space,
digits, or punctuation characters other than hyphens

Fixes: https://github.com/go-gitea/gitea/issues/22125
17 months agoFix incorrect CurrentUser check for docker rootless (#24441)
wxiaoguang [Sun, 30 Apr 2023 18:14:57 +0000 (02:14 +0800)]
Fix incorrect CurrentUser check for docker rootless (#24441)

The IsRunUserMatchCurrentUser logic is fragile, the "SSH" config is not
ready when it executes.

17 months agoFix config list overflow and layout (#24312)
silverwind [Sun, 30 Apr 2023 17:32:07 +0000 (19:32 +0200)]
Fix config list overflow and layout (#24312)

Fixes: https://github.com/go-gitea/gitea/issues/24299
<img width="531" alt="Screenshot 2023-04-24 at 21 05 40"
src="https://user-images.githubusercontent.com/115237/234091905-9db42697-87b3-40a0-bd18-9e910ad8a2ae.png">

17 months agoMove docs pipelines to use Actions (#24434)
techknowlogick [Sun, 30 Apr 2023 16:23:26 +0000 (12:23 -0400)]
Move docs pipelines to use Actions (#24434)

similar to #24314, this moves drone cron pipelines to (GitHub) Actions.
As these are mostly compatible with Gitea Actions, when we start to
dogfood, these will already be migrated.

I also removed the discord notify pipeline, as it hasn't been working
for several months.

17 months agoImprove issue list filter (#24425)
wxiaoguang [Sun, 30 Apr 2023 15:51:20 +0000 (23:51 +0800)]
Improve issue list filter (#24425)

Partial regression of #24393, not only regression, but broken for long
time, 24393 didn't really improve it but used wrong `overflow: scroll`.

Actually, that "ui secondary filter menu labels" shouldn't be set as
scrollable (I missed that at that time), the problem is: if a "ui menu"
has "dropdown" items, then it should not be scrollable. Otherwise the
dropdown menu can't be shown correctly.

And there are more problems:

* The "issue-filters" shouldn't be used anywhere else (copying&pasting
problem again ....)
* There is also an "issue-actions" container, it should also be fixed.
* There are similar problems on the milestone page.
* The old comment in code: "grid column" doesn't work well.

The major changes of this PR are: use "flex: 1" instead of "ui grid
column".

After this PR, not 100% perfect but much better than before.

17 months agoMove `Rename branch` from repo settings page to the page of branches list (#24380)
sillyguodong [Sun, 30 Apr 2023 15:08:51 +0000 (23:08 +0800)]
Move `Rename branch` from repo settings page to the page of branches list (#24380)

Co-Author: @wxiaoguang

It is more convenient that user just need to enter a new branch name after he selects the branch which he want to rename.
So this PR move the function of renaming branch to the page of branches list.

This PR also restyle the button of `new branch`, `download`, `delete`....

https://user-images.githubusercontent.com/33891828/235277997-413060bb-759f-430a-b5c4-df5e40ffcd28.mov

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
17 months agoImprove milestone filter on issues page (#22423)
Lunny Xiao [Sun, 30 Apr 2023 13:12:49 +0000 (21:12 +0800)]
Improve milestone filter on issues page (#22423)

Now we have `All milestones`, `No milestones`, `Open milestones` and
`Closed milestones`.
Fix #11924
Fix #22411

<img width="1166" alt="image"
src="https://user-images.githubusercontent.com/81045/212243375-95eea035-a972-44b8-8088-53db614cb07e.png">

17 months agoUse globally shared HTMLRender (#24436)
wxiaoguang [Sun, 30 Apr 2023 12:22:23 +0000 (20:22 +0800)]
Use globally shared HTMLRender (#24436)

The old `HTMLRender` is not ideal.

1. It shouldn't be initialized multiple times, it consumes a lot of
memory and is slow.
2. It shouldn't depend on short-lived requests, the `WatchLocalChanges`
needs a long-running context.
3. It doesn't make sense to use FuncsMap slice.

HTMLRender was designed to only work for GItea's specialized 400+
templates, so it's good to make it a global shared instance.

17 months agoRework header bar on issue, pull requests and milestone (#24420)
silverwind [Sun, 30 Apr 2023 03:33:25 +0000 (05:33 +0200)]
Rework header bar on issue, pull requests and milestone (#24420)

- Make search bar dynamic full width via flexbox
- Make all buttons `small` so font size is the same for all elements in
the header
- Remove primary color from search field, add SVG icon like on Code tab
- Fix button vertical padding being enlarged by SVG icons

[View diff without
whitespace](https://github.com/go-gitea/gitea/pull/24420/files?diff=unified&w=1)

<img width="1226" alt="Screenshot 2023-04-29 at 11 58 53"
src="https://user-images.githubusercontent.com/115237/235296851-74848267-664f-4c1f-b94c-a1b94196ff75.png">
<img width="1219" alt="Screenshot 2023-04-29 at 11 59 39"
src="https://user-images.githubusercontent.com/115237/235296852-bcfde5ed-8658-43c2-b7e5-3ad84611e76f.png">

Mobile:
<img width="437" alt="Screenshot 2023-04-29 at 11 59 52"
src="https://user-images.githubusercontent.com/115237/235296860-99263373-7b27-4540-868c-a93e70f281ca.png">
<img width="433" alt="Screenshot 2023-04-29 at 12 00 00"
src="https://user-images.githubusercontent.com/115237/235296862-6cf64317-a864-405a-a00f-b5ab620349f5.png">

17 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 30 Apr 2023 00:25:54 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

17 months agoRemove unused setting `time.FORMAT` (#24430)
Yarden Shoham [Sat, 29 Apr 2023 20:51:43 +0000 (23:51 +0300)]
Remove unused setting `time.FORMAT` (#24430)

It's loaded and then never used.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoFix user-cards format (#24428)
KN4CK3R [Sat, 29 Apr 2023 19:43:01 +0000 (21:43 +0200)]
Fix user-cards format (#24428)

Fixes #24418

17 months agoAdd follow organization and fix the logic of following page (#24345)
yp05327 [Sat, 29 Apr 2023 19:13:58 +0000 (04:13 +0900)]
Add follow organization and fix the logic of following page (#24345)

![image](https://user-images.githubusercontent.com/18380374/234740589-066f2e5c-30c7-4fc3-a539-066100e1f138.png)

![image](https://user-images.githubusercontent.com/18380374/234740605-88efe55d-7eaa-422e-ab86-0b5a402ca11c.png)

Maybe we can fix user card tmpl in #24319?
Or maybe a list is better here

![image](https://user-images.githubusercontent.com/18380374/234451417-7f93df20-4b19-4abb-a62d-4c67e1aa2220.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoAdd "Updated" column for admin repositories list (#24429)
Yarden Shoham [Sat, 29 Apr 2023 18:40:10 +0000 (21:40 +0300)]
Add "Updated" column for admin repositories list (#24429)

- Closes #12454

# Before

![image](https://user-images.githubusercontent.com/20454870/235314351-82f5a414-7827-4029-8779-a837283a5a05.png)
# After

![image](https://user-images.githubusercontent.com/20454870/235314376-ccf4bb95-6823-4fce-9b9a-a23da2351769.png)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
17 months agoAdd ability to specify '--not' from GetAllCommits (#24409)
Matthew Walowski [Sat, 29 Apr 2023 12:34:14 +0000 (05:34 -0700)]
Add ability to specify '--not' from GetAllCommits (#24409)

For my specific use case, I'd like to get all commits that are on one
branch but NOT on the other branch.

For instance, I'd like to get all the commits on `Branch1` that are not
also on `master` (I.e. all commits that were made after `Branch1` was
created).

This PR adds a `not` query param that gets passed down to the `git log`
command to allow the user to exclude items from `GetAllCommits`.

See [git
documentation](https://git-scm.com/docs/git-log#Documentation/git-log.txt---not)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoImprove template helper (#24417)
wxiaoguang [Sat, 29 Apr 2023 12:02:29 +0000 (20:02 +0800)]
Improve template helper (#24417)

It seems that we really need the "context function" soon. So we should
clean up the helper functions first.

Major changes:

* Improve StringUtils and add JsonUtils
* Remove one-time-use helper functions like CompareLink
* Move other code (no change) to util_avatar/util_render/util_misc (no
need to propose changes for them)

I have tested the changed templates:

![image](https://user-images.githubusercontent.com/2114189/235283862-608dbf6b-2da3-4d06-8157-b523ca93edb4.png)

![image](https://user-images.githubusercontent.com/2114189/235283888-1dfc0471-e622-4d64-9d76-7859819580d3.png)

![image](https://user-images.githubusercontent.com/2114189/235283903-d559f14d-4abb-4a50-915f-2b9cbc381a7a.png)

![image](https://user-images.githubusercontent.com/2114189/235283955-b7b5adea-aca3-4758-b38a-3aae3f7c6048.png)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoStart cleaning the messy ".ui.left / .ui.right", improve label list page, fix stackab...
wxiaoguang [Sat, 29 Apr 2023 11:35:59 +0000 (19:35 +0800)]
Start cleaning the messy ".ui.left / .ui.right", improve label list page, fix stackable menu (#24393)

Since 2015/2016, there is a global pollution: ".ui.left" / ".ui.right".

Fomantic UI doesn't work this way, it just conflicts with many Fomantic
definitions.

This PR starts the cleaning work of such techinical debts.

And, the "label list" page has been quite messy for long time, for
example, why "li" appears in "div" ......

And fix #24296

<details>

![image](https://user-images.githubusercontent.com/2114189/235051281-54c5374c-b5fd-4b5f-9aa2-02d4bb2d9112.png)

![image](https://user-images.githubusercontent.com/2114189/235055703-2ba042e0-4db7-4e63-8646-02f390d496b5.png)

![image](https://user-images.githubusercontent.com/2114189/235056310-4f6ffdc2-5758-4927-8fb8-314d9fb72a6b.png)

![image](https://user-images.githubusercontent.com/2114189/235058400-dab1c9ec-3325-4671-8345-aee6b0b68042.png)

![image](https://user-images.githubusercontent.com/2114189/235058424-85509532-b9bc-43ad-b00f-a87184c60f22.png)

</details>

17 months agoImprove protected branch setting page (#24379)
Hester Gong [Sat, 29 Apr 2023 10:44:52 +0000 (18:44 +0800)]
Improve protected branch setting page (#24379)

Main changes:

1. Change html structure of protected branch page, use [`grouped
fields`](https://fomantic-ui.com/collections/form.html#grouped-fields)
instead of `fields` for better margin, and wrap `grouped fields` around
related `field`s, remove unnecessary `<div id="protection_box"
class="fields">` outer div

2. Changed some order of field to make them more categorized, used `ui
dividing header` for categorization and fine tune css.

Before:

<img width="1907" alt="Screen Shot 2023-04-27 at 14 56 19"
src="https://user-images.githubusercontent.com/17645053/234783731-bce8a7ce-dfc9-4d47-a3a8-b962ebea9467.png">
<img width="1849" alt="Screen Shot 2023-04-27 at 14 56 30"
src="https://user-images.githubusercontent.com/17645053/234783740-c47d314e-5e2d-4854-98fd-c88f85ef3584.png">
<img width="1872" alt="Screen Shot 2023-04-27 at 14 56 36"
src="https://user-images.githubusercontent.com/17645053/234783745-18e35a75-07e8-451d-b001-f9bcf16fcab5.png">

After:

https://user-images.githubusercontent.com/17645053/235114568-da010aad-7654-4410-ab8c-5d0fce7edadb.mov

3. Changed "Enable Merge Whitelist" to radio checkbox, and added "Enable
Merge" radio checkbox, which are exclusive

Before:

<img width="926" alt="Screen Shot 2023-04-28 at 13 08 29"
src="https://user-images.githubusercontent.com/17645053/235059233-75790f7a-e5ea-4e1c-82c6-509fef8b84b3.png">

After:

<img width="942" alt="Screen Shot 2023-04-28 at 13 09 28"
src="https://user-images.githubusercontent.com/17645053/235059367-852d1f61-8407-4126-8c79-315b9c1ffada.png">

4. Add a link to set default branch on branch list page (with reference
to github)

https://user-images.githubusercontent.com/17645053/234787404-61c1c7b6-aabf-429f-a109-5b690e4e0b5a.mov

5. Removed dead codes.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoSkip known flaky `queue` tests on CI environment (#24419)
silverwind [Sat, 29 Apr 2023 09:53:11 +0000 (11:53 +0200)]
Skip known flaky `queue` tests on CI environment (#24419)

Random CI failures are annoying. It's better to just skip the affected
tests so maintainers can use their valuable time for more productive
topics.

Related: https://github.com/go-gitea/gitea/issues/23608
Related: https://github.com/go-gitea/gitea/issues/23977
Related: https://github.com/go-gitea/gitea/issues/18703