Commit graph

12236 commits

Author SHA1 Message Date
Lunny Xiao e21a35698c
Upgrade xorm to v1.2.4 (#17059) (#17068)
Co-authored-by: zeripath <art27@cantab.net>
2021-09-16 13:53:28 -04:00
zeripath 8de44d1995
Clean-up HookPreReceive and restore functionality for pushing non-standard refs (#16705)
* Clean-up HookPreReceive and restore functionality for pushing non-standard refs

There was an inadvertent breaking change in #15629 meaning that notes refs and other
git extension refs will be automatically rejected.

Further following #14295 and #15629 the pre-recieve hook code is untenably long and
too complex.

This PR refactors the hook code and removes the incorrect forced rejection of
non-standard refs.

Fix #16688

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-16 15:34:54 +02:00
Gabriel a959ed99c2
Issue template form (#16349)
* Create issue template using new format

This issue template has been based off of the current issue creation workflow defined in the ISSUE_TEMPLATE.md file
This commit allows for that issue template (which is a legacy method of creating an issue) to be deleted

* Delete old issue template file

This commit deletes the old issue template file, as it is both legacy and replaced by ISSUE_TEMPLATE/issue.yaml

* Adjust file upload and remove code of conduct checkbox

* Block blank issue creation

* Update feedback

Removed most requirements
Updated prompt to include instruction to state whether using try.gitea.io
Added default value to Gitea version

* Create Feature Request issue form

* Update and rename issue.yaml to bug-report.yaml

* Enable blank issue creation

Co-authored-by: a1012112796 <1012112796@qq.com>

* Update config.yaml

* Remove default & placeholder from Gitea version

* Create issue template in .gitea directory

* Add relevant bug report message to feature request

* Adjust name to remove banner

There is a banner that tells you to create a config.yml when you already have a config.yaml
Renaming the file stops this from occurring.

* Add UI bug report form

* Remove unnecessary question

Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2021-09-15 20:33:13 +03:00
Lunny Xiao 45ebcb0d1c
Fix bug of migrate comments which only fetch one page (#17055)
* Fix bug of migrate comments which only fetch one page

* add next page to trace

Co-authored-by: zeripath <art27@cantab.net>
2021-09-15 19:30:19 +08:00
zeripath db6b7db06d
Improve LDAP synchronization efficiency (#16994)
The current LDAP sync routine has order n^2 efficiency. This change reduces this
to order n.log n.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-15 10:28:37 +01:00
zeripath 976db2a8b7
Do not show issue context popup on external issues (#17050)
The issues pop-up context cannot work for external issues - therefore do not show
these.

Fix #17047

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-15 09:45:27 +01:00
qwerty287 fc97e0626e
Update template (#17043)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-15 00:58:44 -04:00
GiteaBot 5a42e72c04 [skip ci] Updated translations via Crowdin 2021-09-15 00:05:33 +00:00
Lunny Xiao e2f0ab3343
Add doctor dbconsistency check for release and attachment (#16978) 2021-09-14 20:41:40 +01:00
KN4CK3R 87505a9464
Add AbsoluteListOptions (#17028)
This PR adds a `ListOptions` type which is not paged but uses absolute values. It is implemented as discussed in Discord.
Extracted from #16510 to clean that PR.
2021-09-14 18:48:27 +01:00
zeripath 0a542dd59f
Decrement Fork Num when converting from Fork (#17035)
When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix #17026

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-14 18:07:08 +01:00
zeripath 26ef180f46
Correctly rollback in ForkRepository (#17034)
The rollback functionality in
services/repository/repository.go:ForkRepository is incorrect and could
lead to a deadlock as it uses DeleteRepository to delete the rolled-back
repository - a function which creates its own transaction.

This PR adjusts the rollback function to only use RemoveAll as any
database changes will be automatically rolled-back. It also handles
panics and adjusts the Close within WithTx to ensure that if there is a
panic the session will always be closed.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-14 18:16:40 +02:00
zeripath 04b233e940
Always emit the configuration path (#17036)
Often when handling problems it is not clear which configuration file Gitea is
using. This PR simply ensures that the configuration file is emitted.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-13 21:24:57 -04:00
zeripath 8af7a21085
Update go-chi/session (fixes "race" in tests) (#17031)
Update to latest go-chi/session where the NewManager causes a new
Provider instantiation instead of reconfiguring an old one.
(https://gitea.com/go-chi/session/pulls/1)

The NewManager call is now concurrency safe and would allow live
reconfiguration in future but for now this PR simply fixes an
intermittent "data-race" detected in our tests.  (See
https://drone.gitea.io/go-gitea/gitea/43900/2/14)

Related #17027
Related #1441

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-13 09:40:55 +01:00
GiteaBot 132c8c43e1 [skip ci] Updated translations via Crowdin 2021-09-13 00:05:10 +00:00
Alexey 〒erentyev 7c84c94232
fixed create repo page layout (#17012)
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2021-09-12 20:24:57 +02:00
zeripath a334a95a3c
Use common sessioner for API and Web (#17027)
* Use common sessioner for API and Web

Instead of creating separate sessioner and doubly initialising the provider just
use the same sessioner for the API and Web routes.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-12 19:35:38 +02:00
Jimmy Praet aac7f68af1
Fix reset password email template (#17025)
Removed unused variable passed to mail.link_not_working_do_paste

Co-authored-by: 6543 <6543@obermui.de>
2021-09-12 21:02:07 +08:00
Tchoupinax 77b95fd766
Fix overflow label in mobile view (#17020) 2021-09-12 13:40:20 +02:00
GiteaBot 20a2e26e99 [skip ci] Updated translations via Crowdin 2021-09-12 00:05:05 +00:00
Jimmy Praet 3d6cb25e31
Support unprotected file patterns (#16395)
Fixes #16381

Note that changes to unprotected files via the web editor still cannot be pushed directly to the protected branch. I could easily add such support for edits and deletes if needed. But for adding, uploading or renaming unprotected files, it is not trivial.

* Extract & Move GetAffectedFiles to modules/git
2021-09-11 16:21:17 +02:00
GiteaBot eb03e819d3 [skip ci] Updated translations via Crowdin 2021-09-11 00:05:02 +00:00
zeripath f394019e9d
Report the associated filter if there is an error in LDAP (#17014)
If there is an error when performing the admin or restricted filter search
ensure that the filter and the userDN are reported.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-11 00:46:27 +02:00
6543 77f604a928
Add skip and limit to git.GetTags (#16897)
* Make GetTags() api similar to GetBranches()
* Use it for Tag/Release page
2021-09-10 19:30:37 +02:00
zeripath 9ca0e7905c
Add setting to OAuth handlers to skip local 2FA authentication (#16594)
This PR adds a setting to OAuth and OpenID login sources to allow the source to
skip local 2FA authentication.

Fix #13939

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-10 18:37:57 +02:00
6543 51578d6418
Calculate label URL on API (#16186)
close #8028
2021-09-10 18:03:16 +02:00
Romain 9a938dc298
Add "new issue" button on project (#17001)
* Add "new issue" button on project
2021-09-10 13:33:06 +02:00
zeripath 0faf175694
Fix missing close in WalkGitLog (#17008)
When the external context is cancelled it is possible for the
GitLogReader to not itself be Closed.

This PR does three things:

1. Instead of adding a plain defer it wraps the `g.Close` in a func as
`g` may change.
2. It adds the missing explicit g.Close - although the defer fix makes
this unnecessary.
3. It passes down the external context as the base context for the
GitLogReader meaning that the cancellation of the external context will
pass down automatically.

Fix #17007

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-10 17:46:12 +08:00
zeripath 248b96d8a3
Use git attributes to determine generated and vendored status for language stats and diffs (#16773)
Replaces #16262
Replaces #16250
Replaces #14833

This PR first implements a `git check-attr` pipe reader - using `git check-attr --stdin -z --cached` - taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader.

It then wires this in to the language stats helper and into the git diff generation.

Files which are marked generated will be folded by default.

Fixes #14786
Fixes #12653
2021-09-09 21:13:36 +01:00
wxiaoguang b83b4fbef9
doc: Upgrade from an old Gitea (#16918)
* doc: Upgrade from an old Gitea

* update backup steps

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>

* update backup tips

* update table header

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: silverwind <me@silverwind.io>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: silverwind <me@silverwind.io>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: techknowlogick <matti@mdranta.net>

* Update docs/content/doc/upgrade/from-gitea.en-us.md

Co-authored-by: techknowlogick <matti@mdranta.net>

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

* Update from-gitea.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2021-09-09 14:13:21 -04:00
KN4CK3R cd78c30fd3
Use filename as id/class prefix. (#16997)
Currently the svg minifier (`make svg`) rewrites all `id` and `class` attributes in svg files. Every file gets the ids `a, b, ...`. If multiple svgs with ids are used on a page these ids are conflicting and the results are broken images.

| minified ids | unique ids |
| - | - |
| ![grafik](https://user-images.githubusercontent.com/1666336/132579375-59d3996f-c4e5-43b8-8c8d-82280c90d9e3.png) | ![grafik](https://user-images.githubusercontent.com/1666336/132579413-05bf9285-4e3b-4d0d-8f95-90b212405b05.png) |

This PR adds a prefix (the filename) to every id/class.

Follow up problem: Because we embed svg images there are duplicated ids if one svg image is used multiple times on a page. As those ids refer to the same content it may be no real problem because browser handle that fine.
2021-09-09 08:06:54 +01:00
6543 e14b52ea36
Enable Malayalam, Greek, Persian, Hungarian & Indonesian by default (#16998) 2021-09-09 14:16:42 +08:00
GiteaBot df2c7901e6 [skip ci] Updated translations via Crowdin 2021-09-09 00:04:58 +00:00
a1012112796 358555f72c
Return correct error response for agit force-push (#16989)
fix a samll nit for agit `force-push` error response

Signed-off-by: a1012112796 <1012112796@qq.com>
2021-09-08 22:20:55 +02:00
Lunny Xiao efdbba4453
Fix bug of migrated repository not index (#16991)
Fix #16986, #16152
2021-09-08 18:43:19 +01:00
Hakermann420 1b922374db
Changes for German language (#16985)
* translated the rest of index.de-de.md to german

* fixed typo in german locale activate_account email

* fixed typo in german doc/content/page/index.md

* Update docs/content/page/index.de-de.md

Co-authored-by: delvh <dev.lh@web.de>

* commited sugesstions

Co-authored-by: delvh <dev.lh@web.de>

* commited sugesstions

Co-authored-by: delvh <dev.lh@web.de>

* commited sugesstions

Co-authored-by: delvh <dev.lh@web.de>

* revert locale change

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2021-09-08 12:37:06 -04:00
6543 8e18b412c3
Skip AllowedUserVisibilityModes validation on update user if it is an organisation (#16988)
if AllowedUserVisibilityModes allow only public & limited, and orgs can be private, a user can create a repo to that organisation whitch will result in an update of the user. On this call the user is validaten and will be rejected since private is not allowed, but its not an user its an valid org ...

Co-authored-by: Alexey 〒erentyev <axifnx@gmail.com>
2021-09-08 17:47:49 +02:00
Lunny Xiao ddc709ff7f
Add repo_id for attachment (#16958)
When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted.

This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted.

Co-authored-by: 6543 <6543@obermui.de>
2021-09-08 17:19:30 +02:00
6543 f55cd033ed
Make TestOneDevDownloadRepo work again & more resistant (#16987)
* Update TestOneDevDownloadRepo since OneDev api changed

* Use test functions for migrations
2021-09-08 16:17:22 +02:00
silverwind bc81d12e68
Disable Fomantic's CSS tooltips (#16974)
CSS-only tooltips suffer various issues with positioning and there was
only one single instance of them in the templates. Replace that instance
with a regular popup and exclude these `data-tooltip` styles from the
Fomantic build.
2021-09-08 07:23:46 +01:00
6543 63d7cbcef1
Make mirror feature more configurable (#16957)
Rename`[repository]` `DISABLE_MIRRORS` to `[mirror]` `DISABLE_NEW_PULL`  and add `ENABLED` and `DISABLE_NEW_PUSH` with the below meanings:

- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors.
- `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid.
- `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid.


Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2021-09-07 17:49:36 +02:00
GiteaBot ded438fb1a [skip ci] Updated translations via Crowdin 2021-09-07 00:04:55 +00:00
silverwind 9fa6bdb64e
Add Cache-Control to avatar redirects (#16973)
* Add Cache-Control to avatar redirects

This does seem to do the trick to make the Avatar redirects cachable
in Chrome.

In Firefox, it does not seem to work, thought and I found no way to
suppress the requests to the original URLs, I even tried setting an
Etag to no avail.

Related discussion in https://github.com/go-gitea/gitea/issues/16964.

Co-authored-by: zeripath <art27@cantab.net>
2021-09-06 23:05:44 +02:00
6543 cf6d398485
Resolve TODO: Enable pagination on GiteaDownloader.GetComments() & update another TODO (#16963)
* Update TODO in migrations

* Resolve TODO: enable pagination on GiteaDownloader.GetComments()
2021-09-06 18:00:50 +02:00
Lunny Xiao a807031a30
Fix storage Iterate bug and Add storage doctor to delete garbage attachments (#16971)
* Fix storage Iterate bug and Add storage doctor to delete garbage attachments

* Close object when used
2021-09-06 16:46:20 +02:00
a1012112796 82da380af7
Add missing icon set for ActionRenameRepo (#16972)
Signed-off-by: a1012112796 <1012112796@qq.com>
2021-09-06 16:11:17 +02:00
zeripath 0767fe0d80
Prevent panic on diff generation (#16950)
The lastLeftIdx should be reset at the same time as creating a new section otherwise
it is possible for a second addition to end up attempting to read a nil entry.

Fix #16943

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-05 12:16:49 +02:00
zeripath eb0330a3fe
Ensure that rebase conflicts are handled in updates (#16952)
PR #16125 did not update the error handlers to handle conflict errors relating
to rebases. This PR adds them.

Fix #16922

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-05 10:30:40 +01:00
Prasad Katti 4c7a70b348
Fix issue with issue default mail template (#16956)
The mail template rendering was failing with the error -
`...vices/mailer/mail.go:301:composeIssueCommentMessages() [E] ExecuteTemplate [issue/default/body]: template: issue/default:65:10: executing "issue/default" at <.i18n.Tr>: can't evaluate field i18n in type *models.Comment`

The issue was the template variable i18n is available in the outer scope.

Fix #16877
2021-09-05 09:06:20 +01:00
GiteaBot 5a73153493 [skip ci] Updated translations via Crowdin 2021-09-04 00:04:54 +00:00