]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoDon't prevent overflow on y-as (#19978)
Gusted [Thu, 16 Jun 2022 14:49:22 +0000 (16:49 +0200)]
Don't prevent overflow on y-as (#19978)

- Fomantic tries to prevent overflowing on the `y/x`-as by default on
stackable menu's on mobile screens. We already solve this issue by
forcing overflow on x as and hide it on y as(due to some issues with
other menu's), since https://github.com/go-gitea/gitea/pull/19486.
- However this edge case does require a y-overflow to show the dropdown,
because you cannot easily adjust this with CSS, once you're fiddling
with overflow's (https://stackoverflow.com/a/6433475). However
interesting behavior is noted
https://css-tricks.com/popping-hidden-overflow/ when you remove the
position: relative, it will suddenly work again. Well because this is
the only solution without redesigning dropdowns, I think we can live
with the side-effect of the dropdown items being full-width instead
"relative" width to their parent.
- Resolves #19976

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
a1012112796 [Thu, 16 Jun 2022 14:10:29 +0000 (14:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agofix `go to file` link for mirror repository (#19983)
a1012112796 [Thu, 16 Jun 2022 12:37:13 +0000 (20:37 +0800)]
fix `go to file` link for mirror repository (#19983)

the `BaseRepo` not always exit, should
use `Repository`.

Signed-off-by: a1012112796 <1012112796@qq.com>
2 years agoDon't buffer doctor logger (#19982)
Gusted [Thu, 16 Jun 2022 09:10:33 +0000 (11:10 +0200)]
Don't buffer doctor logger (#19982)

- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves #19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAllow render HTML with css/js external links (#19017)
Lunny Xiao [Thu, 16 Jun 2022 03:33:23 +0000 (11:33 +0800)]
Allow render HTML with css/js external links (#19017)

* Allow render HTML with css/js external links

* Fix bug because of filename escape chars

* Fix lint

* Update docs about new configuration item

* Fix bug of render HTML in sub directory

* Add CSP head for displaying iframe in rendering file

* Fix test

* Apply suggestions from code review

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

* some improvement

* revert change in SanitizerDisabled of external renderer

* Add sandbox for iframe and support allow-scripts and allow-same-origin

* refactor

* fix

* fix lint

* fine tune

* use single option RENDER_CONTENT_MODE, use sandbox=allow-scripts

* fine tune CSP

* Apply suggestions from code review

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse correct count for `NumOpenIssues` (#19980)
Gusted [Thu, 16 Jun 2022 02:51:34 +0000 (04:51 +0200)]
Use correct count for `NumOpenIssues` (#19980)

- Don't specify the field in `Count` instead use `Cols` for this.
- Call `log.Error` when a error occur.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoIn code search, get code unit accessible repos in one (main) query (#19764)
Hugo Hoitink [Wed, 15 Jun 2022 23:24:10 +0000 (01:24 +0200)]
In code search, get code unit accessible repos in one (main) query (#19764)

* When non-admin users use code search, get code unit accessible repos in one main query

* Modified some comments to match the changes

* Removed unnecessary check for Access Mode in Collaboration table

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Wed, 15 Jun 2022 22:10:15 +0000 (22:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAlways try to fetch repo for mirrors (#19975)
Gusted [Wed, 15 Jun 2022 15:58:44 +0000 (17:58 +0200)]
Always try to fetch repo for mirrors (#19975)

- Always give a best-effort to fetching the repositories, if even that
fails indeed give a disconnected mirror found error.
- *Partially* resolves #19928

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRemove tab/TabName usage where it's not needed (#19973)
Lauris BH [Wed, 15 Jun 2022 15:05:32 +0000 (18:05 +0300)]
Remove tab/TabName usage where it's not needed (#19973)

`tab` query argument and `TabName` in context is used only in profile so remove it from all other places where it's not used anymore.

2 years agoFix cli command restore-repo: "units" should be parsed as StringSlice (#19953)
wxiaoguang [Wed, 15 Jun 2022 12:28:03 +0000 (20:28 +0800)]
Fix cli command restore-repo: "units" should be parsed as StringSlice (#19953)

* Fix cli command restore-repo: "units" should be parsed as StringSlice because after  #15790 it's read by c.StringSlice("units").  Before, the "units" were processed by strings.Split
* Add checking for invalid unit names

Co-authored-by: 6543 <6543@obermui.de>
2 years agoUppercase first languages letters (#19965)
AHOHNMYC [Wed, 15 Jun 2022 10:08:49 +0000 (13:08 +0300)]
Uppercase first languages letters (#19965)

2 years agoMove tests as seperate sub packages to reduce duplicated file names (#19951)
Lunny Xiao [Wed, 15 Jun 2022 07:02:00 +0000 (15:02 +0800)]
Move tests as seperate sub packages to reduce duplicated file names (#19951)

2 years agoReplace unstyled meter with progress (#19968)
silverwind [Wed, 15 Jun 2022 04:28:24 +0000 (06:28 +0200)]
Replace unstyled meter with progress (#19968)

Replace the only `<meter>` element in use with a `<progress>` which is
styled properly. Also slightly adjust colors on it for better contrast.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
singuliere [Wed, 15 Jun 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated translations via Crowdin
singuliere [Tue, 14 Jun 2022 00:10:10 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemove singuliere from MAINTAINERS (#19883)
singuliere [Mon, 13 Jun 2022 20:05:41 +0000 (22:05 +0200)]
Remove singuliere from MAINTAINERS (#19883)

2 years agoFix aria for logo (#19955)
wxiaoguang [Mon, 13 Jun 2022 18:46:39 +0000 (02:46 +0800)]
Fix aria for logo (#19955)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix mirror template bug (#19959)
Lunny Xiao [Mon, 13 Jun 2022 16:12:59 +0000 (00:12 +0800)]
Fix mirror template bug (#19959)

* Fix mirror template bug

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoAdd deprecated log when using MySQL with utf8 charset (#19952)
Lunny Xiao [Mon, 13 Jun 2022 12:55:08 +0000 (20:55 +0800)]
Add deprecated log when using MySQL with utf8 charset (#19952)

2 years agoMove issues related files into models/issues (#19931)
Lunny Xiao [Mon, 13 Jun 2022 09:37:59 +0000 (17:37 +0800)]
Move issues related files into models/issues (#19931)

* Move access and repo permission to models/perm/access

* fix test

* fix git test

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

* Move issues related code to models/issues

* Move some issues related sub package

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

* Rename some files

2 years agofix: some typos (#19956)
yutotnh [Mon, 13 Jun 2022 07:34:46 +0000 (16:34 +0900)]
fix: some typos (#19956)

2 years ago[skip ci] Updated translations via Crowdin
Lunny Xiao [Mon, 13 Jun 2022 00:10:09 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMove some code into models/git (#19879)
Lunny Xiao [Sun, 12 Jun 2022 15:51:54 +0000 (23:51 +0800)]
Move some code into models/git (#19879)

* Move access and repo permission to models/perm/access

* fix test

* Move some git related files into sub package models/git

* Fix build

* fix git test

* move lfs to sub package

* move more git related functions to models/git

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

2 years agoFix signal loop in graceful manager (#19943)
wxiaoguang [Sun, 12 Jun 2022 13:50:18 +0000 (21:50 +0800)]
Fix signal loop in graceful manager (#19943)

2 years agoPrettify number of issues (#17760)
Gusted [Sun, 12 Jun 2022 12:08:23 +0000 (14:08 +0200)]
Prettify number of issues (#17760)

* Prettify number of issues

- Use the PrettyNumber function to add commas in large amount of issues.

* Use client-side formatting

* prettify on both server and client

* remove unused i18n entries

* handle more cases, support other int types in PrettyNumber

* specify locale to avoid issues with node default locale

* remove superfluos argument

* introduce template helper, octicon tweaks, js refactor

* Update modules/templates/helper.go

* Apply some suggestions.

* Add comment

* Update templates/user/dashboard/issues.tmpl

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoImprove file header on mobile (#19945)
Gusted [Sun, 12 Jun 2022 09:30:22 +0000 (11:30 +0200)]
Improve file header on mobile (#19945)

- File headers can become quite width, so ensure the file size is not
being wrapped into itself(width + padding-right) and allow the overflow
to be scrolled(overflow-x).

2 years agoUnify repo settings & show better error (#19828)
Gusted [Sun, 12 Jun 2022 05:43:27 +0000 (07:43 +0200)]
Unify repo settings & show better error (#19828)

* Unify context data
* Actually show invalid url in error

2 years ago[skip ci] Updated translations via Crowdin
xkcdstickfigure [Sun, 12 Jun 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agofixed comment typo (#19944)
xkcdstickfigure [Sat, 11 Jun 2022 18:54:08 +0000 (19:54 +0100)]
fixed comment typo (#19944)

2 years agoAuto merge pull requests when all checks succeeded via WebUI (#19648)
6543 [Sat, 11 Jun 2022 14:44:20 +0000 (16:44 +0200)]
Auto merge pull requests when all checks succeeded via WebUI (#19648)

Add WebUI part of Auto merge feature

close #19621

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoFix some mirror bugs (#18649)
Lunny Xiao [Sat, 11 Jun 2022 13:50:14 +0000 (21:50 +0800)]
Fix some mirror bugs (#18649)

* Fix some mirror bugs

* Remove unnecessary code

* Fix lint

* rename stdard url

* Allow more charactors in git ssh protocol url

* improve the detection

* support ipv6 for git url parse

* Fix bug

* Fix template

* Fix bug

* fix template

* Fix tmpl

* Fix tmpl

* Fix parse ssh with interface

* Rename functions name

Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix data-race problems in git module (quick patch) (#19934)
wxiaoguang [Sat, 11 Jun 2022 03:56:27 +0000 (11:56 +0800)]
Fix data-race problems in git module (quick patch) (#19934)

* Fix data-race problems in git module

* use HomeDir instead of setting.RepoRootPath

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
silverwind [Sat, 11 Jun 2022 00:10:12 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix copy/paste of empty lines (#19798)
silverwind [Fri, 10 Jun 2022 13:45:28 +0000 (15:45 +0200)]
Fix copy/paste of empty lines (#19798)

* Fix copy/paste of empty newlines again

Fixes: https://github.com/go-gitea/gitea/issues/19331
Regressed by: https://github.com/go-gitea/gitea/pull/18270

Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.

Specifically, the Chroma HTML change mentioned in
https://github.com/go-gitea/gitea/pull/18270#issuecomment-1013350246
broke our previous newline replacement for such empty lines.

Also included are a few changes to make the test more pleasant to work
with.

* run go mod tidy

* add util.Dedent

* copy in the code

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoNormalize line endings in fomantic build files (#19932)
silverwind [Fri, 10 Jun 2022 12:24:02 +0000 (14:24 +0200)]
Normalize line endings in fomantic build files (#19932)

Ensures consistent line endings to avoid useless diffs because there is
somthing platform-dependant in that build.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoMake user profile image show full image on mobile (#19840)
Eekle [Fri, 10 Jun 2022 11:06:34 +0000 (12:06 +0100)]
Make user profile image show full image on mobile (#19840)

* Make user profile image show full image on mobile

2 years agoCustom regexp external issues (#17624)
Sandro Santilli [Fri, 10 Jun 2022 05:39:53 +0000 (07:39 +0200)]
Custom regexp external issues (#17624)

* Implement custom regular expression for external issue tracking.

Signed-off-by: Alexander Beyn <malex@fatelectrons.org>
* Fix syntax/style

* Update repo.go

* Set metas['regexp']

* gofmt

* fix some tests

* fix more tests

* refactor frontend

* use LRU cache for regexp

* Update modules/markup/html_internal_test.go

Co-authored-by: Alexander Beyn <malex@fatelectrons.org>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse Golang 1.18 for Gitea 1.17 release (#19918)
wxiaoguang [Fri, 10 Jun 2022 03:34:41 +0000 (11:34 +0800)]
Use Golang 1.18 for Gitea 1.17 release (#19918)

Use Golang 1.18 (as minimal requirement) for Gitea 1.17 release, make sure the Golang version is still actively supported during Gitea 1.17 lifecycle.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoRefactor git module, make Gitea use internal git config (#19732)
wxiaoguang [Fri, 10 Jun 2022 01:57:49 +0000 (09:57 +0800)]
Refactor git module, make Gitea use internal git config (#19732)

* Refactor git module, make Gitea use internal git config, add safe.directory config

* introduce git.InitSimple and git.InitWithConfigSync, make serv cmd use gitconfig

* use HOME instead of GIT_CONFIG_GLOBAL, because git always needs a correct HOME

* fix cmd env in cmd/serv.go

* fine tune error message

* Fix a incorrect test case

* fix configAddNonExist

* fix configAddNonExist logic, add `--fixed-value` flag, add tests

* add configSetNonExist function in case it's needed.

* use configSetNonExist for `user.name` and `user.email`

* add some comments

* Update cmd/serv.go

Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/serv.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/git/git.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/setting/setting.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/git/repo_attribute.go

Co-authored-by: zeripath <art27@cantab.net>
* fix spaces in messages

* use `configSet("core.protectNTFS", ...)` instead of `globalCommandArgs`

* remove GIT_CONFIG_NOSYSTEM, continue to use system's git config

* Update cmd/serv.go

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

* remove code for safe.directory

* separate git.CommonEnvs to CommonGitCmdEnvs and CommonCmdServEnvs

* avoid Golang's data race error

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Roger Luo [Fri, 10 Jun 2022 00:10:33 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFeature: Find files in repo (#15028)
Roger Luo [Thu, 9 Jun 2022 11:15:08 +0000 (19:15 +0800)]
Feature: Find files in repo (#15028)

* Create finding files page ui in repo page

* Get tree entries for find repo files.

* Move find files JS to individual file.

* gen swagger.

* Add enry.IsVendor to exclude entries

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoPrevent NPE whilst migrating if there is a team request review (#19855)
zeripath [Thu, 9 Jun 2022 02:50:05 +0000 (03:50 +0100)]
Prevent NPE whilst migrating if there is a team request review (#19855)

A pr.Reviewer may be nil when migrating from Gitea if this is a team
request review.

We do not migrate teams therefore we cannot map these requests, but we can
migrate user requests.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
Lauris BH [Thu, 9 Jun 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd support for rendering terminal output with colors (#19497)
Lauris BH [Wed, 8 Jun 2022 21:46:39 +0000 (00:46 +0300)]
Add support for rendering terminal output with colors (#19497)

2 years agoFix viewed images not loading in a PR (#19919)
wxiaoguang [Wed, 8 Jun 2022 17:19:06 +0000 (01:19 +0800)]
Fix viewed images not loading in a PR (#19919)

Close #19651

2 years agoRemove out-dated comments (#19921)
wxiaoguang [Wed, 8 Jun 2022 17:17:44 +0000 (01:17 +0800)]
Remove out-dated comments (#19921)

2 years agoAutomatically render wiki TOC (#19873)
zeripath [Wed, 8 Jun 2022 08:59:16 +0000 (09:59 +0100)]
Automatically render wiki TOC (#19873)

Automatically add sidebar in the wiki view containing a TOC for the wiki page.
Make the TOC collapsable

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoImprove wording on delete access token modal (#19909)
André Jaenisch [Wed, 8 Jun 2022 00:28:10 +0000 (02:28 +0200)]
Improve wording on delete access token modal (#19909)

This PR highlights the nature of the destructive action.
It also rewords the action buttons to remove ambiguity.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Wed, 8 Jun 2022 00:10:16 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd breaking email restrictions checker in doctor (#19903)
Gusted [Tue, 7 Jun 2022 20:51:33 +0000 (22:51 +0200)]
Add breaking email restrictions checker in doctor (#19903)

* Add breaking change check in doctor

- This patch introduces a new kind of doctor type, breaking. This file
is made to register checks that helps with detecting when a breaking
change might impact a Gitea instance.
- For now the only check here(and the reason of creating this) is to
check if all users in the database has a valid email address, which
might not be the case after
https://github.com/go-gitea/gitea/pull/17688. This _simply_ uses the
validation function to detect and report these cases.
- Helps admins with detecting #19897.
- I have no clue which priority should be and IsDefault is true, because
when breaking change happen and we have a doctor check for it, we can
say "run `gitea doctor` to help you with this and maybe you find other
errors :wink:".

* Makes no sense tbh

* Fix copyright

* Update modules/doctor/breaking.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoEnsure minimum mirror interval is reported on settings page (#19895)
zeripath [Tue, 7 Jun 2022 17:40:12 +0000 (18:40 +0100)]
Ensure minimum mirror interval is reported on settings page (#19895)

* Ensure minimum mirror interval is reported on settings page

Expecting users to guess the minimum mirror interval appears a little unkind.
In this PR we simply change the locale string to include the minimum interval.
This will of course be affected by our current localization framework but...
we can fix that else where.

This PR also includes some fixes for error handling on the settings page as
previously the mirror block amongst others would simply disappear on error.

Fix #3737

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update options/locale/locale_en-US.ini

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update options/locale/locale_en-US.ini

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoImprove UX on modal for deleting an access token (#19894)
André Jaenisch [Tue, 7 Jun 2022 16:25:40 +0000 (18:25 +0200)]
Improve UX on modal for deleting an access token (#19894)

* Improve UX on modal for deleting an access token

Before, both action buttons where coloured on hover. Otherwise they
appeared as ghost buttons. UX tells us, that call to action must not
be displayed as ghost button.

Using red is perceived as warning colour in Western cultures. It was
used for the non-destructive action before. This PR swaps the colour
and turns the cancel button into a filled one, so it is saver to do
nothing then to accidentally delete an access button. We want the
person to do this consciously.

In another iteration the wording here could be improved. See the
associated issue for further details.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
* Use tabs instead of spaces.

Linter does not complain anymore. I was expecting the formatter to pick
this up but it didn't.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoupdate discord invite (#19907)
Eugene [Tue, 7 Jun 2022 15:40:27 +0000 (18:40 +0300)]
update discord invite (#19907)

2 years agoOnly log non ErrNotExist errors in git.GetNote (#19884)
Lunny Xiao [Tue, 7 Jun 2022 08:39:50 +0000 (16:39 +0800)]
Only log non ErrNotExist errors in git.GetNote  (#19884)

* Fix GetNote

* Only log errors if the error is not ErrNotExist

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Tue, 7 Jun 2022 00:10:19 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate frontend guideline (#19901)
wxiaoguang [Mon, 6 Jun 2022 14:44:20 +0000 (22:44 +0800)]
Update frontend guideline (#19901)

* update frontend guideline

* "Native" => "Vanilla JS", fix typo comma.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoMake AppDataPath absolute against the AppWorkPath if it is not (#19815)
zeripath [Mon, 6 Jun 2022 14:43:17 +0000 (15:43 +0100)]
Make AppDataPath absolute against the AppWorkPath if it is not (#19815)

* Make AppDataPath absolute against the AppWorkPath if it is not

There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.

This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.

Ref #19367

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* absolute workpath against pwd instead of app path first

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoMove some repository related code into sub package (#19711)
Lunny Xiao [Mon, 6 Jun 2022 08:01:49 +0000 (16:01 +0800)]
Move some repository related code into sub package (#19711)

* Move some repository related code into sub package

* Move more repository functions out of models

* Fix lint

* Some performance optimization for webhooks and others

* some refactors

* Fix lint

* Fix

* Update modules/repository/delete.go

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

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

Co-authored-by: delvh <dev.lh@web.de>
2 years agoA minimal change to replace data calls with attr as per guidelines (#19900)
André Jaenisch [Mon, 6 Jun 2022 04:58:53 +0000 (06:58 +0200)]
A minimal change to replace data calls with attr as per guidelines (#19900)

This affects the manage topics on a repository.
Namely the done button once changes are made.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoModernize JS build scripts (#19824)
silverwind [Mon, 6 Jun 2022 03:27:25 +0000 (05:27 +0200)]
Modernize JS build scripts (#19824)

- Remove __dirname, use file URLs instead
- Upgrade fabric dependency
- Use fs/promises syntax, this breaks node 12 but we require 14 already

The change in public/img/favicon.svg is not caused by the fabric
upgrade, but it seems it was not properly generated when introduced.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Wim [Mon, 6 Jun 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate MAINTAINERS (#19896)
Wim [Sun, 5 Jun 2022 19:55:08 +0000 (21:55 +0200)]
Update MAINTAINERS (#19896)

Added myself as maintainer
[List of PRs](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3A42wim+is%3Aclosed)

2 years agoAdd alt text to logo (#19892)
André Jaenisch [Sun, 5 Jun 2022 09:41:51 +0000 (11:41 +0200)]
Add alt text to logo (#19892)

The recommended way is to use the name of the organisation followed
by "logo". however, since this is my first contribution, I am not
entirely sure, whether this is the best approach here.

The organisation is different from the organisation you can create as
part of the application. Instead, it is more related to the site
hosting the instance. Plus, I don't know how to best handle it when
the logo image is swapped out. Therefore, I use plain "Logo" and hope
that the person visiting the site has enough context.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoLimit max-height of CodeMirror editors for issue comment and wiki (#18271)
Martijn de Boer [Sun, 5 Jun 2022 08:09:50 +0000 (10:09 +0200)]
Limit max-height of CodeMirror editors for issue comment and wiki (#18271)

* Make the wiki editor bar sticky for longer wiki edits

On codeberg community it was requested to make the wiki editor toolbar sticky for longer wiki posts, so one wouldn't have to scroll to the top to use it. (Reference; https://codeberg.org/Codeberg/Community/issues/533).

In order to make this happen, the .editor-toolbar class needs to become position: sticky, and we need to fix it's transparent background and border-bottom. Because the bottom disappears, we add it. This makes the border become a double border, because the CodeMirror area defines borders for all. As such I've added a border-top: none, on the wiki write tab for the CodeMirror class.

* Make the issue bar in the issue view sticky for issue #10675

In issue #10675 it's requested to make the issue bar sticky upon scrolling in the issue view. The proposed change changes inline html, which is not desirable. As such I've added the position sticky option to it's container, and fix the background upon scrolling.

* Make linter happy on _repository.less

Fix 0px -> 0 to make the linter happy.

* Make linter happy on _editor.less

Fix 0px -> 0 to make the linter happy.

* Change z-index to the lowest boundary of 1

As per review of @silverwind change the z-index to it's lowest requirement of 1.

* Change z-index to the lowest boundary of 1

As per review of @silverwind change the z-index to it's lowest requirement of 1.

* Revert changes made to wiki editor (unsticky) and add max-height

Fixes the max-height to 85vh, on the proposed 90vh it just came out just slightly too large.
Unstickies the changes from the sticky commits.

* Revert changes for the sticky title editor

Removes the changes as done by the sticky title editor.

* Add max-height definition to CodeMirror-scroll

Add the max-height definition for the CodeMirror-scroll class in order to generalize the changes spoken about in PR #18271

* Remove CodeMirror-scroll definition

Remove the max-height in CodeMirror-scroll definition, in order to generalize it in the CodeMirror less file. As per discussion in #18271.

* fine tune CodeMirror min-height/max-height

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoImplement http signatures support for the API (#17565)
Wim [Sun, 5 Jun 2022 07:16:14 +0000 (09:16 +0200)]
Implement http signatures support for the API (#17565)

Fixes #12338

This allows use to talk to the API with our ssh certificate (and/or ssh-agent) without needing to fetch an API key or tokens.
It will just automatically work when users have added their ssh principal in gitea.

This needs client code in tea
Update: also support normal pubkeys

ref: https://tools.ietf.org/html/draft-cavage-http-signatures

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIncrement tests time out from 40m to 50m because sometimes the machine is slow (...
Lunny Xiao [Sun, 5 Jun 2022 04:24:51 +0000 (12:24 +0800)]
Increment tests time out from 40m to 50m because sometimes the machine is slow (#19887)

2 years agofix(CI/CD): correct CI variable. (#19886)
Bo-Yi Wu [Sun, 5 Jun 2022 02:42:24 +0000 (10:42 +0800)]
fix(CI/CD): correct CI variable. (#19886)

default value is true for CI variable

see https://docs.drone.io/pipeline/environment/reference/ci/

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix typo (#19889)
Gusted [Sat, 4 Jun 2022 21:43:25 +0000 (21:43 +0000)]
Fix typo (#19889)

2 years agoFixing wrong paging when filtering on the issue dashboard (#19801)
Mai-Lapyst [Sat, 4 Jun 2022 20:12:14 +0000 (22:12 +0200)]
Fixing wrong paging when filtering on the issue dashboard (#19801)

Fixes #19791 by adding an check if filtering after any repo; if yes, simply set the total count for the pageing to the sum of the issue count for each selected repo by utilize `issueCountByRepo`.

Fix #19791

2 years agoMove `/info` outside authorization (#19888)
Gusted [Sat, 4 Jun 2022 20:10:54 +0000 (20:10 +0000)]
Move `/info` outside authorization (#19888)

- To use the web's API to get information about a issue/pull on a
repository, doesn't require authorization(nor that the repository isn't
archived).
- Regressed by: #19318

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years agoFix order by parameter (#19849)
Lunny Xiao [Sat, 4 Jun 2022 19:18:50 +0000 (03:18 +0800)]
Fix order by parameter (#19849)

Upgrade builder to v0.3.11
Upgrade xorm to v1.3.1 and fixed some hidden bugs.

Replace #19821
Replace #19834
Included #19850

Co-authored-by: zeripath <art27@cantab.net>
2 years agoExclude Archived repos from Dashboard Milestones (#19882)
zeripath [Sat, 4 Jun 2022 18:30:01 +0000 (19:30 +0100)]
Exclude Archived repos from Dashboard Milestones (#19882)

Milestones in archived repos should not be displayed on `/milestones`. Therefore
we should exclude these repositories from milestones page.

Fix #18257

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agouse exact search instead of fuzzy search for branch filter dropdown (#19885)
wxiaoguang [Sat, 4 Jun 2022 16:02:10 +0000 (00:02 +0800)]
use exact search instead of fuzzy search for branch filter dropdown (#19885)

2 years agoAdd API to serve blob or LFS file content (#19689)
qwerty287 [Sat, 4 Jun 2022 13:17:53 +0000 (15:17 +0200)]
Add API to serve blob or LFS file content (#19689)

* Add LFS API

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Apply suggestions

* Apply suggestions

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Report errors

* ADd test

* Use own repo for test

* Use different repo name

* Improve handling

* Slight restructures

1. Avoid reading the blob data multiple times
2. Ensure that caching is only checked when about to serve the blob/lfs
3. Avoid nesting by returning early
4. Make log message a bit more clear
5. Ensure that the dataRc is closed by defer when passed to ServeData

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDisable unnecessary mirroring elements (#18527)
Paweł Bogusławski [Sat, 4 Jun 2022 11:42:17 +0000 (13:42 +0200)]
Disable unnecessary mirroring elements (#18527)

* Disable unnecessary mirroring elements

This mod fixes disabling unnecessary mirroring elements.

Related: https://github.com/go-gitea/gitea/pull/16957
Related: https://github.com/go-gitea/gitea/pull/13084
Author-Change-Id: IB#1105104

* Checkbox rendering disabled instead of hiding it

Fixes: 02b45051503d4330da9757ff084c9cc5e6e60d84
Related: https://github.com/go-gitea/gitea/pull/18527#pullrequestreview-878061913
Author-Change-Id: IB#1105104

* Update custom/conf/app.example.ini

Co-authored-by: silverwind <me@silverwind.io>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: silverwind <me@silverwind.io>
* Mirror filter removed only when whole mirroring feature is disabled

Fixes: 02b45051503d4330da9757ff084c9cc5e6e60d84
Related: https://github.com/go-gitea/gitea/pull/18527#discussion_r883268890
Author-Change-Id: IB#1105104

Co-authored-by: silverwind <me@silverwind.io>
2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Sat, 4 Jun 2022 00:10:09 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemove customized (unmaintained) dropdown, improve aria a11y for dropdown (#19861)
wxiaoguang [Fri, 3 Jun 2022 21:38:26 +0000 (05:38 +0800)]
Remove customized (unmaintained) dropdown, improve aria a11y for dropdown (#19861)

* Remove customized (unmaintained) dropdown, improve aria a11y for dropdown

* fix repo permission

* use action instead of onChange

* re-order the CSS selector

* fix dropdown behavior for repo permissions, make elements inside menu item non-focusable

* use menu/menuitem instead of combobox/option. use tooltip(data-content) for aria-label, prevent from repeated attaching

* click menu item when pressing Enter

* code format

* fix repo permission

* repo setting: prevent from misleading users when error occurs

* fine tune the repo collaboration access mode dropdown (in case the access mode is undefined in the template)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoSet Setpgid on child git processes (#19865)
zeripath [Fri, 3 Jun 2022 14:36:18 +0000 (15:36 +0100)]
Set Setpgid on child git processes (#19865)

When Gitea is running as PID 1 git will occassionally orphan child processes leading
to (defunct) processes. This PR simply sets Setpgid to true on these child processes
meaning that these defunct processes will also be correctly reaped.

Fix #19077

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAllow postgres integration tests to run over unix pipe (#19875)
zeripath [Fri, 3 Jun 2022 06:14:09 +0000 (07:14 +0100)]
Allow postgres integration tests to run over unix pipe (#19875)

2 years agoimprovement some release related code (#19867)
Lunny Xiao [Fri, 3 Jun 2022 06:13:58 +0000 (14:13 +0800)]
improvement some release related code (#19867)

2 years agofeat: add DEFAULT_MERGE_STYLE to `repository.pull-request` section for repo init...
ttys3 [Fri, 3 Jun 2022 03:45:54 +0000 (11:45 +0800)]
feat: add DEFAULT_MERGE_STYLE to `repository.pull-request` section for repo init (#19751)

2 years ago[skip ci] Updated translations via Crowdin
zeripath [Fri, 3 Jun 2022 00:11:14 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPrevent NPE on update mirror settings (#19864)
zeripath [Thu, 2 Jun 2022 16:56:32 +0000 (17:56 +0100)]
Prevent NPE on update mirror settings (#19864)

A `repo_model.Mirror` repository field (`.Repo`) will not automatically
be set, but is used without checking in mirror_pull.go:UpdateAddress.
This will cause an NPE.

This PR changes UpdateAddress to use the helper function GetRepository()
helping prevent future NPEs but also changes modules/context/repo.go to
ensure that the Mirror.Repo is set.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoupdate documents (#19868)
wxiaoguang [Thu, 2 Jun 2022 04:22:42 +0000 (12:22 +0800)]
update documents (#19868)

2 years agoOnly return valid stopwatches (#19863)
zeripath [Thu, 2 Jun 2022 02:36:46 +0000 (03:36 +0100)]
Only return valid stopwatches (#19863)

Looking through the logs of try.gitea.io I am seeing a number of reports
of being unable to APIformat stopwatches because the issueID is 0. These
are invalid StopWatches and they represent a db inconsistency.

This PR simply stops sending them to the eventsource.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
zeripath [Thu, 2 Jun 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd title attribute to dependencies in sidebar (#19807)
zeripath [Wed, 1 Jun 2022 19:08:34 +0000 (20:08 +0100)]
Add title attribute to dependencies in sidebar (#19807)

* Add title attribute to dependencies in sidebar

Add the full title as the title attribute on dependencies in
the sidebar.

Fix #19806

Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per silverwind

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix spelling mistake in ProcReceive (#19853)
zeripath [Wed, 1 Jun 2022 03:06:31 +0000 (04:06 +0100)]
Fix spelling mistake in ProcReceive (#19853)

There was a spelling mistake in the ProcReceive handler. This PR fixes
this.

2 years agoEnsure responses are context.ResponseWriters (#19843)
zeripath [Tue, 31 May 2022 20:27:44 +0000 (21:27 +0100)]
Ensure responses are context.ResponseWriters (#19843)

In order for web.Wrap to be able to detect if a response has been written
we need to wrap any non-context.ResponseWriters as a such. Otherwise
responses will be incorrectly detected as non-written to and handlers can
double run.

In the case of GZip this handler will change the response to a non-context.RW
and this failure to correctly detect response writing causes fallthrough and
a NPE.

Fix #19839

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix inconsistency in doctor output (#19836)
Gusted [Tue, 31 May 2022 18:49:40 +0000 (18:49 +0000)]
Fix inconsistency in doctor output (#19836)

* Fix inconsistency in doctor output

- Use `logger.Info` instead of `logger.Warn` when no errors were found.

* Update modules/doctor/fix16961.go

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agodocs: recommendations to ensure backup consistency and reliability (#19845)
singuliere [Tue, 31 May 2022 18:42:32 +0000 (20:42 +0200)]
docs: recommendations to ensure backup consistency and reliability (#19845)

* docs: recommendations to ensure backup consistency and reliability

* s/stooping/stopping/

* Update docs/content/doc/usage/backup-and-restore.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: delvh <dev.lh@web.de>
2 years agofeat: Add support for extra sshd_config parameters via 'Include' file (#19842)
Thomas Andrade [Tue, 31 May 2022 18:42:19 +0000 (20:42 +0200)]
feat: Add support for extra sshd_config parameters via 'Include' file (#19842)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 31 May 2022 00:10:30 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agodocs: update the ROOT documentation and error messages (#19832)
singuliere [Mon, 30 May 2022 22:47:55 +0000 (00:47 +0200)]
docs: update the ROOT documentation and error messages (#19832)

* docs: update the ROOT documentation and error messages

* The documentation now reflects what happens in the
  setting/repository.go::newRepository function:
  filepath.Join(AppWorkPath, RepoRootPath) was missing.

* The error message displayed when RepoRootPath is not found now
  displays the value of RepoRootPath. Given the complexity of the
  construction of this value, only referring to it in the abstract
  is likely to be misleading to the Gitea admin trying to interpret
  the message.

Co-authored-by: delvh <dev.lh@web.de>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 30 May 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd version hint in the docs when packages are available (#19838)
delvh [Sun, 29 May 2022 18:10:21 +0000 (20:10 +0200)]
Add version hint in the docs when packages are available (#19838)

* Add version hint in the docs when packages are available

* Change italic to bold

2 years agodocs(hacking-on-gitea): fix installation instruction for elasticsearch docker (#19829)
Yehonatan Ezron [Sun, 29 May 2022 17:59:25 +0000 (20:59 +0300)]
docs(hacking-on-gitea): fix installation instruction for elasticsearch docker (#19829)

2 years agoFix i18n for Link Account button, re-format tmpl (#19835)
wxiaoguang [Sun, 29 May 2022 08:19:56 +0000 (16:19 +0800)]
Fix i18n for Link Account button, re-format tmpl (#19835)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 29 May 2022 00:10:54 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin