]> source.dussan.org Git - gitea.git/log
gitea.git
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>
16 months agoFix <empty> in administration/config-cheat-sheet.en-us.md (#24905)
HesterG [Wed, 24 May 2023 08:29:44 +0000 (16:29 +0800)]
Fix <empty> in administration/config-cheat-sheet.en-us.md (#24905)

Before

<img width="206" alt="Screen Shot 2023-05-24 at 15 54 02"
src="https://github.com/go-gitea/gitea/assets/17645053/3493180e-e7a8-466d-b418-641c39d7788c">

<img width="272" alt="Screen Shot 2023-05-24 at 15 50 05"
src="https://github.com/go-gitea/gitea/assets/17645053/b1c80313-5b2c-41d8-aad3-4099c912c173">

<img width="264" alt="Screen Shot 2023-05-24 at 15 50 16"
src="https://github.com/go-gitea/gitea/assets/17645053/9a4b4223-ce67-40b3-a44e-03219694a37d">

After

<img width="295" alt="Screen Shot 2023-05-24 at 15 52 53"
src="https://github.com/go-gitea/gitea/assets/17645053/fbc8ef6e-2b9b-44f5-ba4f-6002cf2f19fe">
<img width="334" alt="Screen Shot 2023-05-24 at 15 53 03"
src="https://github.com/go-gitea/gitea/assets/17645053/6ebe45bf-b986-4afc-9b5c-d0c0134650c2">
<img width="282" alt="Screen Shot 2023-05-24 at 15 53 13"
src="https://github.com/go-gitea/gitea/assets/17645053/90ccc1ae-69f5-4730-8191-5e86ed0f6d49">

16 months agoOnly validate changed columns when update user (#24867)
Lunny Xiao [Wed, 24 May 2023 07:30:55 +0000 (15:30 +0800)]
Only validate changed columns when update user (#24867)

Fix #23211
Replace #23496

16 months agoRename docs packages title from xxx Packages Repository -> xxx Package Registry ...
Lunny Xiao [Wed, 24 May 2023 06:21:39 +0000 (14:21 +0800)]
Rename docs packages title from xxx Packages Repository -> xxx Package Registry (#24895)

As title.

16 months agoFix can’t move anymore items in repo project boards (#24892)
yp05327 [Wed, 24 May 2023 06:05:50 +0000 (15:05 +0900)]
Fix can’t move anymore items in repo project boards (#24892)

Fix #24879
Related to #24589

In #24589, I changed the css, but didn't reflect the changes in
repo-level projects template.

16 months agoMake environment-to-ini support loading key value from file (#24832)
wxiaoguang [Wed, 24 May 2023 03:37:22 +0000 (11:37 +0800)]
Make environment-to-ini  support loading key value from file (#24832)

Replace #19857

Close #19856
Close #10311
Close #10123

Major changes:

1. Move a lot of code from `environment-to-ini.go` to `config_env.go` to
make them testable.
2. Add `__FILE` support
3. Update documents
4. Add tests

16 months ago`zh-cn` translation for administration docs (#24881)
Zettat123 [Wed, 24 May 2023 02:35:43 +0000 (10:35 +0800)]
`zh-cn` translation for administration docs (#24881)

- [x] adding-legal-pages
- [x] cmd-embedded
- [x] command-line
- [x] email-setup
- [x] external-renderers
- [x] git-lfs-support
- [x] logging-config
- [x] mail-templates
- [x] repo-indexer
- [x] search-engines-indexation
- [x] signing

16 months agoFix `@font-face` overrides (#24855)
silverwind [Wed, 24 May 2023 01:48:51 +0000 (03:48 +0200)]
Fix `@font-face` overrides (#24855)

Fixes: https://github.com/go-gitea/gitea/issues/24850
Not sure how to do it for asian fonts only, so let's revert to previous
value for now.

### Before
<img width="414" alt="Screenshot 2023-05-22 at 10 34 10"
src="https://github.com/go-gitea/gitea/assets/115237/749f1556-a5cf-48fe-8b10-8dc447221657">

### After
<img width="416" alt="Screenshot 2023-05-22 at 10 34 04"
src="https://github.com/go-gitea/gitea/assets/115237/a0a315bb-d95f-4d03-863e-0534f665ca71">

16 months agoFix logger refactoring regression: manager logging add (#24847)
wxiaoguang [Wed, 24 May 2023 00:09:33 +0000 (08:09 +0800)]
Fix logger refactoring regression: manager logging add (#24847)

The `rotate` option is optional.

Test result:

![image](https://github.com/go-gitea/gitea/assets/2114189/7cff8207-dcf3-4988-adef-247f1c9316e7)

16 months agoRemove publish docs CI workflow (#24889)
techknowlogick [Tue, 23 May 2023 20:41:27 +0000 (16:41 -0400)]
Remove publish docs CI workflow (#24889)

Now that the redirect to docs.gitea.com is in place this is no longer
needed.

16 months agoFix double border and adjust width for user profile page (#24870)
HesterG [Tue, 23 May 2023 17:55:51 +0000 (01:55 +0800)]
Fix double border and adjust width for user profile page (#24870)

Close #24848

16 months agoSupport changing git config through `app.ini`, use `diff.algorithm=histogram` by...
wxiaoguang [Tue, 23 May 2023 16:30:19 +0000 (00:30 +0800)]
Support changing git config through `app.ini`, use `diff.algorithm=histogram` by default (#24860)

Close #13454 , Close #23255, Close #14697 (and maybe more related
issues)

Many users have the requirement to customize the git config. This PR
introduces an easy way: put the options in Gitea's app.ini
`[git.config]`, then the config options will be applied to git config.

And it can support more flexible default config values, eg: now
`diff.algorithm=histogram` by default. According to:
https://stackoverflow.com/a/32367597/4754037 , `histogram diff` is
efficient and doesn't like to cause server-side problems.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix flakey test in logger test (#24883)
wxiaoguang [Tue, 23 May 2023 16:01:20 +0000 (00:01 +0800)]
Fix flakey test in logger test (#24883)

Fix #24882

The goroutines are all asynchronized. So it needs a little "sleep" to
make sure the writer's goroutine has been paused before sending messages
to it.

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoRun stylelint on .vue files (#24865)
silverwind [Tue, 23 May 2023 13:54:21 +0000 (15:54 +0200)]
Run stylelint on .vue files (#24865)

- Run stylelint on .vue files
- Fix discovered issues
- Suppress warning spam from `declaration-strict-value` rule

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoUpdate `CONTRIBUTING.md` (#24492)
John Olheiser [Tue, 23 May 2023 12:22:40 +0000 (07:22 -0500)]
Update `CONTRIBUTING.md` (#24492)

Previously, the `CONTRIBUTING` was severely outdated in certain aspects
such as workflows.
These sections have been brought up to date.
Furthermore, the `CONTRIBUTING` now mentions the TOC, how it is
structured, elected, and its duties.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: delvh <dev.lh@web.de>
16 months agoDo not call nil handler for a dummy queue (#24880)
wxiaoguang [Tue, 23 May 2023 11:40:55 +0000 (19:40 +0800)]
Do not call nil handler for a dummy queue (#24880)

A dummy queue doesn't really have a handler (see line 211), so the
`safeHandler` can safely drop all items

16 months agoRemove unnecessary usage prefix from doc titles (#24869)
Lunny Xiao [Tue, 23 May 2023 10:14:57 +0000 (18:14 +0800)]
Remove unnecessary usage prefix from doc titles (#24869)

As title.

16 months agoAdd API for Label templates (#24602)
JakobDev [Tue, 23 May 2023 10:10:23 +0000 (12:10 +0200)]
Add API for Label templates (#24602)

This adds API that allows getting the Label templates of the Gitea
Instance

16 months agoFix install page context, make the install page tests really test (#24858)
wxiaoguang [Tue, 23 May 2023 01:29:15 +0000 (09:29 +0800)]
Fix install page context, make the install page tests really test (#24858)

Fix #24856

Rename "context.contextKey" to "context.WebContextKey", this context is
for web context only. But the Context itself is not renamed, otherwise
it would cause a lot of changes (if we really want to rename it, there
could be a separate PR).

The old test code doesn't really test, the "install page" gets broken
not only one time, so use new test code to make sure the "install page"
could work.

16 months agoAdd validations.required check to dropdown field (#24849)
yp05327 [Mon, 22 May 2023 21:26:48 +0000 (06:26 +0900)]
Add validations.required check to dropdown field (#24849)

If dropdown is marked as required, we should not provide the `remove`
button.
This will cause user may post empty value which seems like a bug.

Definition:

![image](https://github.com/go-gitea/gitea/assets/18380374/cf48b478-244e-44e0-9a0e-7a0f02bc471a)
Post request form:

![image](https://github.com/go-gitea/gitea/assets/18380374/31d6f823-835f-422a-879c-3b1e18950ac8)
Result:

![image](https://github.com/go-gitea/gitea/assets/18380374/a9944fe9-24d0-4776-9eec-d31b70144eb4)

16 months agoUse Go 1.20 for next release (#24859)
wxiaoguang [Mon, 22 May 2023 16:29:53 +0000 (00:29 +0800)]
Use Go 1.20 for next release (#24859)

16 months agoAdd gitea manager reload-templates command (#24843)
Brecht Van Lommel [Mon, 22 May 2023 15:51:40 +0000 (17:51 +0200)]
Add gitea manager reload-templates command (#24843)

This can be useful to update custom templates in production mode, when
they are updated frequently and a full Gitea restart each time is
disruptive.

16 months agoRemove `In your repositories` link in milestones dashboard (#24853)
yp05327 [Mon, 22 May 2023 11:42:57 +0000 (20:42 +0900)]
Remove `In your repositories` link in milestones dashboard (#24853)

It is unnecessary to it.

16 months agoFix 500 error when select `No assignee` filter in issue list page (#24854)
yp05327 [Mon, 22 May 2023 11:08:27 +0000 (20:08 +0900)]
Fix 500 error when select `No assignee` filter in issue list page (#24854)

Access the issue list page and select `No assignee`, you will get 500
error:

![image](https://github.com/go-gitea/gitea/assets/18380374/a7435fd3-c3d5-4801-894e-9353a8ddc1af)

You can see this page in try.gitea.io:

https://try.gitea.io/yp05327/testrepo/issues?q=&type=all&sort=&state=open&labels=&milestone=0&project=0&assignee=-1&poster=0

Caused by
https://github.com/go-gitea/gitea/pull/24707/files#diff-d7c7dc2da4fcfdc09997648e11a018414dc116472054350b5590ab407adcd44dR1748

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAdd IsErrRepoFilesAlreadyExist check when fork repo (#24678)
yp05327 [Mon, 22 May 2023 10:21:46 +0000 (19:21 +0900)]
Add IsErrRepoFilesAlreadyExist check when fork repo (#24678)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/e9e3de75-eb6e-418e-9227-ef4e5f448a04)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/74b1cd6c-c5b1-4ee0-a1d8-6b3fb8d3a8e9)

16 months agoFix missing yes/no in delete time log modal (#24851)
yp05327 [Mon, 22 May 2023 09:46:50 +0000 (18:46 +0900)]
Fix missing yes/no in delete time log modal (#24851)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/bcbcddcc-b328-4751-92fe-6e55b7a84671)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/571ef27a-2411-472e-819d-f694e7be3697)

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix document and improve comment (#24844)
wxiaoguang [Mon, 22 May 2023 08:47:33 +0000 (16:47 +0800)]
Fix document and improve comment (#24844)

* Fix broken doc link:
https://github.com/go-gitea/gitea/actions/runs/5041309438/jobs/9040887385
* Improve comments about how font weight works:
https://github.com/go-gitea/gitea/pull/24827#pullrequestreview-1435584800

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoShow new pull request button also on subdirectories and files (#24842)
Brecht Van Lommel [Mon, 22 May 2023 07:57:00 +0000 (09:57 +0200)]
Show new pull request button also on subdirectories and files (#24842)

Instead of only on the repository home page. Saves a click and makes
this functionality a bit easier to find when editing files in a
subdirectory.

16 months agoImprovements for action detail page (#24718)
HesterG [Mon, 22 May 2023 04:17:24 +0000 (12:17 +0800)]
Improvements for action detail page (#24718)

Close #24625

Main changes:

1. For the left panel, show rerun icon only on hover, and add style when
the job is selected, and removed icon on the "rerun all" button and
modify the text on the button

https://github.com/go-gitea/gitea/assets/17645053/cc437a17-d2e9-4f1b-a8cf-f56e53962767

2. Adjust fonts, and add on hover effects to the log lines. And add
loading effect when the job is done and the job step log is expanded for
the first time. (With reference to github)

https://github.com/go-gitea/gitea/assets/17645053/2808d77d-f402-4fb0-8819-7aa0a018cf0c

3. Add `gt-ellipsis` to `step-summary-msg` and `job-brief-name`

<img width="898" alt="ellipsis"
src="https://github.com/go-gitea/gitea/assets/17645053/e2fb7049-3125-4252-970d-15b0751febc7">

4. Fixed
https://github.com/go-gitea/gitea/issues/24625#issuecomment-1541380010
by adding explicit conditions to `ActionRunStatus.vue` and `status.tmpl`

5. Adjust some css styles

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoAdd CRAN package registry (#22331)
KN4CK3R [Mon, 22 May 2023 02:57:49 +0000 (04:57 +0200)]
Add CRAN package registry (#22331)

This PR adds a [CRAN](https://cran.r-project.org/) package registry.

![grafik](https://user-images.githubusercontent.com/1666336/210450039-d6fa6f77-20cd-4741-89a8-1624def267f7.png)

16 months agoFix regression: access log template, gitea manager cli command (#24838)
wxiaoguang [Mon, 22 May 2023 01:38:38 +0000 (09:38 +0800)]
Fix regression: access log template, gitea manager cli command (#24838)

Close #24836

![image](https://github.com/go-gitea/gitea/assets/2114189/95b025d2-f25f-4246-a08a-fe44ecb787a9)

![image](https://github.com/go-gitea/gitea/assets/2114189/c3afe1fa-2a23-420d-a016-3b67dcd04cd5)

16 months agoMerge message template support for rebase without merge commit (#22669)
Brecht Van Lommel [Mon, 22 May 2023 01:01:46 +0000 (03:01 +0200)]
Merge message template support for rebase without merge commit (#22669)

Use `default_merge_message/REBASE_TEMPLATE.md` for amending the message
of the last commit in the list of commits that was merged. Previously
this template was mentioned in the documentation but not actually used.

In this template additional variables `CommitTitle` and `CommitBody` are
available, for the title and body of the commit.

Ideally the message of every commit would be updated using the template,
but doing an interactive rebase or merging commits one by one is
complicated, so that is left as a future improvement.

16 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 22 May 2023 00:25:26 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

16 months agoSupport wildcard in email domain allow/block list (#24831)
wxiaoguang [Mon, 22 May 2023 00:05:44 +0000 (08:05 +0800)]
Support wildcard in email domain allow/block list (#24831)

Replace #20257 (which is stale and incomplete)

Close #20255

Major changes:

* Deprecate the "WHITELIST", use "ALLOWLIST"
* Add wildcard support for EMAIL_DOMAIN_ALLOWLIST/EMAIL_DOMAIN_BLOCKLIST
* Update example config file and document
* Improve tests

16 months agoChange `--font-weight-bold` to `--font-weight-semibold` and 600 value, introduce...
silverwind [Sun, 21 May 2023 23:37:32 +0000 (01:37 +0200)]
Change `--font-weight-bold` to `--font-weight-semibold` and 600 value, introduce new font weight variables (#24827)

There was some recent discussion about this in Discord `ui-design`
channel and the conclusion was that
https://github.com/go-gitea/gitea/issues/24305 should have fixed their
OS font installation to have semibold weights.

I have now tested this 601 weight on a Windows 10 machine on Firefox
myself, and I immediately noticed that bold was excessivly bold and
rendering as 700 because browsers are biased towards bolder fonts. So
revert this back to the previous value.

16 months agoRewrite logger system (#24726)
wxiaoguang [Sun, 21 May 2023 22:35:11 +0000 (06:35 +0800)]
Rewrite logger system (#24726)

## ⚠️ Breaking

The `log.<mode>.<logger>` style config has been dropped. If you used it,
please check the new config manual & app.example.ini to make your
instance output logs as expected.

Although many legacy options still work, it's encouraged to upgrade to
the new options.

The SMTP logger is deleted because SMTP is not suitable to collect logs.

If you have manually configured Gitea log options, please confirm the
logger system works as expected after upgrading.

## Description

Close #12082 and maybe more log-related issues, resolve some related
FIXMEs in old code (which seems unfixable before)

Just like rewriting queue #24505 : make code maintainable, clear legacy
bugs, and add the ability to support more writers (eg: JSON, structured
log)

There is a new document (with examples): `logging-config.en-us.md`

This PR is safer than the queue rewriting, because it's just for
logging, it won't break other logic.

## The old problems

The logging system is quite old and difficult to maintain:
* Unclear concepts: Logger, NamedLogger, MultiChannelledLogger,
SubLogger, EventLogger, WriterLogger etc
* Some code is diffuclt to konw whether it is right:
`log.DelNamedLogger("console")` vs `log.DelNamedLogger(log.DEFAULT)` vs
`log.DelLogger("console")`
* The old system heavily depends on ini config system, it's difficult to
create new logger for different purpose, and it's very fragile.
* The "color" trick is difficult to use and read, many colors are
unnecessary, and in the future structured log could help
* It's difficult to add other log formats, eg: JSON format
* The log outputer doesn't have full control of its goroutine, it's
difficult to make outputer have advanced behaviors
* The logs could be lost in some cases: eg: no Fatal error when using
CLI.
* Config options are passed by JSON, which is quite fragile.
* INI package makes the KEY in `[log]` section visible in `[log.sub1]`
and `[log.sub1.subA]`, this behavior is quite fragile and would cause
more unclear problems, and there is no strong requirement to support
`log.<mode>.<logger>` syntax.

## The new design

See `logger.go` for documents.

## Screenshot

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/4462d713-ba39-41f5-bb08-de912e67e1ff)

![image](https://github.com/go-gitea/gitea/assets/2114189/b188035e-f691-428b-8b2d-ff7b2199b2f9)

![image](https://github.com/go-gitea/gitea/assets/2114189/132e9745-1c3b-4e00-9e0d-15eaea495dee)

</details>

## TODO

* [x] add some new tests
* [x] fix some tests
* [x] test some sub-commands (manually ....)

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoSupport Copy Link for video attachments (#24833)
Brecht Van Lommel [Sun, 21 May 2023 22:06:17 +0000 (00:06 +0200)]
Support Copy Link for video attachments (#24833)

Creating a `<video>` tag with controls and title.

16 months agoFix video width overflow in markdown, and other changes to match img (#24834)
Brecht Van Lommel [Sun, 21 May 2023 21:19:37 +0000 (23:19 +0200)]
Fix video width overflow in markdown, and other changes to match img (#24834)

This change makes the CSS for `<video>` in markup match that of `<img>`,
and also allows additional attributes to be used. This way the width,
padding, alignment should work equally well for both.

16 months agoImprove accessibility when (re-)viewing files (#24817)
delvh [Sun, 21 May 2023 20:47:41 +0000 (22:47 +0200)]
Improve accessibility when (re-)viewing files (#24817)

Visually, nothing should have changed.
Changes include
- Convert most `<a [no href]>` to `<button>` when (re-)viewing files:
- `<a [no href]>` are, by HTML definition, not a link and hence cannot
be focused
- `<a class="ui button">` can now be clicked (again?) using
<kbd>Enter</kbd>
- Previously, the installed keypress handler on `.ui.button` elements
disabled it for links somehow
- The `(un)escape file`, the `expand section` and the `expand/collapse
file` buttons can now be focused (and subsequently clicked using only
the keyboard)
- You can now press <kbd>Space</kbd> on a focused `View file` checkbox
to mark the file as viewed.
- previously, this was impossible as this checkbox listened on the wrong
event listener

The `add code comment` button has been left inaccessible for now as it
requires quite a bit of extra logic so that it is unhidden when it is
focused (you can otherwise focus it without seeing it as you are not
hovering on the corresponding line).

---------

Co-authored-by: silverwind <me@silverwind.io>
16 months agoRefactor rename user and rename organization (#24052)
Lunny Xiao [Sun, 21 May 2023 15:13:47 +0000 (23:13 +0800)]
Refactor rename user and rename organization (#24052)

This PR is a refactor at the beginning. And now it did 4 things.
- [x] Move renaming organizaiton and user logics into services layer and
merged as one function
- [x] Support rename a user capitalization only. For example, rename the
user from `Lunny` to `lunny`. We just need to change one table `user`
and others should not be touched.
- [x] Before this PR, some renaming were missed like `agit`
- [x] Fix bug the API reutrned from `http.StatusNoContent` to `http.StatusOK`

16 months agoUse `CommentList` instead of `[]*Comment` (#24828)
Lunny Xiao [Sun, 21 May 2023 12:48:28 +0000 (20:48 +0800)]
Use `CommentList` instead of `[]*Comment` (#24828)

As title.

16 months agoFix topics deleted via API not being deleted in org page (#24825)
Yarden Shoham [Sun, 21 May 2023 09:03:20 +0000 (12:03 +0300)]
Fix topics deleted via API not being deleted in org page (#24825)

The topics are saved in the `repo_topic` table.
They are also saved directly in the `repository` table.

Before this PR, only `AddTopic` and `SaveTopics` made sure the `topics`
field in the `repository` table was synced with the `repo_topic` table.

This PR makes sure `GenerateTopics` and `DeleteTopic`
also sync the `topics` in the repository table.

`RemoveTopicsFromRepo` doesn't need to sync the data
as it is only used to delete a repository.

Fixes #24820

16 months agoReturn `404` in the API if the requested webhooks were not found (#24823)
Yevhen Pavlov [Sun, 21 May 2023 02:54:28 +0000 (05:54 +0300)]
Return `404` in the API if the requested webhooks were not found (#24823)

Should resolve first point of the issue
https://github.com/go-gitea/gitea/issues/24574

16 months agoDecouple the different contexts from each other (#24786)
wxiaoguang [Sun, 21 May 2023 01:50:53 +0000 (09:50 +0800)]
Decouple the different contexts from each other (#24786)

Replace #16455

Close #21803

Mixing different Gitea contexts together causes some problems:

1. Unable to respond proper content when error occurs, eg: Web should
respond HTML while API should respond JSON
2. Unclear dependency, eg: it's unclear when Context is used in
APIContext, which fields should be initialized, which methods are
necessary.

To make things clear, this PR introduces a Base context, it only
provides basic Req/Resp/Data features.

This PR mainly moves code. There are still many legacy problems and
TODOs in code, leave unrelated changes to future PRs.

16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 21 May 2023 00:26:26 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

16 months agoAdd RTL rendering support to Markdown (#24816)
silverwind [Sat, 20 May 2023 21:02:52 +0000 (23:02 +0200)]
Add RTL rendering support to Markdown (#24816)

Support RTL content in Markdown:

![image](https://github.com/go-gitea/gitea/assets/115237/dedb1b0c-2f05-40dc-931a-0d9dc81f7c97)

Example document:
https://try.gitea.io/silverwind/symlink-test/src/branch/master/bidi-text.md
Same on GitHub:
https://github.com/silverwind/symlink-test/blob/master/bidi-text.md

`dir=auto` enables a browser heuristic that sets the text direction
automatically. It is the only way to get automatic text direction.

Ref: https://codeberg.org/Codeberg/Community/issues/1021

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
16 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 20 May 2023 00:22:02 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

16 months agoUpdate JS dependencies (#24815)
silverwind [Fri, 19 May 2023 21:58:12 +0000 (23:58 +0200)]
Update JS dependencies (#24815)

- Update all JS dependencies
- Remove `@vue/compiler-sfc` as per [this
notice](https://github.com/vuejs/core/tree/main/packages/compiler-sfc#vuecompiler-sfc),
still builds as normal
- Tested build and text/image copy

16 months agoFix duplicate tooltip hiding (#24814)
silverwind [Fri, 19 May 2023 20:12:30 +0000 (22:12 +0200)]
Fix duplicate tooltip hiding (#24814)

A tippy instance's role is actually on `props.role`. This makes
duplicate tooltip hiding work again after
https://github.com/go-gitea/gitea/pull/24688.

16 months agoMute repo names in dashboard repo list (#24811)
Yarden Shoham [Fri, 19 May 2023 17:03:09 +0000 (20:03 +0300)]
Mute repo names in dashboard repo list (#24811)

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/24b80212-4a4d-44a7-99d5-a8c6b207225e)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/565b242a-f65d-450c-b43b-c4539a0f8b28)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoRework label colors (#24790)
silverwind [Fri, 19 May 2023 16:30:24 +0000 (18:30 +0200)]
Rework label colors (#24790)

Introduce `--color-label-fg`, `--color-label-bg` and
`--color-label-hover-bg`, decoupling the label styles from other color
variables. I've set the colors so that non-interactive labels like on
tabs are dark-on-light on light theme, which imho looks better than
previous light-on-dark.

In the screenshot below, the leftmost label has hover, the second one
has active.

<img width="786" alt="Screenshot 2023-05-18 at 12 48 26"
src="https://github.com/go-gitea/gitea/assets/115237/d989bb68-504a-4406-b5f6-419ed9609f90">
<img width="789" alt="Screenshot 2023-05-18 at 13 04 07"
src="https://github.com/go-gitea/gitea/assets/115237/689a281a-a2b7-45e8-a5ee-dafb7a35e105">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoFix max width and margin of comment box on conversation page (#24809)
HesterG [Fri, 19 May 2023 16:02:34 +0000 (00:02 +0800)]
Fix max width and margin of comment box on conversation page (#24809)

Fix regression from #23937

The changes should only be limited to `.conversation-holder
.comment-code-cloud`, otherwise it will affect the `.comment-code-cloud`
in conversation tab

Before:

<img width="962" alt="Screen Shot 2023-05-19 at 18 22 25"
src="https://github.com/go-gitea/gitea/assets/17645053/0db01d04-2581-48f9-b46c-497836b1f12b">

After:

<img width="997" alt="Screen Shot 2023-05-19 at 18 35 01"
src="https://github.com/go-gitea/gitea/assets/17645053/5d14b67b-88c1-46c6-b859-fd41752b3ebb">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoAllow all URL schemes in Markdown links by default (#24805)
Yarden Shoham [Fri, 19 May 2023 15:17:07 +0000 (18:17 +0300)]
Allow all URL schemes in Markdown links by default (#24805)

- Closes #21146
- Closes #16721

## :warning: BREAKING :warning:
This changes the default behavior to now create links for any URL scheme
when the user uses the markdown form for links (`[label](URL)`), this
doesn't affect the rendering of inline links. To opt-out set the
`markdown.CUSTOM_URL_SCHEMES` setting to a list of allowed schemes, all
other schemes (except `http` and `https`) won't be allowed.

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/35fa18ce-7dda-4995-b5b3-3f360f38296d)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/0922216b-0b35-4b77-9919-21a5c21dd5d0)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
16 months agoSome refactors for issues stats (#24793)
Lunny Xiao [Fri, 19 May 2023 14:17:48 +0000 (22:17 +0800)]
Some refactors for issues stats (#24793)

This PR

- [x] Move some functions from `issues.go` to `issue_stats.go` and
`issue_label.go`
- [x] Remove duplicated issue options `UserIssueStatsOption` to keep
only one `IssuesOptions`

16 months agoImplement actions artifacts (#22738)
FuXiaoHei [Fri, 19 May 2023 13:37:57 +0000 (21:37 +0800)]
Implement actions artifacts (#22738)

Implement action artifacts server api.

This change is used for supporting
https://github.com/actions/upload-artifact and
https://github.com/actions/download-artifact in gitea actions. It can
run sample workflow from doc
https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts.
The api design is inspired by
https://github.com/nektos/act/blob/master/pkg/artifacts/server.go and
includes some changes from gitea internal structs and methods.

Actions artifacts contains two parts:

- Gitea server api and storage (this pr implement basic design without
some complex cases supports)
- Runner communicate with gitea server api (in comming)

Old pr https://github.com/go-gitea/gitea/pull/22345 is outdated after
actions merged. I create new pr from main branch.

![897f7694-3e0f-4f7c-bb4b-9936624ead45](https://user-images.githubusercontent.com/2142787/219382371-eb3cf810-e4e0-456b-a8ff-aecc2b1a1032.jpeg)

Add artifacts list in actions workflow page.

16 months agoFix Actions being enabled accidentally (#24802)
Jason Song [Fri, 19 May 2023 11:35:12 +0000 (19:35 +0800)]
Fix Actions being enabled accidentally (#24802)

Regression of #24536. If the user doesn't explicitly disable Actions, it
will be enabled.

1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`.

https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/setting.go#L234-L237
2. In `loadRepositoryFrom`,
`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set
`actions.ENABLED` with `true`.

https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/repository.go#L313-L315
3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section
with Actions enabled.

https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/actions.go#L23-L26

Although the cause of the problem was using `true` by copy-paste
mistake, it also surprised me that
**`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't
only read, but also write.**

16 months agoChange `add_on` in `keys_ssh.tmpl` (#24803)
Zettat123 [Fri, 19 May 2023 09:20:18 +0000 (17:20 +0800)]
Change `add_on` in `keys_ssh.tmpl` (#24803)

Follow #24562

17 months agoreplace `drone exec` to `act_runner exec` in test README.md (#24791)
a1012112796 [Thu, 18 May 2023 19:48:47 +0000 (03:48 +0800)]
replace `drone exec` to `act_runner exec` in test README.md (#24791)

17 months agoFix OAuth loading state (#24788)
silverwind [Thu, 18 May 2023 11:50:11 +0000 (13:50 +0200)]
Fix OAuth loading state (#24788)

Fix regression from https://github.com/go-gitea/gitea/pull/24740 where
the loading state was not showing because the `oauth-login-image` class
was removed. Replaced the Fomantic loader with a pure CSS loader and
cleaned up the HTML.

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

![](https://github.com/go-gitea/gitea/assets/115237/b5b4137f-9821-464b-9777-858fe85d9e03)

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoRemove duplicated issues options and some more refactors (#24787)
Lunny Xiao [Thu, 18 May 2023 10:45:25 +0000 (18:45 +0800)]
Remove duplicated issues options and some more refactors (#24787)

This PR

- [x] Move some code from `issue.go` to `issue_search.go` and
`issue_update.go`
- [x] Use `IssuesOptions` instead of `IssueStatsOptions` becuase they
are too similiar.
- [x] Rename some functions

17 months agoRevert "Mark `models/fixtures` as generated (#24775)" (#24782)
wxiaoguang [Thu, 18 May 2023 08:12:39 +0000 (16:12 +0800)]
Revert "Mark `models/fixtures` as generated (#24775)" (#24782)

They are not generated in some cases (although they can).

And we should keep an eye on these files when reviewing.

When reviewing, files can be marked as "Viewed" and then it is
collapsed.

17 months agoRemove background on user dashboard filter bar (#24779)
silverwind [Thu, 18 May 2023 07:27:29 +0000 (09:27 +0200)]
Remove background on user dashboard filter bar (#24779)

Was only an issue on arc-green:

### Before
<img width="313" alt="Screenshot 2023-05-17 at 23 33 15"
src="https://github.com/go-gitea/gitea/assets/115237/0f6916c6-c6c3-43c8-84cc-24b0a9800a43">

### After
<img width="310" alt="Screenshot 2023-05-17 at 23 32 52"
src="https://github.com/go-gitea/gitea/assets/115237/207d3d7f-ce6f-4170-b426-e743be760185">

Co-authored-by: Giteabot <teabot@gitea.io>
17 months agoEnable two vue eslint rules (#24780)
silverwind [Thu, 18 May 2023 02:00:34 +0000 (04:00 +0200)]
Enable two vue eslint rules (#24780)

These two rules are no longer violated, so we can enable them again.

17 months agoAdd two eslint plugins (#24776)
silverwind [Thu, 18 May 2023 01:14:31 +0000 (03:14 +0200)]
Add two eslint plugins (#24776)

Add these two plugins and autofix issues:

-
[eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native)
-
[eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func)

17 months agoMark `models/fixtures` as generated (#24775)
silverwind [Wed, 17 May 2023 20:59:12 +0000 (22:59 +0200)]
Mark `models/fixtures` as generated (#24775)

Makes diffs like https://github.com/go-gitea/gitea/pull/24676/files more
readable. I'm not sure if those are actually generated, but they are
good to collapse in diffs anyways.

17 months agoFix TestMinioStorageIterator skip message (#24765)
silverwind [Wed, 17 May 2023 16:22:17 +0000 (18:22 +0200)]
Fix TestMinioStorageIterator skip message (#24765)

Followup to https://github.com/go-gitea/gitea/pull/24762, fix this
message.