Commit Graph

13976 Commits

Author SHA1 Message Date
Jason Song 5f127a729e
Fix typo of issue template name (#21117)
Should be

- .gitea/issue_template.md
- .gitea/issue_template.yaml
- .gitea/issue_template.~~md~~yml

Related to #20987, #21030.
2022-09-09 11:22:33 +08:00
Tyrone Yeh 619eed913c [skip ci] Updated translations via Crowdin 2022-09-09 00:20:54 +00:00
Tyrone Yeh ebafb4b575
Fix pagination limit parameter problem (#21109)
In commits list can use limit parameter to change, but pagination number
is wrong
2022-09-08 11:56:14 -04:00
silverwind 52c2ef7902
Rewrite go license generator in go (#21078)
This removes the JS dependency in the checks pipeline. JSON output is
different because the previous JS did indent the license data
differently and a JSON key was changed, but the end result is the same
as it gets re-indented by wepack.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2022-09-07 17:35:54 -04:00
KN4CK3R 8b8bdb30fb
Allow uppercase ASCII alphabet in PyPI package names (#21095)
The PyPI name regexp is too restrictive and only permits lowercase characters. This PR adjusts the regexp to add in support for uppercase characters.

Fix #21014
2022-09-07 21:18:51 +01:00
luzpaz cb3b3e519f
Fix various typos (#21103)
Found via `codespell -q 3 -S
./options/locale,./options/license,./public/vendor,./web_src/fomantic -L
actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon`

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-09-07 14:40:36 -04:00
ya 5c70e6aff0
Update docs issue-pull-request-templates.zh-cn.md (#21030)
Follow #20987, update docs issue-pull-request-templates.zh-cn.md

<!--

Please check the following:

1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)

-->

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-09-07 14:40:08 -04:00
wxiaoguang aa5de4dcad
Upgrade the document about how to collect logs for systemd and docker (#21101)
Many users (#21099) do not know how to collect logs if they are using
systemd. This PR makes the document more clear.
2022-09-07 23:58:55 +08:00
Kyle D 7006d8297d [skip ci] Updated translations via Crowdin 2022-09-07 00:20:58 +00:00
Kyle D 6361b48b21
Bump playwright test image to match version in package.json (#21097)
Bump the playwright test image to match version in package.json (so it
doesn't re-download browsers setup)
2022-09-07 00:00:34 +01:00
Tyrone Yeh f1ea6c92d1
Fix sub folder in repository missing add file dropdown (#21069)
In repository sub folder missing add file dropdown menu, Probably broken since #20602
2022-09-06 08:01:58 +01:00
silverwind 795bd946e2 [skip ci] Updated translations via Crowdin 2022-09-06 00:20:50 +00:00
silverwind 7f6306ccd1
Add missing volume to test-e2e (#21079)
Without it, the deps-backend step before is useless as `go test` will not see the files in GOPATH and re-download them.
2022-09-05 17:35:46 -04:00
Lunny Xiao bc4cce138a
Fix delete user missed some comments (#21067)
There is a mistake in the batched delete comments part of DeleteUser which causes some comments to not be deleted

The code incorrectly updates the `start` of the limit clause resulting in most comments not being deleted.

```go
			if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, start).Find(&comments); err != nil {
```

should be:

```go
			if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, 0).Find(&comments); err != nil {
```

Co-authored-by: zeripath <art27@cantab.net>
2022-09-05 19:41:16 +03:00
John Olheiser b42aaf29ea
Remove insecure flag from curl (#21074)
Followup to #21071 
Thanks for the catch @wxiaoguang 

[WRT](https://github.com/go-gitea/gitea/pull/21071#discussion_r962706673)

Ref #21071
2022-09-05 14:22:44 +01:00
John Olheiser 0ad0190f69
Update curl usage in API docs (#21071) 2022-09-05 03:22:03 -04:00
zeripath 8080e23c9b
Move go-licenses to generate and separate generate into a frontend and backend component (#21061)
The `go-licenses` make task introduced in #21034 is being run on make vendor
and occasionally causes an empty go-licenses file if the vendors need to
change. This should be moved to the generate task as it is a generated file.

Now because of this change we also need to split generation into two separate 
steps:

1. `generate-backend`
2. `generate-frontend`

In the future it would probably be useful to make `generate-swagger` part of `generate-frontend` but it's not tolerated with our .drone.yml

Ref #21034

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2022-09-05 14:04:18 +08:00
Aaron F 0232601734 [skip ci] Updated translations via Crowdin 2022-09-05 00:20:46 +00:00
Aaron F 3963625b6e
Webhook for Wiki changes (#20219)
Add support for triggering webhook notifications on wiki changes.

This PR contains frontend and backend for webhook notifications on wiki actions (create a new page, rename a page, edit a page and delete a page). The frontend got a new checkbox under the Custom Event -> Repository Events section. There is only one checkbox for create/edit/rename/delete actions, because it makes no sense to separate it and others like releases or packages follow the same schema.

![image](https://user-images.githubusercontent.com/121972/177018803-26851196-831f-4fde-9a4c-9e639b0e0d6b.png)

The actions itself are separated, so that different notifications will be executed (with the "action" field). All the webhook receivers implement the new interface method (Wiki) and the corresponding tests.

When implementing this, I encounter a little bug on editing a wiki page. Creating and editing a wiki page is technically the same action and will be handled by the ```updateWikiPage``` function. But the function need to know if it is a new wiki page or just a change. This distinction is done by the ```action``` parameter, but this will not be sent by the frontend (on form submit). This PR will fix this by adding the ```action``` parameter with the values ```_new``` or ```_edit```, which will be used by the ```updateWikiPage``` function.

I've done integration tests with matrix and gitea (http).

![image](https://user-images.githubusercontent.com/121972/177018795-eb5cdc01-9ba3-483e-a6b7-ed0e313a71fb.png)

Fix #16457

Signed-off-by: Aaron Fischer <mail@aaron-fischer.net>
2022-09-04 20:54:23 +01:00
Eng Zer Jun 8b0aaa5f86
test: use `T.TempDir` to create temporary test directory (#21043)
A testing cleanup. 

This pull request replaces `os.MkdirTemp` with `t.TempDir`. We can use the `T.TempDir` function from the `testing` package to create temporary directory. The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. 

This saves us at least 2 lines (error check, and cleanup) on every instance, or in some cases adds cleanup that we forgot.

Reference: https://pkg.go.dev/testing#T.TempDir

```go
func TestFoo(t *testing.T) {
	// before
	tmpDir, err := os.MkdirTemp("", "")
	require.NoError(t, err)
	defer os.RemoveAll(tmpDir)

	// now
	tmpDir := t.TempDir()
}
```

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-04 16:14:53 +01:00
zeripath c722a26e7e
Set uploadpack.allowFilter etc on gitea serv to enable partial clones with ssh (#20902)
When setting.Git.DisablePartialClone is set to false then the web server will add filter support to web http. It does this by using`-c` command arguments but this will not work on gitea serv as the upload-pack and receive-pack commands do not support this.
    
Instead we move these options into the .gitconfig instead.

Fix #20400

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-09-04 16:13:23 +01:00
qwerty287 be14e79e98
Fix 500 on time tracking in timeline API (#21052)
Fix #21041
2022-09-04 15:01:23 +01:00
zeripath e6b3be4608
Add more checks in migration code (#21011)
When migrating add several more important sanity checks:

* SHAs must be SHAs
* Refs must be valid Refs
* URLs must be reasonable

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
2022-09-04 13:47:56 +03:00
Jason Song 93a610a819
Fill the specified ref in webhook test payload (#20961)
The webhook payload should use the right ref when it‘s specified in the testing request.

The compare URL should not be empty, a URL like `compare/A...A` seems useless in most cases but is helpful when testing.
2022-09-04 12:18:07 +03:00
silverwind 0887459ac6 [skip ci] Updated licenses and gitignores 2022-09-04 00:20:43 +00:00
silverwind 49efd1fb96
Add go licenses to licenses.txt (#21034)
`make go-licenses` will generate `assets/go-licenses.json` which is then included in the webpack build. 

This step depends on both go and node being present, so unfortunately, I could not automate the generation by hooking it up to `tidy` as that target is triggered on CI where we do not have a docker image with both go an node.

It should be ran from time to time, ideally after each go mod update.
2022-09-04 00:20:46 +02:00
Cypherpunk Samurai 82c6f7bf4a
Added docs for agit-setup (#21027)
This PR Adds Documentation for the new Agit feature. Agit allows creating PR directly while pushing code.

Close #21018

Co-authored-by: CypherpunkSamurai <CypherpunkSamurai@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: a1012112796 <1012112796@qq.com>
2022-09-03 19:52:19 +02:00
zeripath 58a80ba69c
Add another index for Action table on postgres (#21033)
In #21031 we have discovered that on very big tables postgres will use a
search involving the sort term in preference to the restrictive index.

Therefore we add another index for postgres and update the original migration.

Fix #21031

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-09-03 17:27:59 +01:00
KN4CK3R 5bc73ca666
Delete unreferenced packages when deleting a package version (#20977)
Delete a package if its last version got deleted. Otherwise removing the owner works only after the clean up job ran.

Fix #20969
2022-09-03 17:01:00 +01:00
silverwind 1670109b91
Improve arc-green code theme (#21039)
- Increase contrasts overall
- Add various missing theme classes
- Ensure strings and constants are colored the same across languages

Before:
<img width="575" alt="Screen Shot 2022-09-03 at 15 20 19" src="https://user-images.githubusercontent.com/115237/188272267-c3af3de0-a1d9-4a80-a3ab-278e9b04cb44.png">
<img width="705" alt="Screen Shot 2022-09-03 at 15 10 12" src="https://user-images.githubusercontent.com/115237/188272194-dc40ac7d-1629-44a0-a881-5f0922285195.png">

After:
<img width="579" alt="Screen Shot 2022-09-03 at 15 19 31" src="https://user-images.githubusercontent.com/115237/188272275-55b87bc7-1122-410f-9250-14cf9e973124.png">
<img width="703" alt="image" src="https://user-images.githubusercontent.com/115237/188272715-a5fcd180-c5dc-4303-8e77-de785d5e0937.png">
2022-09-03 23:24:18 +08:00
Tyrone Yeh e7b5bf0d96
Add down key check has tribute container (#21016)
Fixes an issue where users would not be able to select by pressing the down arrow when using @TAG above a message

Bug videos:

https://user-images.githubusercontent.com/1255041/188095999-c4ccde18-e53b-4251-8a14-d90c4042d768.mp4
2022-09-03 10:43:27 +01:00
zeripath de7b87fbc2
Do not add links to Posters or Assignees with ID < 0 (#20577)
There are several places in templates/repo/issue/view_content/comments.tmpl where links are made to Posters or Assignees who are Ghosts or have IDs <0.

Fix #20559

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-09-03 10:33:34 +01:00
JakobDev 18046eb91e [skip ci] Updated translations via Crowdin 2022-09-03 00:21:09 +00:00
JakobDev 96a9e15dff
Show language name on hover (#20923)
Each repo has a bar which shows the used programming languages. If you want to know, what language is behind a color, you need to click the bar. With this PR, you just need to hover over the color the view the name.
2022-09-02 23:06:54 +01:00
José Carlos b8818a1c68
fix: PackageMetadataVersion deps (#21017)
Set DevDependencies, PeerDependencies & OptionalDependencies in npm package metadatas

Fix  #21013
2022-09-02 23:00:18 +01:00
wxiaoguang 2dbed4bd97
Fix the quick-submit for pending review comment (#20992)
If there is only one "Add comment" button (when there are pending review comments), the quick-submit should submit the form with is_review=true even if the "Add comment" button is not really clicked.

Close  #20990
2022-09-02 22:59:10 +01:00
Kyle D c8ded77680
Kd/ci playwright go test (#20123)
* Add initial playwright config

* Simplify Makefile

* Simplify Makefile

* Use correct config files

* Update playwright settings

* Fix package-lock file

* Don't use test logger for e2e tests

* fix frontend lint

* Allow passing TEST_LOGGER variable

* Init postgres database

* use standard gitea env variables

* Update playwright

* update drone

* Move empty env var to commands

* Cleanup

* Move integrations to subfolder

* tests integrations to tests integraton

* Run e2e tests with go test

* Fix linting

* install CI deps

* Add files to ESlint

* Fix drone typo

* Don't log to console in CI

* Use go test http server

* Add build step before tests

* Move shared init function to common package

* fix drone

* Clean up tests

* Fix linting

* Better mocking for page + version string

* Cleanup test generation

* Remove dependency on gitea binary

* Fix linting

* add initial support for running specific tests

* Add ACCEPT_VISUAL variable

* don't require git-lfs

* Add initial documentation

* Review feedback

* Add logged in session test

* Attempt fixing drone race

* Cleanup and bump version

* Bump deps

* Review feedback

* simplify installation

* Fix ci

* Update install docs
2022-09-02 15:18:23 -04:00
Jason Song 5710ff343c
chore: add myself to maintainers (#21028) 2022-09-02 20:23:48 +08:00
Jason Song 84447df4d3
Support Issue forms and PR forms (#20987)
* feat: extend issue template for yaml

* feat: support yaml template

* feat: render form to markdown

* feat: support yaml template for pr

* chore: rename to Fields

* feat: template unmarshal

* feat: split template

* feat: render to markdown

* feat: use full name as template file name

* chore: remove useless file

* feat: use dropdown of fomantic ui

* feat: update input style

* docs: more comments

* fix: render text without render

* chore: fix lint error

* fix: support use description as about in markdown

* fix: add field class in form

* chore: generate swagger

* feat: validate template

* feat: support is_nummber and regex

* test: fix broken unit tests

* fix: ignore empty body of md template

* fix: make multiple easymde editors work in one page

* feat: better UI

* fix: js error in pr form

* chore: generate swagger

* feat: support regex validation

* chore: generate swagger

* fix: refresh each markdown editor

* chore: give up required validation

* fix: correct issue template candidates

* fix: correct checkboxes style

* chore: ignore .hugo_build.lock in docs

* docs: separate out a new doc for merge templates

* docs: introduce syntax of yaml template

* feat: show a alert for invalid templates

* test: add case for a valid template

* fix: correct attributes of required checkbox

* fix: add class not-under-easymde for dropzone

* fix: use more back-quotes

* chore: remove translation in zh-CN

* fix EasyMDE statusbar margin

* fix: remove repeated blocks

* fix: reuse regex for quotes

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-09-02 15:58:49 +08:00
silverwind b7a4b45ff8
Include go.mod in gomod-check and rename to tidy-check (#21025)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-09-02 09:58:09 +08:00
zeripath 6b7bb419ed [skip ci] Updated translations via Crowdin 2022-09-02 00:20:55 +00:00
zeripath 38a4961f9e
Update a few go dependencies (#21022)
There are a lot of go dependencies that appear old and we should update them.

The following packages have been updated:

* codeberg.org/gusted/mcaptcha
* github.com/markbates/goth
* github.com/buildkite/terminal-to-html
* github.com/caddyserver/certmagic
* github.com/denisenkom/go-mssqldb
* github.com/duo-labs/webauthn
* github.com/editorconfig/editorconfig-core-go/v2
* github.com/felixge/fgprof
* github.com/gliderlabs/ssh
* github.com/go-ap/activitypub
* github.com/go-git/go-git/v5
* github.com/go-ldap/ldap/v3
* github.com/go-swagger/go-swagger
* github.com/go-testfixtures/testfixtures/v3
* github.com/golang-jwt/jwt/v4
* github.com/klauspost/compress
* github.com/lib/pq
* gitea.com/lunny/dingtalk_webhook - instead of github.com
* github.com/mattn/go-sqlite3
* github/matn/go-isatty
* github.com/minio/minio-go/v7
* github.com/niklasfasching/go-org
* github.com/prometheus/client_golang
* github.com/stretchr/testify
* github.com/unrolled/render
* github.com/xanzy/go-gitlab
* gopkg.in/ini.v1

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-09-01 23:13:17 +02:00
Lunny Xiao d74390ee39 [skip ci] Updated translations via Crowdin 2022-09-01 00:20:54 +00:00
Lunny Xiao de5b8cfad8
Fix missed sort bug (#20996)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-08-31 14:15:12 -04:00
ya 230176db5e
Fix typo (#21004)
Missing directory

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-08-31 12:47:34 -04:00
silverwind 647b2649b1
Make sure fmt catches all templates (#20979)
* Make sure fmt catches all templates

Make's `wildcard` is not recursive so it missed many template files, fix
that by using `find`.

* Update Makefile
2022-08-31 23:58:54 +08:00
silverwind c80ca94ab1
Remove black labels and CSS cleanup (#21003)
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-08-31 17:04:41 +08:00
John Olheiser a48d6ba4b4
Go 1.19 format (#20758)
* 1.19 gofumpt

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Change CSV test

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Commit whitespace fixes from @zeripath

Co-authored-by: zeripath <art27@cantab.net>

* Update emoji

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* bump swagger & fix generate-swagger

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-08-30 21:15:45 -05:00
JonRB 3edc14b687 [skip ci] Updated translations via Crowdin 2022-08-31 00:21:00 +00:00
JonRB e4addac26e
Fix typo (#20993) 2022-08-29 17:20:20 +02:00