]> source.dussan.org Git - gitea.git/log
gitea.git
3 years agoKanban colored boards (#16647)
Romain [Wed, 29 Sep 2021 20:53:12 +0000 (22:53 +0200)]
Kanban colored boards (#16647)

Add a column Color in ProjectBoard and color picker in new / edit project board form.

3 years agoupgrade xorm to v1.2.5 (#17177)
Lunny Xiao [Wed, 29 Sep 2021 20:08:44 +0000 (04:08 +0800)]
upgrade xorm to v1.2.5 (#17177)

3 years agoFix wording in issue template (#17176)
silverwind [Wed, 29 Sep 2021 11:03:44 +0000 (13:03 +0200)]
Fix wording in issue template (#17176)

There was a typo `systemm` here. I opted to just remove the superfluos word altogether.

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 29 Sep 2021 00:25:04 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoCreate pub/priv keypair for federation (#17071)
techknowlogick [Tue, 28 Sep 2021 19:19:22 +0000 (15:19 -0400)]
Create pub/priv keypair for federation (#17071)

* add logic for creating pub/priv keypair for federation

* Apply suggestions from code review

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

* Update modules/activitypub/keypair.go

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

* fix revert

* more tests

* Apply suggestions from code review

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

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix bug of get context user (#17169)
Lunny Xiao [Tue, 28 Sep 2021 13:13:04 +0000 (21:13 +0800)]
Fix bug of get context user (#17169)

Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd delvh to MAINTAINERS (#17170)
delvh [Tue, 28 Sep 2021 12:28:12 +0000 (14:28 +0200)]
Add delvh to MAINTAINERS (#17170)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 28 Sep 2021 00:05:15 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd nodeinfo endpoint for federation purposes (#16953)
techknowlogick [Mon, 27 Sep 2021 23:38:06 +0000 (19:38 -0400)]
Add nodeinfo endpoint for federation purposes (#16953)

Nodeinfo is a way to expose certain metadata about a server for use of discovery regarding functionality of its federation capabilities.

Two endpoints are required:
1. `/.well-known/nodeinfo` which informs client where it can find the location of the location of its metadata (including which version of the schema is used)
2. the endpoint which exposes the metadata in json format according to schema.

Notes:
* `openRegistrations` is a required field, but I propose to set to false as default in case someone writes a crawler to discover "open" gitea instances
* to limit data leakage I also propose to not include the `usage` field (note it is required so it should be included, but left as empty).

More info:
https://github.com/jhass/nodeinfo
https://github.com/jhass/nodeinfo/tree/main/schemas/2.1
http://nodeinfo.diaspora.software/protocol.html

3 years agoDon't return binary file changes in raw PR diffs by default (#17158)
Norwin [Mon, 27 Sep 2021 21:09:49 +0000 (23:09 +0200)]
Don't return binary file changes in raw PR diffs by default (#17158)

* return diffs without binary file content change

* ?binary=true option to restore old behaviour

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoNicely handle missing user in collaborations (#17049)
zeripath [Mon, 27 Sep 2021 18:07:19 +0000 (19:07 +0100)]
Nicely handle missing user in collaborations (#17049)

* Nicely handle missing user in collaborations

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix #17044

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
3 years agoCreate doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 (#17136)
zeripath [Mon, 27 Sep 2021 15:55:12 +0000 (16:55 +0100)]
Create doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 (#17136)

There was a serious issue with the `gitea dump` command in 1.14.3-1.14.6 which led to corruption of the `config` field of the `repo_unit` table.

This PR adds a doctor command to attempt to fix the broken repo_units. Users affected by #16961 should run:

```
gitea doctor --fix --run fix-broken-repo-units
```

Fix #16961

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoUse light/dark theme based on system preference (#17051)
Gwyneth Morgan [Mon, 27 Sep 2021 14:47:44 +0000 (07:47 -0700)]
Use light/dark theme based on system preference (#17051)

Add a new default theme `auto`, which will automatically switch between
`gitea` (light) and `arc-green` (dark) themes depending on the user's
operating system settings.

Closes: #8183
3 years agodocs: explain where are settings for release files (#17161)
Forest Johnson [Mon, 27 Sep 2021 13:00:54 +0000 (08:00 -0500)]
docs: explain where are settings for release files (#17161)

Just a tiny change to save someone some time while reading the docs. I got lost in the angular code and npm packages trying to reverse engineer it  and figure out what setting controlled this file limit:

![image](https://user-images.githubusercontent.com/7119703/134829716-8f587878-21a3-413b-ba1e-c2bbe9391ad2.png)

Eventually I tracked it down from

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/options/locale/locale_en-US.ini#L2776

to

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/templates/repo/upload.tmpl#L11

to

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/web_src/js/index.js#L1043

to

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/web_src/js/features/dropzone.js#L3

to

https://www.npmjs.com/package/dropzone

and then I realized I can't read :sweat_smile:,  back  to

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/templates/repo/upload.tmpl#L8

and quickly solved it from there!!

https://github.com/go-gitea/gitea/blob/b74a0f9060d5fda341f5554ef529a2006308c6ab/modules/upload/upload.go#L81

Yes  I know this long path was 90% me failing to read code properly and going on a red herring journey...  but point is we should not have to do this in the first place to know how to  configure this file upload form :pleading_face: :point_right: :point_left:

3 years agoSupport direct comparison (git diff a..b) as well merge comparison (a...b) (#16635)
zeripath [Mon, 27 Sep 2021 12:19:34 +0000 (13:19 +0100)]
Support direct comparison (git diff a..b) as well merge comparison (a...b) (#16635)

This PR changes the compare page to make the "..." in the between branches a clickable
link. This changes the comparison type from "..." to "..". Similarly it makes the
initial compare icon clickable to switch the head and base branches.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoAllow LDAP Sources to provide Avatars (#16851)
zeripath [Mon, 27 Sep 2021 02:39:36 +0000 (03:39 +0100)]
Allow LDAP Sources to provide Avatars (#16851)

* Allow LDAP Sources to provide Avatars

Add setting to LDAP source to allow it to provide an Avatar.

Currently this is required to point to the image bytes.

Fix #4144

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Rename as Avatar Attribute (drop JPEG)

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Always synchronize avatar if there is change

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Actually get the avatar from the ldap

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* use len()>0 rather than != ""

Signed-off-by: Andrew Thornton <art27@cantab.net>
* slight shortcut in IsUploadAvatarChanged

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoAdd SkipLocal2FA option to pam and smtp sources (#17078)
zeripath [Mon, 27 Sep 2021 01:02:01 +0000 (02:02 +0100)]
Add SkipLocal2FA option to pam and smtp sources (#17078)

* Add SkipLocal2FA option to other pam and smtp sources

Extend #16954 to allow setting skip local 2fa on pam and SMTP authentication sources

Signed-off-by: Andrew Thornton <art27@cantab.net>
* make SkipLocal2FA omitempty

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 26 Sep 2021 00:05:01 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix bundle creation (#17079)
Alexey 〒erentyev [Sat, 25 Sep 2021 21:29:25 +0000 (00:29 +0300)]
Fix bundle creation (#17079)

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Gwyneth Morgan <87623694+gwymor@users.noreply.github.com>
Co-authored-by: Gwyneth Morgan <gwymor@tilde.club>
3 years agoFix wrong i18n keys (#17150)
Lunny Xiao [Sat, 25 Sep 2021 14:27:01 +0000 (22:27 +0800)]
Fix wrong i18n keys (#17150)

Co-authored-by: 6543 <6543@obermui.de>
3 years agoMove twofactor to models/login (#17143)
Lunny Xiao [Sat, 25 Sep 2021 13:00:12 +0000 (21:00 +0800)]
Move twofactor to models/login (#17143)

3 years agoForce color-adjust for markdown checkboxes (#17146)
sebastian-sauer [Sat, 25 Sep 2021 06:45:55 +0000 (08:45 +0200)]
Force color-adjust for markdown checkboxes (#17146)

this forces browsers to render background correctly

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 25 Sep 2021 00:04:51 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoPrevent panic in Org mode HighlightCodeBlock (#17140)
zeripath [Fri, 24 Sep 2021 13:29:32 +0000 (14:29 +0100)]
Prevent panic in Org mode HighlightCodeBlock (#17140)

When rendering source in org mode there is a mistake in the highlight code that
causes a panic.

This PR fixes this.

Fix #17139

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMove login related structs and functions to models/login (#17093)
Lunny Xiao [Fri, 24 Sep 2021 11:32:56 +0000 (19:32 +0800)]
Move login related structs and functions to models/login (#17093)

* Move login related structs and functions to models/login

* Fix test

* Fix lint

* Fix lint

* Fix lint of windows

* Fix lint

* Fix test

* Fix test

* Only load necessary fixtures when preparing unit tests envs

* Fix lint

* Fix test

* Fix test

* Fix error log

* Fix error log

* Fix error log

* remove unnecessary change

* fix error log

* merge main branch

3 years agoUnify issue and pr subtitles (#17133)
crapStone [Thu, 23 Sep 2021 16:57:52 +0000 (18:57 +0200)]
Unify issue and pr subtitles (#17133)

3 years agoDBContext is just a Context (#17100)
zeripath [Thu, 23 Sep 2021 15:45:36 +0000 (16:45 +0100)]
DBContext is just a Context (#17100)

* DBContext is just a Context

This PR removes some of the specialness from the DBContext and makes it context
This allows us to simplify the GetEngine code to wrap around any context in future
and means that we can change our loadRepo(e Engine) functions to simply take contexts.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix unit tests

Signed-off-by: Andrew Thornton <art27@cantab.net>
* another place that needs to set the initial context

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* change attachment error

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix typo skipping a migration (#17130)
delvh [Thu, 23 Sep 2021 12:42:42 +0000 (14:42 +0200)]
Fix typo skipping a migration (#17130)

3 years agoFix commit status index problem (#17061)
Lunny Xiao [Thu, 23 Sep 2021 10:50:06 +0000 (18:50 +0800)]
Fix commit status index problem (#17061)

* Fix commit status index problem

* remove unused functions

* Add fixture and test for migration

* Fix lint

* Fix fixture

* Fix lint

* Fix test

* Fix bug

* Fix bug

3 years agoFix problem when database id is not increment as expected (#17124)
Lunny Xiao [Wed, 22 Sep 2021 20:09:29 +0000 (04:09 +0800)]
Fix problem when database id is not increment as expected (#17124)

3 years agorefactor: move from io/ioutil to io and os package (#17109)
Eng Zer Jun [Wed, 22 Sep 2021 05:38:34 +0000 (13:38 +0800)]
refactor: move from io/ioutil to io and os package (#17109)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoupdate docs to 1.15.3
techknowlogick [Wed, 22 Sep 2021 01:38:04 +0000 (21:38 -0400)]
update docs to 1.15.3

3 years agoChangelog 1.15.3 (#17091) (#17113)
6543 [Wed, 22 Sep 2021 01:32:45 +0000 (03:32 +0200)]
Changelog 1.15.3 (#17091) (#17113)

## [1.15.3](https://github.com/go-gitea/gitea/releases/tag/v1.15.3) - 2021-09-19

* ENHANCEMENTS
  * Add fluid to ui container class to remove margin (#16396) (#16976)
  * Add caller to cat-file batch calls (#17082) (#17089)
* BUGFIXES
  * Render full plain readme. (#17083) (#17090)
  * Upgrade xorm to v1.2.4 (#17059)
  * Fix bug of migrate comments which only fetch one page (#17055) (#17058)
  * Do not show issue context popup on external issues (#17050) (#17054)
  * Decrement Fork Num when converting from Fork (#17035) (#17046)
  * Correctly rollback in ForkRepository (#17034) (#17045)
  * Fix missing close in WalkGitLog (#17008) (#17009)
  * Add prefix to SVG id/class attributes (#16997) (#17000)
  * Fix bug of migrated repository not index (#16991) (#16996)
  * Skip AllowedUserVisibilityModes validation on update user if it is an organisation (#16988) (#16990)
  * Fix storage Iterate bug and Add storage doctor to delete garbage attachments (#16971) (#16977)
  * Fix issue with issue default mail template (#16956) (#16975)
  * Ensure that rebase conflicts are handled in updates (#16952) (#16960)
  * Prevent panic on diff generation (#16950) (#16951)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoMerge endpoints for pull diff/patch (#17104)
qwerty287 [Tue, 21 Sep 2021 23:04:53 +0000 (01:04 +0200)]
Merge endpoints for pull diff/patch (#17104)

this merges the two API endpoints for the PR diff/patch in to one

3 years agoAdd Horizontal scrollbar to inner menu on Chrome (#17086)
zeripath [Tue, 21 Sep 2021 08:35:28 +0000 (09:35 +0100)]
Add Horizontal scrollbar to inner menu on Chrome (#17086)

There is a longstanding bug whereby the admin pages, in particular, have not had
a horizontal scrollbar on chrome when the page is narrow.

This PR simply adds overflow-x and adds a default height to the scrollbar to
match that of the vertical bar.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoIgnore Sync errors on pipes when doing `CheckAttributeReader.CheckPath`, fix the...
wxiaoguang [Mon, 20 Sep 2021 19:46:51 +0000 (03:46 +0800)]
Ignore Sync errors on pipes when doing `CheckAttributeReader.CheckPath`, fix the hang of `git cat-file` (#17096)

* Ignore Sync errors on pipes when doing `CheckAttributeReader.CheckPath`

* apply env patch

* Drop the Sync and fix a number of issues with the Close function

Signed-off-by: Andrew Thornton <art27@cantab.net>
* add logs for DBIndexer and CheckPath

* Fix some more closing bugs

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add test case for language_stats

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update modules/indexer/stats/db.go

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd API to get commit diff/patch (#17095)
qwerty287 [Mon, 20 Sep 2021 16:14:29 +0000 (18:14 +0200)]
Add API to get commit diff/patch (#17095)

* Add API to get commit diff/patch
* Add Tests

Co-authored-by: 6543 <6543@obermui.de>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 20 Sep 2021 00:04:38 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoMove db related basic functions to models/db (#17075)
Lunny Xiao [Sun, 19 Sep 2021 11:49:59 +0000 (19:49 +0800)]
Move db related basic functions to models/db (#17075)

* Move db related basic functions to models/db

* Fix lint

* Fix lint

* Fix test

* Fix lint

* Fix lint

* revert unnecessary change

* Fix test

* Fix wrong replace string

* Use *Context

* Correct committer spelling and fix wrong replaced words

Co-authored-by: zeripath <art27@cantab.net>
3 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 19 Sep 2021 00:05:00 +0000 (00:05 +0000)]
[skip ci] Updated licenses and gitignores

3 years agoOpen the DingTalk link in browser (#17084)
wxiaoguang [Sat, 18 Sep 2021 19:35:23 +0000 (03:35 +0800)]
Open the DingTalk link in browser (#17084)

https://developers.dingtalk.com/document/app/message-link-description

To open the link in browser, we should use this URL: `"dingtalk://dingtalkclient/page/link?pc_slide=false&url=" + url.QueryEscape(singleURL)`

Otherwise the page is displayed inside DingTalk client, it makes users very difficult to visit non-public URLs in DingTalk webhook messages.

3 years agoAdd left padding for chunk header of split diff view (#13397)
Bagas Sanjaya [Sat, 18 Sep 2021 17:59:21 +0000 (00:59 +0700)]
Add left padding for chunk header of split diff view (#13397)

This commit adds 10px padding-left on chunk header element
(which is `<span>`).

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoSwitch migration icon to svg (#15954)
silverwind [Sat, 18 Sep 2021 16:22:51 +0000 (18:22 +0200)]
Switch migration icon to svg (#15954)

Followup on https://github.com/go-gitea/gitea/pull/15952, use SVG for migration icon.

<img width="541" alt="Screen Shot 2021-05-23 at 00 26 12" src="https://user-images.githubusercontent.com/115237/119242417-c1a37600-bb5d-11eb-9f97-a80aa89741ee.png">
<img width="540" alt="Screen Shot 2021-05-23 at 00 25 39" src="https://user-images.githubusercontent.com/115237/119242419-c2d4a300-bb5d-11eb-9792-1e6e4092c9f9.png">

3 years agoFixed issue where creating a reference of an issue would create a tag with the full...
Jelle Hulter [Sat, 18 Sep 2021 15:44:45 +0000 (17:44 +0200)]
Fixed issue where creating a reference of an issue would create a tag with the full name instead of the username if this is the default in the .ini file (#17074)

Adds an extra attribute to every issue comment containing the actual username, such that it can be used to tag the original author when clicking on "Reference in new issue" (#17073)

Fix #17073

3 years agoRender full plain readme. (#17083)
KN4CK3R [Sat, 18 Sep 2021 02:46:57 +0000 (04:46 +0200)]
Render full plain readme. (#17083)

3 years agoOpenAPI: correct documentation of issue listing parameters (#17060)
Norwin [Sat, 18 Sep 2021 01:01:50 +0000 (03:01 +0200)]
OpenAPI: correct documentation of issue listing parameters (#17060)

* correct documentation of issue listing parameters

* make generate-swagger

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoAdd caller to cat-file batch calls (#17082)
zeripath [Sat, 18 Sep 2021 00:54:15 +0000 (01:54 +0100)]
Add caller to cat-file batch calls (#17082)

Some people still appear to report unclosed cat-files. This PR simply adds the caller
to the process descriptor for the CatFileBatch and CatFileBatchCheck calls.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 18 Sep 2021 00:05:15 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoNotifications API: respond with updated notifications (#17064)
Norwin [Fri, 17 Sep 2021 23:40:50 +0000 (01:40 +0200)]
Notifications API: respond with updated notifications (#17064)

* notifications api: return updated notifications in response

* make generate-swagger

* openapi fix

Co-authored-by: zeripath <art27@cantab.net>
3 years agoAdd minimum versions of databases to the docs (#17080)
zeripath [Fri, 17 Sep 2021 22:25:50 +0000 (23:25 +0100)]
Add minimum versions of databases to the docs (#17080)

We do not currently state the minimum versions of databases we support.

This PR sets them to:
* MySQL >=5.7
* Postgres >=10
* MSSQL >=2008R2 SP3

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMake LDAP be able to skip local 2FA (#16954)
zeripath [Fri, 17 Sep 2021 11:43:47 +0000 (12:43 +0100)]
Make LDAP be able to skip local 2FA (#16954)

This PR extends #16594 to allow LDAP to be able to be set to skip local 2FA too. The technique used here would be extensible to PAM and SMTP sources.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 17 Sep 2021 00:04:54 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoUpgrade xorm to v1.2.4 (#17059) (#17068)
Lunny Xiao [Thu, 16 Sep 2021 17:53:28 +0000 (01:53 +0800)]
Upgrade xorm to v1.2.4 (#17059) (#17068)

Co-authored-by: zeripath <art27@cantab.net>
3 years agoClean-up HookPreReceive and restore functionality for pushing non-standard refs ...
zeripath [Thu, 16 Sep 2021 13:34:54 +0000 (14:34 +0100)]
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>
3 years agoIssue template form (#16349)
Gabriel [Wed, 15 Sep 2021 17:33:13 +0000 (18:33 +0100)]
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>
3 years agoFix bug of migrate comments which only fetch one page (#17055)
Lunny Xiao [Wed, 15 Sep 2021 11:30:19 +0000 (19:30 +0800)]
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>
3 years agoImprove LDAP synchronization efficiency (#16994)
zeripath [Wed, 15 Sep 2021 09:28:37 +0000 (10:28 +0100)]
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>
3 years agoDo not show issue context popup on external issues (#17050)
zeripath [Wed, 15 Sep 2021 08:45:27 +0000 (09:45 +0100)]
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>
3 years agoUpdate template (#17043)
qwerty287 [Wed, 15 Sep 2021 04:58:44 +0000 (06:58 +0200)]
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>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 15 Sep 2021 00:05:33 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd doctor dbconsistency check for release and attachment (#16978)
Lunny Xiao [Tue, 14 Sep 2021 19:41:40 +0000 (03:41 +0800)]
Add doctor dbconsistency check for release and attachment (#16978)

3 years agoAdd `AbsoluteListOptions` (#17028)
KN4CK3R [Tue, 14 Sep 2021 17:48:27 +0000 (19:48 +0200)]
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.

3 years agoDecrement Fork Num when converting from Fork (#17035)
zeripath [Tue, 14 Sep 2021 17:07:08 +0000 (18:07 +0100)]
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>
3 years agoCorrectly rollback in ForkRepository (#17034)
zeripath [Tue, 14 Sep 2021 16:16:40 +0000 (17:16 +0100)]
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>
3 years agoAlways emit the configuration path (#17036)
zeripath [Tue, 14 Sep 2021 01:24:57 +0000 (02:24 +0100)]
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>
3 years agoUpdate go-chi/session (fixes "race" in tests) (#17031)
zeripath [Mon, 13 Sep 2021 08:40:55 +0000 (09:40 +0100)]
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>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 13 Sep 2021 00:05:10 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agofixed create repo page layout (#17012)
Alexey 〒erentyev [Sun, 12 Sep 2021 18:24:57 +0000 (21:24 +0300)]
fixed create repo page layout (#17012)

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
3 years agoUse common sessioner for API and Web (#17027)
zeripath [Sun, 12 Sep 2021 17:35:38 +0000 (18:35 +0100)]
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>
3 years agoFix reset password email template (#17025)
Jimmy Praet [Sun, 12 Sep 2021 13:02:07 +0000 (15:02 +0200)]
Fix reset password email template (#17025)

Removed unused variable passed to mail.link_not_working_do_paste

Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix overflow label in mobile view (#17020)
Tchoupinax [Sun, 12 Sep 2021 11:40:20 +0000 (13:40 +0200)]
Fix overflow label in mobile view (#17020)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 12 Sep 2021 00:05:05 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoSupport unprotected file patterns (#16395)
Jimmy Praet [Sat, 11 Sep 2021 14:21:17 +0000 (16:21 +0200)]
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

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 11 Sep 2021 00:05:02 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoReport the associated filter if there is an error in LDAP (#17014)
zeripath [Fri, 10 Sep 2021 22:46:27 +0000 (23:46 +0100)]
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>
3 years agoAdd skip and limit to git.GetTags (#16897)
6543 [Fri, 10 Sep 2021 17:30:37 +0000 (19:30 +0200)]
Add skip and limit to git.GetTags (#16897)

* Make GetTags() api similar to GetBranches()
* Use it for Tag/Release page

3 years agoAdd setting to OAuth handlers to skip local 2FA authentication (#16594)
zeripath [Fri, 10 Sep 2021 16:37:57 +0000 (17:37 +0100)]
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>
3 years agoCalculate label URL on API (#16186)
6543 [Fri, 10 Sep 2021 16:03:16 +0000 (18:03 +0200)]
Calculate label URL on API  (#16186)

close #8028

3 years agoAdd "new issue" button on project (#17001)
Romain [Fri, 10 Sep 2021 11:33:06 +0000 (13:33 +0200)]
Add "new issue" button on project (#17001)

* Add "new issue" button on project

3 years agoFix missing close in WalkGitLog (#17008)
zeripath [Fri, 10 Sep 2021 09:46:12 +0000 (10:46 +0100)]
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>
3 years agoUse git attributes to determine generated and vendored status for language stats...
zeripath [Thu, 9 Sep 2021 20:13:36 +0000 (21:13 +0100)]
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

3 years agodoc: Upgrade from an old Gitea (#16918)
wxiaoguang [Thu, 9 Sep 2021 18:13:21 +0000 (02:13 +0800)]
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>
3 years agoUse filename as id/class prefix. (#16997)
KN4CK3R [Thu, 9 Sep 2021 07:06:54 +0000 (09:06 +0200)]
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.

3 years agoEnable Malayalam, Greek, Persian, Hungarian & Indonesian by default (#16998)
6543 [Thu, 9 Sep 2021 06:16:42 +0000 (08:16 +0200)]
Enable Malayalam, Greek, Persian, Hungarian & Indonesian by default (#16998)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 9 Sep 2021 00:04:58 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoReturn correct error response for agit force-push (#16989)
a1012112796 [Wed, 8 Sep 2021 20:20:55 +0000 (04:20 +0800)]
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>
3 years agoFix bug of migrated repository not index (#16991)
Lunny Xiao [Wed, 8 Sep 2021 17:43:19 +0000 (01:43 +0800)]
Fix bug of migrated repository not index (#16991)

Fix #16986, #16152

3 years agoChanges for German language (#16985)
Hakermann420 [Wed, 8 Sep 2021 16:37:06 +0000 (18:37 +0200)]
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>
3 years agoSkip AllowedUserVisibilityModes validation on update user if it is an organisation...
6543 [Wed, 8 Sep 2021 15:47:49 +0000 (17:47 +0200)]
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>
3 years agoAdd repo_id for attachment (#16958)
Lunny Xiao [Wed, 8 Sep 2021 15:19:30 +0000 (23:19 +0800)]
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>
3 years agoMake TestOneDevDownloadRepo work again & more resistant (#16987)
6543 [Wed, 8 Sep 2021 14:17:22 +0000 (16:17 +0200)]
Make TestOneDevDownloadRepo work again & more resistant (#16987)

* Update TestOneDevDownloadRepo since OneDev api changed

* Use test functions for migrations

3 years agoDisable Fomantic's CSS tooltips (#16974)
silverwind [Wed, 8 Sep 2021 06:23:46 +0000 (08:23 +0200)]
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.

3 years agoMake mirror feature more configurable (#16957)
6543 [Tue, 7 Sep 2021 15:49:36 +0000 (17:49 +0200)]
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>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 7 Sep 2021 00:04:55 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd Cache-Control to avatar redirects (#16973)
silverwind [Mon, 6 Sep 2021 21:05:44 +0000 (23:05 +0200)]
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>
3 years agoResolve TODO: Enable pagination on GiteaDownloader.GetComments() & update another...
6543 [Mon, 6 Sep 2021 16:00:50 +0000 (18:00 +0200)]
Resolve TODO: Enable pagination on GiteaDownloader.GetComments() & update another TODO (#16963)

* Update TODO in migrations

* Resolve TODO: enable pagination on GiteaDownloader.GetComments()

3 years agoFix storage Iterate bug and Add storage doctor to delete garbage attachments (#16971)
Lunny Xiao [Mon, 6 Sep 2021 14:46:20 +0000 (22:46 +0800)]
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

3 years agoAdd missing icon set for `ActionRenameRepo` (#16972)
a1012112796 [Mon, 6 Sep 2021 14:11:17 +0000 (22:11 +0800)]
Add missing icon set for `ActionRenameRepo` (#16972)

Signed-off-by: a1012112796 <1012112796@qq.com>
3 years agoPrevent panic on diff generation (#16950)
zeripath [Sun, 5 Sep 2021 10:16:49 +0000 (11:16 +0100)]
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>
3 years agoEnsure that rebase conflicts are handled in updates (#16952)
zeripath [Sun, 5 Sep 2021 09:30:40 +0000 (10:30 +0100)]
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>