]> source.dussan.org Git - gitea.git/log
gitea.git
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

2 years agoAdding button to link accounts from user settings (#19792)
Mai-Lapyst [Sun, 29 May 2022 00:03:17 +0000 (02:03 +0200)]
Adding button to link accounts from user settings (#19792)

* Adding button to link accounts from user settings

* Only display button to link user accounts when at least one OAuth2 provider is active

2 years agofix(telegram): fix link bot to release tag (#19830)
Yehonatan Ezron [Sat, 28 May 2022 20:44:51 +0000 (23:44 +0300)]
fix(telegram): fix link bot to release tag (#19830)

* fix(telegram): fix link bot to release tag

* test(webhook): fix matrixPayload Release

* test(webhook): fix TestTelegramPayload Release

2 years agoFix raw endpoint PDF file headers (#19825)
Lauris BH [Sat, 28 May 2022 15:10:14 +0000 (18:10 +0300)]
Fix raw endpoint PDF file headers (#19825)

2 years agodocs: FAQ: the WorkPath can be set from --work-path (#19822)
singuliere [Sat, 28 May 2022 08:47:13 +0000 (10:47 +0200)]
docs: FAQ: the WorkPath can be set from --work-path (#19822)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 28 May 2022 00:10:25 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix duplicate paragraph in documentation (#19820)
Vladimir Yakovlev [Fri, 27 May 2022 19:40:00 +0000 (22:40 +0300)]
Fix duplicate paragraph in documentation (#19820)

2 years agoMake WIP prefixes case insensitive, e.g. allow `Draft` as a WIP prefix (#19780)
Ondřej Čertík [Thu, 26 May 2022 09:19:24 +0000 (03:19 -0600)]
Make WIP prefixes case insensitive, e.g. allow `Draft` as a WIP prefix (#19780)

The issue was that only the actual title was converted to uppercase, but
not the prefix as specified in `WORK_IN_PROGRESS_PREFIXES`. As a result,
the following did not work:

    WORK_IN_PROGRESS_PREFIXES=Draft:,[Draft],WIP:,[WIP]

One possible workaround was:

    WORK_IN_PROGRESS_PREFIXES=DRAFT:,[DRAFT],WIP:,[WIP]

Then indeed one could use `Draft` (as well as `DRAFT`) in the title.
However, the link `Start the title with DRAFT: to prevent the pull request
from being merged accidentally.` showed the suggestion in uppercase; so
it is not possible to show it as `Draft`. This PR fixes it, and allows
to use `Draft` in `WORK_IN_PROGRESS_PREFIXES`.

Fixes #19779.

Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix follower display on user page (#19805)
silverwind [Wed, 25 May 2022 16:29:40 +0000 (18:29 +0200)]
Fix follower display on user page (#19805)

2 years agoShow source/target branches on PR's list (#19747)
IT-AlexKor [Wed, 25 May 2022 13:33:35 +0000 (16:33 +0300)]
Show source/target branches on PR's list (#19747)

Add ability to show source/target branches for Pull Request's list. It can be useful to see which branches are used in each PR right in the list.

Co-authored-by: Alexey Korobkov <akorobkov@cian.ru>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoGithub style following followers (#19482)
istiak101 [Wed, 25 May 2022 11:45:45 +0000 (17:45 +0600)]
Github style following followers (#19482)

Removed tabbed following and followers from user page and added Github style following followers.

2 years agoalpine 3.16 (#19797)
techknowlogick [Wed, 25 May 2022 04:42:28 +0000 (00:42 -0400)]
alpine 3.16 (#19797)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoPrevent loop if there is an error in GetNotificationCount (#19799)
zeripath [Wed, 25 May 2022 00:51:53 +0000 (01:51 +0100)]
Prevent loop if there is an error in GetNotificationCount (#19799)

If the context is cancelled `.NotificationUnreadCount` in a template can
cause an infinite loop with `ctx.ServerError()` being called, which
creates a template that then calls `.NotificationUnreadCount` calling
`GetNotificationCount()` with the cancelled context resulting in an
error that calls `ctx.ServerError`... and so on...

This PR simply stops calling `ctx.ServerError` in the error handler code
for `.NotificationUnreadCount` as we have already started rendering and
so it is too late to call `ctx.ServerError`. Additionally we skip
logging the error if it's a context cancelled error.

Fix #19793

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoAdd 'make tidy' (#19800)
silverwind [Wed, 25 May 2022 00:19:13 +0000 (02:19 +0200)]
Add 'make tidy' (#19800)

Convenience command to run 'go mod tidy'. The compat flag is set to the
minimum supported go version instead of min version minus one which is
go's default, which eliminated some checksums in go.sum as a result.

2 years agoUpdate document to use FHS `/usr/local/bin/gitea` instead of `/app/...` for Docker...
wxiaoguang [Tue, 24 May 2022 06:57:15 +0000 (14:57 +0800)]
Update document to use FHS `/usr/local/bin/gitea` instead of `/app/...` for Docker (#19794)

* Update document to use FHS `/usr/local/bin/gitea` instead of `/app/...` in Docker

* Update docs/content/doc/installation/with-docker.zh-cn.md

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

2 years agoAdd the possibility to allow the user to have a favicon which differs from the main...
Jan-Eric Schober [Mon, 23 May 2022 15:54:48 +0000 (17:54 +0200)]
Add the possibility to allow the user to have a favicon which differs from the main logo (#18542)

* Changed the filename of the favicon SVG

This allows the user to have a favicon which differs from the logo.

* Added favicon.svg

This is needed to accommodate the changes for allowing the user to have a differing logo and favicon

* Adjusted page to accommodate what icon is used as favicon

* Added functionality to also generate the favicon.svg via generate-images.js

* Adjusted the description for the new favicon compatibility

Co-authored-by: silverwind <me@silverwind.io>
* Updated generate-images.js to generate favicons from a separate favicons.svg file

This belongs to PR #18542.

* Added description on how custom favicons can be generated

* Replaced space indents with tabs

* Synced changes with current state of the file

* Synced changes with current state of the file

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 23 May 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 22 May 2022 00:10:22 +0000 (00:10 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoEstimate Action Count in Statistics (#19775)
zeripath [Sat, 21 May 2022 18:50:50 +0000 (19:50 +0100)]
Estimate Action Count in Statistics (#19775)

2 years agoPrevent NPE when cache service is disabled (#19703)
zeripath [Sat, 21 May 2022 14:29:49 +0000 (15:29 +0100)]
Prevent NPE when cache service is disabled (#19703)

The cache service can be disabled - at which point ctx.Cache will be nil
and the use of it will cause an NPE.

The main part of this PR is that the cache is used for restricting
resending of activation mails and without this we cache we cannot
restrict this. Whilst this code could be re-considered to use the db and
probably should be, I think we can simply disable this code in the case
that the cache is disabled.

There are also several bug fixes in the /nodeinfo API endpoint.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDetect truncated utf-8 characters at the end of content as still representing utf...
zeripath [Sat, 21 May 2022 13:06:24 +0000 (14:06 +0100)]
Detect truncated utf-8 characters at the end of content as still representing utf-8 (#19773)

Our character detection algorithm can potentially incorrectly detect utf-8 as iso-8859-x
if there is a truncated character at the end of the partially read file.

This PR changes the detection algorithm to truncated utf8 characters at the end of the
buffer.

Fix #19743

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd silentcodeg to MAINTAINERS (#19771)
silentcodeg [Sat, 21 May 2022 12:09:37 +0000 (14:09 +0200)]
Add silentcodeg to MAINTAINERS (#19771)

* Add silentcodeg to MAINTAINERS

* add missing trailing g to chat nick

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAllows repo search to match against "owner/repo" pattern strings (#19754)
Eekle [Sat, 21 May 2022 09:15:40 +0000 (10:15 +0100)]
Allows repo search to match against "owner/repo" pattern strings (#19754)

* Allows repo search to match against "owner/repo" pattern strings

* Gofumpt

* Adds test case for "owner/repo" style repo search

* With "owner/repo" search terms, prioritise results which match the owner field

* Fixes unquoted SQL string in repo search

2 years agoUpdate JS dependencies (#19767)
silverwind [Sat, 21 May 2022 01:10:03 +0000 (03:10 +0200)]
Update JS dependencies (#19767)

- Update all JS dependencies minus Vue
- Tested mermaid, swagger, build

Co-authored-by: 6543 <6543@obermui.de>
2 years agoNuke the incorrect permission report on /api/v1/notifications (#19761)
zeripath [Fri, 20 May 2022 16:57:49 +0000 (17:57 +0100)]
Nuke the incorrect permission report on /api/v1/notifications (#19761)

The permissions created in convertRepo use a minimal perm.AccessModeRead instead of
correctly computing the permission for the repository. This incorrect permission is
then reported to the user.

I do not believe that reporting the permissions is helpful and therefore I propose
we simply null these out. The user can check their permissions using a different
endpoint.

Fix #19759

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoMove almost all functions' parameter db.Engine to context.Context (#19748)
Lunny Xiao [Fri, 20 May 2022 14:08:52 +0000 (22:08 +0800)]
Move almost all functions' parameter db.Engine to context.Context (#19748)

* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions

2 years agoMove org functions (#19753)
Lunny Xiao [Fri, 20 May 2022 10:20:51 +0000 (18:20 +0800)]
Move org functions (#19753)

* Move org functions

* Fix comment

2 years ago[doctor] pq: syntax error at or near "." quote user table name (#19765)
silentcodeg [Fri, 20 May 2022 07:36:34 +0000 (09:36 +0200)]
[doctor] pq: syntax error at or near "." quote user table name (#19765)