]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoAdded auto-save whitespace behavior if it changed manually (#15566)
Viktor Suprun [Tue, 8 Feb 2022 06:15:04 +0000 (17:15 +1100)]
Added auto-save whitespace behavior if it changed manually (#15566)

2 years agoSupport custom ACME provider (#18340)
Cristian Le [Tue, 8 Feb 2022 05:45:35 +0000 (14:45 +0900)]
Support custom ACME provider (#18340)

* Added ACMECAURL option to support custom ACME provider. Closes #18306
* Refactor setting.go https settings, renamed options and variables, and documented app.example.ini
* Refactored runLetsEncrypt to runACME
* Improved documentation

2 years agoRefactor i18n, use Locale to provide i18n/translation related functions (#18648)
wxiaoguang [Tue, 8 Feb 2022 03:02:30 +0000 (11:02 +0800)]
Refactor i18n, use Locale to provide i18n/translation related functions (#18648)

* remove unnecessary web context data fields, and unify the i18n/translation related functions to `Locale`
* in development, show an error if a translation key is missing
* remove the unnecessary loops `for _, lang := range translation.AllLangs()` for every request, which improves the performance slightly
* use `ctx.Locale.Language()` instead of `ctx.Data["Lang"].(string)`
* add more comments about how the Locale/LangType fields are used

2 years agoOnly request write when necessary (#18657)
Gusted [Tue, 8 Feb 2022 01:34:37 +0000 (02:34 +0100)]
Only request write when necessary (#18657)

* Only request write when necessary

- Only request write for `INTERNAL_TOKEN_URI` when no token was found.
- Resolves #18655

* Fix perm

* Update setting.go

* Update setting.go

* Update setting.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 8 Feb 2022 00:15:59 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd separate SSH_USER config option (#17584)
Clar Fon [Mon, 7 Feb 2022 21:56:45 +0000 (16:56 -0500)]
Add separate SSH_USER config option (#17584)

Co-authored-by: zeripath <art27@cantab.net>
2 years agoBe more lenient with label colors (#17752)
Clar Fon [Mon, 7 Feb 2022 21:21:02 +0000 (16:21 -0500)]
Be more lenient with label colors (#17752)

Accept 12-bit color specifications.

2 years agoremove redundant call to UpdateRepoStats during migration (#18591)
singuliere [Mon, 7 Feb 2022 15:43:08 +0000 (16:43 +0100)]
remove redundant call to UpdateRepoStats during migration (#18591)

There is no need to call UpdateRepoStats in the InsertIssues and
InsertPullRequests function. They are only called during migration by
the CreateIssues and CreateReviews methods of the gitea uploader.

The UpdateRepoStats function will be called by the Finish method of
the gitea uploader after all reviews and issues are inserted. Calling
it before is therefore redundant and the associated SQL requests are
not cheap.

The statistics tests done after inserting an issue or a pull request
are also removed. They predate the implementation of UpdateRepoStats,
back when the calculation of the statistics was an integral part of
the migration function. The UpdateRepoStats is now tested
independantly and these tests are no longer necessary.

Signed-off-by: singuliere <singuliere@autistici.org>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agomore repo dump/restore tests, including pull requests (#18621)
singuliere [Mon, 7 Feb 2022 14:11:55 +0000 (15:11 +0100)]
more repo dump/restore tests, including pull requests (#18621)

The tests were refactored so that all YAML files content are checked,
unless an exception is set (for instance for the Updated field which
is automatically updated by the database and cannot be expected to be
identical over a dump/restore/dump round.

This approach helps catch more errors where fields are added in the
migration files because they do not need to be added to the tests to
be verified.

It also helps as a reminder of what is left to be implemented, such as
the the Assignees field in issues.

A helper is added to keep the tests DRY and facilitate their
maintenance.

Signed-off-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoNo longer show the db-downgrade SQL in production (#18653)
wxiaoguang [Mon, 7 Feb 2022 10:04:12 +0000 (18:04 +0800)]
No longer show the db-downgrade SQL in production (#18653)

* make messages more friendly

2 years agoFix the missing i18n key for update checker (#18646)
wxiaoguang [Mon, 7 Feb 2022 07:43:53 +0000 (15:43 +0800)]
Fix the missing i18n key for update checker (#18646)

2 years agoUpdate gitea-vet (#18640)
Gusted [Sun, 6 Feb 2022 21:45:00 +0000 (22:45 +0100)]
Update gitea-vet (#18640)

* Update gitea-vet

- Update gitea-vet to include latest 2 changes
https://gitea.com/gitea/gitea-vet/compare/7c98703580bef612b10f6a603883052f79acf9c0...master

* Tidy up go.sum

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFuture proof for 1.18 (#18644)
Gusted [Sun, 6 Feb 2022 20:38:14 +0000 (21:38 +0100)]
Future proof for 1.18 (#18644)

- Update json-iterator/go to handle 1.18's new memory model with slices.
- Don't panic while running gitea with go 1.18

2 years agoAdd `contrib/upgrade.sh` (#18286)
Norwin [Sun, 6 Feb 2022 20:07:52 +0000 (21:07 +0100)]
Add `contrib/upgrade.sh` (#18286)

Adds an upgrade script that automates upgrading installations on Linux from binary releases, so people don't need to reinvent the wheel. Hopefully this leads to less questions about how to upgrade, and consequently less Gitea instances running unmaintained versions in the wild.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoIf rendering has failed due to a net.OpError stop rendering (#18642)
zeripath [Sun, 6 Feb 2022 19:28:25 +0000 (19:28 +0000)]
If rendering has failed due to a net.OpError stop rendering (#18642)

When a net.OpError occurs during rendering the underlying connection is essentially
dead and therefore attempting to render further data will only cause further errors.

Therefore in serverErrorInternal detect if the passed in error is an OpError and
if so do not attempt any further rendering.

Fix #18629

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDelete old git.NewCommand() and use it as git.NewCommandContext() (#18552)
6543 [Sun, 6 Feb 2022 19:01:47 +0000 (20:01 +0100)]
Delete old git.NewCommand() and use it as git.NewCommandContext() (#18552)

2 years agoUpdate JS dependencies (#18636)
silverwind [Sun, 6 Feb 2022 17:53:29 +0000 (09:53 -0800)]
Update JS dependencies (#18636)

2 years agofix commits_list_small.tmpl (#18641)
a1012112796 [Sun, 6 Feb 2022 16:58:32 +0000 (00:58 +0800)]
fix commits_list_small.tmpl (#18641)

Signed-off-by: a1012112796 <1012112796@qq.com>
2 years agoFix `make fmt` and `make fmt-check` (#18633)
silverwind [Sun, 6 Feb 2022 15:44:30 +0000 (07:44 -0800)]
Fix `make fmt` and `make fmt-check` (#18633)

* Run 'make fmt'

'make fmt' currently produces this change, I'm not sure how CI did not
fail on it, I made sure I have `mvdan.cc/gofumpt@latest`.

* Fix 'make fmt-check'

`make fmt-check` did not run all commands that `make fmt` did, resulting
in missed diffs. Fix that by just depending on the `fmt` target.

Includes: https://github.com/go-gitea/gitea/pull/18633

* Make gitea-fmt work with -l and -d and integrate gofumpt

This implements -l, -w and -d with gitea-fmt and merges gofumpt.

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

* use -l instead of -d for fmt-check

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years agoFrontport of changelog for v1.16.1 (#18615)
Lunny Xiao [Sun, 6 Feb 2022 13:38:20 +0000 (21:38 +0800)]
Frontport of changelog for v1.16.1 (#18615)

* Add changelog for v1.16.1

* Update 1.16.1

2 years agoPass correct context (#18638)
Gusted [Sun, 6 Feb 2022 12:05:07 +0000 (13:05 +0100)]
Pass correct context (#18638)

- Pass the correct context into `db.GetEngine()`.
- Introduced in: https://github.com/go-gitea/gitea/pull/18604

2 years agocomments on migrated issues/prs must link to the comment ID (#18630)
singuliere [Sun, 6 Feb 2022 10:59:12 +0000 (11:59 +0100)]
comments on migrated issues/prs must link to the comment ID (#18630)

Instead of the issue ID which is not a valid anchor.

Signed-off-by: singuliere <singuliere@autistici.org>
2 years agopreserve users if restoring a repository on the same Gitea instance (#18604)
singuliere [Sun, 6 Feb 2022 09:05:29 +0000 (10:05 +0100)]
preserve users if restoring a repository on the same Gitea instance (#18604)

When calling DumpRepository and RestoreRepository on the same Gitea
instance, the users are preserved: all labels, issues etc. belong to
the external user who is, in this particular case, the local user.

Dead code verifying g.gitServiceType.Name() == "" (i.e. plain git) is
removed. The function is never called because the plain git downloader
does not migrate anything that is associated to a user, by definition.

Errors returned by GetUserIDByExternalUserID are no longer ignored.

The userMap is used when the external user is not kown, which is the
most common case. It was only used when the external user exists
which happens less often and, as a result, every occurence of an
unknown external user required a SQL query.

Signed-off-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoStop logging an error when notes are not found (#18626)
zeripath [Sun, 6 Feb 2022 07:11:35 +0000 (07:11 +0000)]
Stop logging an error when notes are not found (#18626)

This is an unnecessary logging event.

Fix #18616

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 6 Feb 2022 00:16:02 +0000 (00:16 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoOnly attempt to flush queue if the underlying worker pool is not finished (#18593)
zeripath [Sat, 5 Feb 2022 20:51:25 +0000 (20:51 +0000)]
Only attempt to flush queue if the underlying worker pool is not finished (#18593)

* Only attempt to flush queue if the underlying worker pool is not finished

There is a possible race whereby a worker pool could be cancelled but yet the
underlying queue is not empty. This will lead to flush-all cycling because it
cannot empty the pool.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoquote MAKE to prevent path expansion with space error (#18622)
Kyle D [Sat, 5 Feb 2022 18:31:57 +0000 (11:31 -0700)]
quote MAKE to prevent path expansion with space error (#18622)

Pretty minor change to prevent error when `$(MAKE)` path is expanded with a space in the path.

```bash
$ TAGS="bindata sqlite sqlite_unlock_notify" make build
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `C:/Program Files (x86)/GnuWin32/bin/make -v | head -n 1'
```

I believe Program Files (x86) is the default path for GNU make on windows

2 years agoEnsure that blob-excerpt links work for wiki (#18587)
zeripath [Sat, 5 Feb 2022 18:26:12 +0000 (18:26 +0000)]
Ensure that blob-excerpt links work for wiki (#18587)

It appears that the blob-excerpt links do not work on the wiki - likely since their
introduction.

This PR adds support for the wiki on these links.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUse `CryptoRandomBytes` instead of `CryptoRandomString` (#18439)
Gusted [Fri, 4 Feb 2022 17:03:15 +0000 (18:03 +0100)]
Use `CryptoRandomBytes` instead of `CryptoRandomString` (#18439)

- Switch to use `CryptoRandomBytes` instead of `CryptoRandomString`, OAuth's secrets are copied pasted and don't need to avoid dubious characters etc.
- `CryptoRandomBytes` gives ![2^256 = 1.15 * 10^77](https://render.githubusercontent.com/render/math?math=2^256%20=%201.15%20\cdot%2010^77) `CryptoRandomString` gives ![62^44 = 7.33 * 10^78](https://render.githubusercontent.com/render/math?math=62^44%20=%207.33%20\cdot%2010^78) possible states.
- Add a prefix, such that code scanners can easily grep these in source code.
- 32 Bytes + prefix

2 years agoRemove the spurious space in the .ui.right additional selector (#18605)
zeripath [Fri, 4 Feb 2022 15:53:43 +0000 (15:53 +0000)]
Remove the spurious space in the .ui.right additional selector (#18605)

Somehow a spurious space sneaked in to #18538
this PR simply removes it.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoEnsure commit-statuses box is sized correctly in headers (#18538)
zeripath [Fri, 4 Feb 2022 15:21:51 +0000 (15:21 +0000)]
Ensure commit-statuses box is sized correctly in headers (#18538)

* Ensure commit-statuses box is sized correctly in headers

When viewing commits as commits the commit-status box will be fixed at 30px in height
due to being forced to be this size by a fomantic selector. This PR simply adds a
few more selectors to force this to have height auto.

Fix #18498

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update web_src/less/_repository.less

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 4 Feb 2022 00:16:04 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPrevent merge messages from being sorted to the top of email chains (#18566)
zeripath [Thu, 3 Feb 2022 23:01:16 +0000 (23:01 +0000)]
Prevent merge messages from being sorted to the top of email chains (#18566)

* Prevent merge messages from being sorted to the top of email chains

Gitea will currrently resend the same message-id for the closed/merged/reopened
messages for issues. This will cause the merged message to leap to the top of an
email chain and become out of sync.

This PR adds specific suffices for these actions.

Fix #18560

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix pushing to 1-x-dev docker tag (#18578)
zeripath [Thu, 3 Feb 2022 21:44:51 +0000 (21:44 +0000)]
Fix pushing to 1-x-dev docker tag (#18578)

* Fix pushing to 1-x-dev docker tag

It appears that #18551 and #18573 have a mistake in that raymond does not have
an {{else}} on {{#equal}}. This PR notes that Sprig has a hasPrefix function
and so we use this with another if.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix pushing to 1-x-dev docker tag (part 2)

Although we now have the manifest working, we need to create the images.

Here we adjust the .drone.yml to force building of the images

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix pushing to 1-x-dev docker tag

OK now we have the images building we should make sure that the main ones stays
dev and the release/v* ones become *-dev-*

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

2 years agoReplace `sync.Map` with normal maps (#18584)
Gusted [Thu, 3 Feb 2022 19:18:18 +0000 (20:18 +0100)]
Replace `sync.Map` with normal maps (#18584)

* Replace `sync.Map` with normal maps

- These maps aren't being used in any kind of concurrent read/write and
thus don't need `sync.Map` and can instead use normal maps.
- Special thanks to dachary.
- Added in: https://github.com/go-gitea/gitea/pull/6290

* Remove unannounced feature

2 years agoFix oauth docs usage for 2fa (#18581)
Sambhav Saggi [Thu, 3 Feb 2022 17:00:34 +0000 (12:00 -0500)]
Fix oauth docs usage for 2fa (#18581)

2 years agoUpdate .gitattributes for .tmpl files (#18576)
silverwind [Thu, 3 Feb 2022 15:30:26 +0000 (07:30 -0800)]
Update .gitattributes for .tmpl files (#18576)

There are a few .tmpl files outside the templates directory. Match these
as well by using `*.tmpl` glob in `.gitattributes`. Also, sort the file
alphabetically.

2 years agoPrevent panic on prohibited user login with oauth2 (#18562)
zeripath [Thu, 3 Feb 2022 10:44:18 +0000 (10:44 +0000)]
Prevent panic on prohibited user login with oauth2 (#18562)

There was an unfortunate regression in #17962 where following detection of the
UserProhibitLogin error the err is cast to a pointer by mistake.

This causes a panic due to an interface error.

Fix #18561

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix manifest.tmpl (#18573)
zeripath [Thu, 3 Feb 2022 09:51:01 +0000 (09:51 +0000)]
Fix manifest.tmpl (#18573)

A spurious {{/if}} appeared on the manifest.tmpl - this PR simply
removes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoMake docker gitea/gitea:v1.16-dev etc refer to the latest build on that branch (...
zeripath [Thu, 3 Feb 2022 08:47:27 +0000 (08:47 +0000)]
Make docker gitea/gitea:v1.16-dev etc refer to the latest build on that branch (#18551)

* Make docker gitea/gitea:v1.16-dev etc refer to the latest build on that branch

One of the problems with our current docker tagging is that although we
have strict version tags, latest and dev we do not have a way for docker
users to track the current release branch. This PR simply suggests that
we use the 1.x-dev tag for these and we build and push these. This will
give users who want or need unreleased bug fixes the option of tracking
the pre-release version instead of simply jumping to dev.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd dropdown icon to template loading dropdown (#18564)
fnetX (aka fralix) [Thu, 3 Feb 2022 08:13:22 +0000 (09:13 +0100)]
Add dropdown icon to template loading dropdown (#18564)

Fixes #15679 and the dupe of it: Fixes #16364.

Also removes a comment that links to a gogs forum thread.

2 years agoCollaborator trust model should trust collaborators (#18539)
zeripath [Wed, 2 Feb 2022 10:10:06 +0000 (10:10 +0000)]
Collaborator trust model should trust collaborators (#18539)

* Collaborator trust model should trust collaborators

There was an unintended regression in #17917 which leads to only
repository admin commits being trusted. This PR restores the old logic.

Fix #18501

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDetect conflicts with 3way merge (#18536)
zeripath [Wed, 2 Feb 2022 04:46:10 +0000 (04:46 +0000)]
Detect conflicts with 3way merge (#18536)

* Detect conflicts with 3way merge

Unforunately git apply --3way reports conflicts differently than standard patches
resulting in conflicts being missed.

Adjust the conflict detection code to account for this different error reporting.

Fix #18514

Signed-off-by: Andrew Thornton <art27@cantab.net>
* and three-way failed

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 2 Feb 2022 00:16:04 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate 1.16.0 changelog to set #17846 as breaking (#18533)
zeripath [Tue, 1 Feb 2022 22:09:32 +0000 (22:09 +0000)]
Update 1.16.0 changelog to set #17846 as breaking (#18533)

Unfortunately #17846 was determined to be breaking due to affecting ssh passthrough
however, this discovery happened after the changelog was created. Update the
Changelog to mark this as breaking.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIn docker rootless use $GITEA_APP_INI if provided (#18524)
Michael Kriese [Tue, 1 Feb 2022 20:18:57 +0000 (21:18 +0100)]
In docker rootless use $GITEA_APP_INI if provided (#18524)

2 years agorevert to node14 for snapcraft
techknowlogick [Tue, 1 Feb 2022 20:10:55 +0000 (15:10 -0500)]
revert to node14 for snapcraft

2 years agoAdd `GetUserTeams` (#18499)
Gusted [Tue, 1 Feb 2022 19:09:24 +0000 (20:09 +0100)]
Add `GetUserTeams` (#18499)

* COrrect use `UserID` in `SearchTeams`

- Use `UserID` in the `SearchTeams` function, currently it was useless
to pass such information. Now it does a INNER statement to `team_user`
which obtains UserID -> TeamID data.
- Make OrgID optional.
- Resolves #18484

* Seperate searching specific user

* Add condition back

* Use correct struct type

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix review excerpt (#18502)
confusedsushi [Tue, 1 Feb 2022 19:08:33 +0000 (20:08 +0100)]
Fix review excerpt (#18502)

Currently the "File Changed" tab of a PR is somehow broken. This is also true for the current release 1.16.0.

When you are on the "File Changed" tab, and want to look at code excerpt before or after the code changes, the layout breaks. You can test this on try.gitea.io here: https://try.gitea.io/testnotexisting/magic_enum/pulls/2/files

The problem occurs for the unified view and for the split view.

Kind of the same problem was there for commenting a line of code, this was fixed in #18321 and #18403.

For consistency, I changed the solution of #18321, I removed the ``colspan`` and instead added a ``<td>``. The goal was to have code similarly with the split view.

Also the separator line in the split view was in the wrong column, this was fixed too.* more consistent unified review comment

Fix #18516

Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate JS dependencies, fix lint (#18389)
silverwind [Tue, 1 Feb 2022 18:21:08 +0000 (10:21 -0800)]
Update JS dependencies, fix lint (#18389)

- Update all JS dependencies, including a security issue in mermaid
- Fix new linter errors related to value-keyword-case
- Tested Mermaid and Swagger

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoadd test coverage for original author conversion during migrations (#18506)
singuliere [Tue, 1 Feb 2022 18:20:28 +0000 (19:20 +0100)]
add test coverage for original author conversion during migrations (#18506)

* add test coverage for original author conversion during migrations

And create a function to factorize a code snippet that is repeated
five times and would otherwise be more difficult to test and maintain
consistently.

Signed-off-by: Loïc Dachary <loic@dachary.org>
* fix variable scope and int64 formatting

* add missing calls to remapExternalUser and fix misplaced %d

Co-authored-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoadd gitea-fmt back (#18526)
6543 [Tue, 1 Feb 2022 17:43:09 +0000 (18:43 +0100)]
add gitea-fmt back (#18526)

2 years agoFix non-ASCII search on database (#18437)
Gusted [Tue, 1 Feb 2022 12:59:25 +0000 (13:59 +0100)]
Fix non-ASCII search on database  (#18437)

Use `ToASCIIUpper` for SQLite database on issues search, this because `UPPER(x)` on SQLite only transforms ASCII letters. Resolves #18429

2 years agoUse "read" value for General Access (#18496)
Gusted [Tue, 1 Feb 2022 08:41:43 +0000 (09:41 +0100)]
Use "read" value for General Access (#18496)

- Currently the `.Team.AccessMode` is being used when editing a team, if
you want to admin -> General Access, the value of General Access is
"admin" which is incorrect.
- Resolves #18483 (First bug mentioned)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix for AvatarURL database type (#18487)
Viktor Kuzmin [Tue, 1 Feb 2022 05:40:23 +0000 (08:40 +0300)]
Fix for AvatarURL database type (#18487)

2 years agoRemove go 1.15 support (#18511)
Gusted [Tue, 1 Feb 2022 02:46:45 +0000 (03:46 +0100)]
Remove go 1.15 support (#18511)

- Remove support for go 1.15(go.mod already requires go 1.16).

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 1 Feb 2022 00:16:43 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse `ImagedProvider` for gplus oauth2 provider (#18504)
Gusted [Tue, 1 Feb 2022 00:02:56 +0000 (01:02 +0100)]
Use `ImagedProvider` for gplus oauth2 provider (#18504)

Use `ImagedProvider` for gplus' oauthv2 provider, as the image isn't "gplus.png" but "google.png".

Resolves #18494

2 years agobuild with node16 in snap (#18508)
techknowlogick [Mon, 31 Jan 2022 22:52:12 +0000 (17:52 -0500)]
build with node16 in snap (#18508)

2 years agopoint to s3 endpoint directly (#18497)
techknowlogick [Mon, 31 Jan 2022 22:39:39 +0000 (17:39 -0500)]
point to s3 endpoint directly (#18497)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix OAuth Source Edit Page (#18495)
zeripath [Mon, 31 Jan 2022 20:41:11 +0000 (20:41 +0000)]
Fix OAuth Source Edit Page (#18495)

* Fix OAuth Source Edit Page to ensure restricted and group settings are set
* Also tolerate []interface in the groups

Fix #18432

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 31 Jan 2022 00:05:29 +0000 (00:05 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPrevent NPE on partial match of compare URL and allow short SHA1 compare URLs (#18472)
Gusted [Sun, 30 Jan 2022 23:48:47 +0000 (00:48 +0100)]
Prevent NPE on partial match of compare URL and allow short SHA1 compare URLs (#18472)

* Don't panic & allow shorter sha1

- Don't panic when the full regex isn't matched and allow the usage of a
shorter sha1 being used.
- Resolves #18471

* Update modules/markup/html.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoupload to github & s3 at same time (#18475)
techknowlogick [Sun, 30 Jan 2022 22:40:44 +0000 (17:40 -0500)]
upload to github & s3 at same time (#18475)

2 years agoAdd a few more comments to the CONTRIBUTING.md document (#18469)
zeripath [Sun, 30 Jan 2022 18:56:48 +0000 (18:56 +0000)]
Add a few more comments to the CONTRIBUTING.md document (#18469)

* Explain how to title your Backport PR
* Advise that the first comment in a PR should explain the PR
* Include information about BREAKING changes
* Include information about backports/frontports
* Add reference command for creating backports
* Add reference commandline for creating large characters
* Add information about updating docs/config.yaml
* Update year in the copyright

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFrontport changelog 1.16.0 (#18468) (#18470)
zeripath [Sun, 30 Jan 2022 18:22:16 +0000 (18:22 +0000)]
Frontport changelog 1.16.0 (#18468) (#18470)

Frontport #18468

Frontport changelog for 1.16, frontport 1.15.11 changelog and update config.yaml

 ## [1.16.0](https://github.com/go-gitea/gitea/releases/tag/v1.16.0) - 2022-01-30

* BREAKING
  * Remove golang vendored directory (#18277)
  * Paginate releases page & set default page size to 10 (#16857)
  * Only allow webhook to send requests to allowed hosts (#17482)
* SECURITY
  * Disable content sniffing on `PlainTextBytes` (#18359) (#18365)
  * Only view milestones from current repo (#18414) (#18417)
  * Sanitize user-input on file name (#17666)
  * Use `hostmatcher` to replace `matchlist` to improve blocking of bad hosts in Webhooks (#17605)
* FEATURES
  * Add/update SMTP auth providers via cli (#18197)
  * Support webauthn (#17957)
  * Team permission allow different unit has different permission (#17811)
  * Implement Well-Known URL for password change (#17777)
  * Add support for ssh commit signing (#17743)
  * Allow Loading of Diffs that are too large (#17739)
  * Add copy button to markdown code blocks (#17638)
  * Add .gitattribute assisted language detection to blame, diff and render (#17590)
  * Add `PULL_LIMIT` and `PUSH_LIMIT` to cron.update_mirror task (#17568)
  * Add Reindex buttons to repository settings page (#17494)
  * Make SSL cipher suite configurable (#17440)
  * Add groups scope/claim to OIDC/OAuth2 Provider (#17367)
  * Add simple update checker to Gitea (#17212)
  * Migrated Repository will show modifications when possible (#17191)
  * Create pub/priv keypair for federation (#17071)
  * Make LDAP be able to skip local 2FA (#16954)
  * Add nodeinfo endpoint for federation purposes (#16953)
  * Save and view issue/comment content history (#16909)
  * Use git attributes to determine generated and vendored status for language stats and diffs (#16773)
  * Add migrate from Codebase (#16768)
  * Add migration from GitBucket (#16767)
  * Add OAuth2 introspection endpoint (#16752)
  * Add proxy settings and support for migration and webhook (#16704)
  * Add microsoft oauth2 providers (#16544)
  * Send registration email on user autoregistration (#16523)
  * Defer Last Commit Info (#16467)
  * Support unprotected file patterns (#16395)
  * Add migrate from OneDev (#16356)
  * Add option to update pull request by `rebase` (#16125)
  * Add RSS/Atom feed support for user actions (#16002)
  * Add support for corporate WeChat webhooks (#15910)
  * Add a simple way to rename branch like gh (#15870)
  * Add bundle download for repository (#14538)
  * Add agit flow support in gitea (#14295)
* API
  * Add MirrorUpdated field to Repository API type (#18267)
  * Adjust Fork API to allow setting a custom repository name (#18066)
  * Add API to manage repo tranfers (#17963)
  * Add API to get file commit history (#17652)
  * Add API to get issue/pull comments and events (timeline) (#17403)
  * Add API to get/edit wiki (#17278)
  * Add API for get user org permissions (#17232)
  * Add HTML urls to notification API (#17178)
  * Add API to get commit diff/patch (#17095)
  * Respond with updated notifications in API (#17064)
  * Add API to fetch git notes (#16649)
  * Generalize list header for API (#16551)
  * Add API Token Cache (#16547)
  * Allow Token API calls be authorized using the reverse-proxy header (#15119)
* ENHANCEMENTS
  * Make the height of the editor in Review Box smaller (4 lines as GitHub) (#18319)
  * Return nicer error if trying to pull from non-existent user (#18288)
  * Show pull link for agit pull request also (#18235)
  * Enable partial clone by default (#18195)
  * Added replay of webhooks (#18191)
  * Show OAuth callback error message (#18185)
  * Increase Salt randomness (#18179)
  * Add MP4 as default allowed attachment type (#18170)
  * Include folders into size cost (#18158)
  * Remove `/email2user` endpoint (#18127)
  * Handle invalid issues (#18111)
  * Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)
  * Support open compare page directly (#17975)
  * Prefer "Hiragino Kaku Gothic ProN" in system-ui-ja (#17954)
  * Clean legacy SimpleMDE code (#17926)
  * Refactor install page (db type) (#17919)
  * Improve interface when comparing a branch which has created a pull request (#17911)
  * Allow default branch to be inferred on compare page (#17908)
  * Display issue/comment role even if repo archived (#17907)
  * Always set a message-id on mails (#17900)
  * Change `<a>` elements to underline on hover (#17898)
  * Render issue references in file table (#17897)
  * Handle relative unix socket paths (#17836)
  * Move accessmode into models/perm (#17828)
  * Fix some org style problems (#17807)
  * Add List-Unsubscribe header (#17804)
  * Create menus for organization pages (#17802)
  * Switch archive URL code back to href attributes (#17796)
  * Refactor "refs/*" string usage by using constants (#17784)
  * Allow forks to org if you can create repos (#17783)
  * Improve install code to avoid low-level mistakes. (#17779)
  * Improve ellipsis buttons (#17773)
  * Add restrict and no-user-rc to authorized_keys (#17772)
  * Add copy Commit ID button in commits list (#17759)
  * Make `bind` error more readable (#17750)
  * Fix navbar on project view (#17749)
  * More pleasantly handle broken or missing git repositories (#17747)
  * Use `*PushUpdateOptions` as receiver (#17724)
  * Remove unused `user` paramater (#17723)
  * Better builtin avatar generator (#17707)
  * Cleanup and use global style on popups (#17674)
  * Move user/org deletion to services (#17673)
  * Added comment for changing issue ref (#17672)
  * Allow admins to change user avatars (#17661)
  * Only set `data-path` once for each file in diff pages (#17657)
  * Add icon to vscode clone link (#17641)
  * Add download button for file viewer (#17640)
  * Add pagination to fork list (#17639)
  * Use a standalone struct name for Organization (#17632)
  * Minor readability patch. (#17627)
  * Add context support for GetUserByID (#17602)
  * Move merge-section to `> .content` (#17582)
  * Remove NewSession method from db.Engine interface (#17577)
  * Move unit into models/unit/ (#17576)
  * Restrict GetDeletedBranchByID to the repositories deleted branches (#17570)
  * Refactor commentTags functionality (#17558)
  * Make Repo Code Indexer an Unique Queue (#17515)
  * Simplify Gothic to use our session store instead of creating a different store (#17507)
  * Add settings to allow different SMTP envelope from address (#17479)
  * Properly determine CSV delimiter (#17459)
  * Hide label comments if labels were added and removed immediately (#17455)
  * Tune UI alignment for nav bar notification icon, avatar image, issue label (#17438)
  * Add appearance section in settings (#17433)
  * Move key forms before list and add cancel button (#17432)
  * When copying executables to the docker chmod them (#17423)
  * Remove deprecated `extendDefaultPlugins` method of svgo (#17399)
  * Fix the click behavior for <tr> and <td> with [data-href] (#17388)
  * Refactor update checker to use AppState (#17387)
  * Improve async/await usage, and sort init calls in `index.js` (#17386)
  * Use a variable but a function for IsProd because of a slight performance increment (#17368)
  * Frontend refactor, PascalCase to camelCase, remove unused code (#17365)
  * Hide command line merge instructions when user can't push (#17339)
  * Move session to models/login (#17338)
  * Sync gitea app path for git hooks and authorized keys when starting (#17335)
  * Make the Mirror Queue a queue (#17326)
  * Add "Copy branch name" button to pull request page (#17323)
  * Fix repository summary on mobile (#17322)
  * Split `index.js` to separate files (#17315)
  * Show direct match on top for user search (#17303)
  * Frontend refactor: move Vue related code from `index.js` to `components` dir, and remove unused codes. (#17301)
  * Upgrade chi to v5 (#17298)
  * Disable form autofill (#17291)
  * Improve behavior of "Fork" button (#17288)
  * Open markdown image links in new window (#17287)
  * Add hints for special Wiki pages (#17283)
  * Move add deploy key form before the list and add a cancel button (#17228)
  * Allow adding multiple issues to a project  (#17226)
  * Add metrics to get issues by repository (#17225)
  * Add specific event type to header (#17222)
  * Redirect on project after issue created (#17211)
  * Reference in new issue modal: dont pre-populate issue title (#17208)
  * Always set a unique Message-ID header (#17206)
  * Add projects and project boards in exposed metrics (#17202)
  * Add metrics to get issues by label (#17201)
  * Add protection to disable Gitea when run as root (#17168)
  * Don't return binary file changes in raw PR diffs by default (#17158)
  * Support sorting for project board issuses (#17152)
  * Force color-adjust for markdown checkboxes (#17146)
  * Add option to copy line permalink (#17145)
  * Move twofactor to models/login (#17143)
  * Multiple tokens support for migrating from github (#17134)
  * Unify issue and PR subtitles (#17133)
  * Make Requests Processes and create process hierarchy. Associate OpenRepository with context. (#17125)
  * Fix problem when database id is not increment as expected (#17124)
  * Avatar refactor, move avatar code from `models` to `models.avatars`, remove duplicated code (#17123)
  * Re-allow clipboard copy on non-https sites (#17118)
  * DBContext is just a Context (#17100)
  * Move login related structs and functions to models/login (#17093)
  * Add SkipLocal2FA option to pam and smtp sources (#17078)
  * Move db related basic functions to models/db (#17075)
  * Fixes username tagging in "Reference in new issue" (#17074)
  * Use light/dark theme based on system preference (#17051)
  * Always emit the configuration path (#17036)
  * Add `AbsoluteListOptions` (#17028)
  * Use common sessioner for API and Web (#17027)
  * Fix overflow label in small view (#17020)
  * Report the associated filter if there is an error in LDAP (#17014)
  * Add "new issue" btn on project (#17001)
  * Add doctor dbconsistency check for release and attachment (#16978)
  * Disable Fomantic's CSS tooltips (#16974)
  * Add Cache-Control to avatar redirects (#16973)
  * Make mirror feature more configurable (#16957)
  * Add skip and limit to git.GetTags (#16897)
  * Remove ParseQueueConnStr as it is unused (#16878)
  * Remove unused Fomantic sidebar module (#16853)
  * Allow LDAP Sources to provide Avatars (#16851)
  * Remove Dashboard/Home button from the navbar (#16844)
  * Use conditions but not repo ids as query condition (#16839)
  * Add user settings key/value DB table (#16834)
  * Add buttons to allow loading of incomplete diffs (#16829)
  * Add information for migrate failure (#16803)
  * Add EdDSA JWT signing algorithm (#16786)
  * Add user status filter to admin user management page (#16770)
  * Add Option to synchronize Admin & Restricted states from OIDC/OAuth2 along with Setting Scopes (#16766)
  * Do not use thin scrollbars on Firefox (#16738)
  * Download LFS in git and web workflow from minio/s3 directly (SERVE_DIRECT) (#16731)
  * Compute proper foreground color for labels (#16729)
  * Add edit button to wiki sidebar and footer (#16719)
  * Fix migration svg color (#16715)
  * Add link to vscode to repo header (#16664)
  * Add filter by owner and team to issue/pulls search endpoint (#16662)
  * Kanban colored boards (#16647)
  * Allow setting X-FRAME-OPTIONS (#16643)
  * Separate open and closed issue in metrics (#16637)
  * Support direct comparison (git diff a..b) as well merge comparison (a…b) (#16635)
  * Add setting to OAuth handlers to skip local 2FA authentication (#16594)
  * Make PR merge options more intuitive (#16582)
  * Show correct text when comparing commits on empty pull request (#16569)
  * Pre-fill suggested New File 'name' and 'content' with Query Params (#16556)
  * Add an abstract json layout to make it's easier to change json library (#16528)
  * Make Mermaid.js limit configurable (#16519)
  * Improve 2FA autofill (#16473)
  * Add modals to Organization and Team remove/leave (#16471)
  * Show tag name on dashboard items list (#16466)
  * Change default cron schedules from @every 24h to @midnight (#16431)
  * Prevent double sanitize (#16386)
  * Replace `list.List` with slices (#16311)
  * Add configuration option to restrict users by default (#16256)
  * Move login out of models (#16199)
  * Support pagination of organizations on user settings pages (#16083)
  * Switch migration icon to svg (#15954)
  * Add left padding for chunk header of split diff view (#13397)
  * Allow U2F 2FA without TOTP (#11573)
* BUGFIXES
  * GitLab reviews may not have the updated_at field set (#18450) (#18461)
  * Fix detection of no commits when the default branch is not master (#18422) (#18423)
  * Fix broken oauth2 authentication source edit page (#18412) (#18419)
  * Place inline diff comment dialogs on split diff in 4th and 8th columns (#18403) (#18404)
  * Fix restore without topic failure (#18387) (#18400)
  * Fix commit's time (#18375) (#18392)
  * Fix partial cloning a repo (#18373) (#18377)
  * Stop trimming preceding and suffixing spaces from editor filenames (#18334)
  * Prevent showing webauthn error for every time visiting `/user/settings/security` (#18386)
  * Fix mime-type detection for HTTP server (#18370) (#18371)
  * Stop trimming preceding and suffixing spaces from editor filenames (#18334)
  * Restore propagation of ErrDependenciesLeft (#18325)
  * Fix PR comments UI (#18323)
  * Use indirect comparison when showing pull requests (#18313)
  * Replace satori/go.uuid with gofrs/uuid (#18311)
  * Fix commit links on compare page (#18310)
  * Don't show double error response in git hook (#18292)
  * Handle missing default branch better in owner/repo/branches page (#18290)
  * Fix CheckRepoStats and reuse it during migration (#18264)
  * Prevent underline hover on cards (#18259)
  * Don't delete branch if other PRs with this branch are open (#18164)
  * Require codereview to have content (#18156)
  * Allow admin to associate missing LFS objects for repositories (#18143)
  * When attempting to subscribe other user to issue report why access denied (#18091)
  * Add option to convert CRLF to LF line endings for sendmail (#18075)
  * Only create pprof files for gitea serv if explicitly asked for (#18068)
  * Abort merge if head has been updated before pressing merge (#18032)
  * Improve TestPatch to use git read-tree -m and implement git-merge-one-file functionality (#18004)
  * Use JSON module instead of stdlib json (#18003)
  * Fixed issue merged/closed wording (#17973)
  * Return nicer error for ForcePrivate (#17971)
  * Fix overflow in commit graph (#17947)
  * Prevent services/mailer/mailer_test.go tests from deleteing data directory (#17941)
  * Use disable_form_autofill on Codebase and Gitbucket (#17936)
  * Fix a panic in NotifyCreateIssueComment (caused by string truncation) (#17928)
  * Fix markdown URL parsing (#17924)
  * Apply CSS Variables to all message elements (#17920)
  * Improve checkBranchName (#17901)
  * Update chi/middleware to chi/v5/middleware (#17888)
  * Fix position of label color picker colors (#17866)
  * Fix ListUnadoptedRepositories incorrect total count (#17865)
  * Remove whitespace inside rendered code `<td>` (#17859)
  * Make Co-committed-by and co-authored-by trailers optional (#17848)
  * Fix value of User.IsRestricted when oauth2 user registration (#17839)
  * Use new OneDev /milestones endpoint (#17782)
  * Prevent deadlock in TestPersistableChannelQueue (#17717)
  * Simplify code for writing SHA to name-rev (#17696)
  * Fix database deadlock when update issue labels (#17649)
  * Add warning for BIDI characters in page renders and in diffs (#17562)
  * Fix ipv6 parsing for builtin ssh server (#17561)
  * Multiple Escaping Improvements (#17551)
  * Fixes #16559 - Do not trim leading spaces for tab delimited (#17442)
  * Show client-side error if wiki page is empty (#17415)
  * Fix context popup error (#17398)
  * Stop sanitizing full name in API (#17396)
  * Fix issue close/comment buttons on mobile (#17317)
  * Fix navbar UI (#17235)
  * Fix problem when database id is not increment as expected (#17229)
  * Open the DingTalk link in browser (#17084)
  * Remove heads pointing to missing old refs (#17076)
  * Fix commit status index problem (#17061)
  * Handle broken references in mirror sync (#17013)
  * Fix for create repo page layout (#17012)
  * Improve LDAP synchronization efficiency (#16994)
  * Add repo_id for attachment (#16958)
  * Clean-up HookPreReceive and restore functionality for pushing non-standard refs (#16705)
  * Remove duplicate csv import in modules/csv/csv.go (#16631)
  * Improve SMTP authentication and Fix user creation bugs  (#16612)
  * Fixed emoji alias not parsed in links (#16221)
  * Calculate label URL on API  (#16186)
* TRANSLATION
  * Fix mispelling of starred as stared (#17465)
  * Re-separate the color translation strings (#17390)
  * Enable Malayalam, Greek, Persian, Hungarian & Indonesian by default (#16998)
* BUILD
  * Add lockfile-check (#18285)
  * Don't store assets modified time into generated files (#18193)
  * Use shadowing script for docker (#17846)
* MISC
  * Update JS dependencies (#17611)

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoWarn at startup if the provided `SCRIPT_TYPE` is not on the PATH (#18467)
zeripath [Sun, 30 Jan 2022 16:33:36 +0000 (16:33 +0000)]
Warn at startup if the provided `SCRIPT_TYPE` is not on the PATH (#18467)

Several users run Gitea in situations whereby `bash` is not available.
If the `SCRIPT_TYPE` is not changed this will cause hooks to fail.
A simple test to check if the provided type is on the PATH should be
sufficient to warn them about this problem.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agouse next gen codecov uploader (#18443)
6543 [Sun, 30 Jan 2022 02:21:15 +0000 (03:21 +0100)]
use next gen codecov uploader (#18443)

2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 30 Jan 2022 00:28:19 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoChange some logging levels (#18421)
zeripath [Sat, 29 Jan 2022 20:52:37 +0000 (20:52 +0000)]
Change some logging levels (#18421)

* Change some logging levels

* PlainTextWithBytes - 4xx/5xx this should just be TRACE
* notFoundInternal - the "error" here is too noisy and should be DEBUG
* WorkerPool - Worker pool scaling messages are normal and should be DEBUG

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoGitLab reviews may not have the updated_at field set (#18450)
Aravinth Manivannan [Sat, 29 Jan 2022 17:33:20 +0000 (17:33 +0000)]
GitLab reviews may not have the updated_at field set (#18450)

* GitLab reviews may not have the updated_at field set

Fallback to created_at if that the case and to time.Now() if it is
also missing.

Fixes: 18434
* use assert.WithinDuration

Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoAttempt to prevent intermittent failure TestGit/xxx/BranchProtectMerge/MergePR (...
zeripath [Sat, 29 Jan 2022 15:35:36 +0000 (15:35 +0000)]
Attempt to prevent intermittent failure TestGit/xxx/BranchProtectMerge/MergePR (#18451)

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related #17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate Goldmark to Goldmark 1.4.4 (#18420)
zeripath [Sat, 29 Jan 2022 13:17:21 +0000 (13:17 +0000)]
Update Goldmark to Goldmark 1.4.4 (#18420)

* Update Goldmark to Goldmark 1.4.4
* nolint the deprecation

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoEnsure git tag tests and others create test repos in tmpdir (#18447)
zeripath [Sat, 29 Jan 2022 12:41:44 +0000 (12:41 +0000)]
Ensure git tag tests and others create test repos in tmpdir (#18447)

* Ensure git tag tests and other create test repos in tmpdir

There are a few places where tests appear to reuse testing repos which
causes random CI failures.

This PR simply changes these tests to ensure that cloning always happens
into new temporary directories.

Fix #18444

* Change log root for integration tests to use the REPO_TEST_DIR

There is a potential race in the drone integration tests whereby test-mysql etc
will start writing to log files causing make test-check fail.

Fix #18077

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAttempt to prevent the deadlock in the QueueDiskChannel Test again (#18415)
zeripath [Sat, 29 Jan 2022 11:37:08 +0000 (11:37 +0000)]
Attempt to prevent the deadlock in the QueueDiskChannel Test again (#18415)

* Attempt to prevent the deadlock in the QueueDiskChannel Test again

This time we're going to adjust the pause tests to only test the right
flag.

* Only switch off pushback once we know that we are not pushing anything else
* Ensure full redirection occurs
* More nicely handle a closed datachan
* And handle similar problems in queue_channel_test

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 29 Jan 2022 00:28:21 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse explicit jQuery import, remove unused eslint globals (#18435)
silverwind [Fri, 28 Jan 2022 21:00:11 +0000 (13:00 -0800)]
Use explicit jQuery import, remove unused eslint globals (#18435)

- Don't rely on globals (window.$) for jQuery import
- Remove eslint globals no longer in use

2 years agoFix typo (#18436)
Gusted [Fri, 28 Jan 2022 13:56:31 +0000 (13:56 +0000)]
Fix typo (#18436)

As title

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoAllow to filter repositories by language in explore, user and organization repositori...
Lauris BH [Fri, 28 Jan 2022 11:29:04 +0000 (13:29 +0200)]
Allow to filter repositories by language in explore, user and organization repositories lists (#18430)

2 years agoFix broken when no commits and default branch is not master (#18422)
Lunny Xiao [Fri, 28 Jan 2022 02:51:16 +0000 (10:51 +0800)]
Fix broken when no commits and default branch is not master (#18422)

* Fix broken when no commits and default branch is not master

* Fix IsEmpty check

* Improve codes

* Add timeout

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 28 Jan 2022 00:28:20 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAutomatically pause queue if index service is unavailable (#15066)
Lauris BH [Thu, 27 Jan 2022 08:30:51 +0000 (10:30 +0200)]
Automatically pause queue if index service is unavailable (#15066)

* Handle keyword search error when issue indexer service is not available

* Implement automatic disabling and resume of code indexer queue

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 27 Jan 2022 00:28:24 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoOnly view milestones from current repo (#18414)
zeripath [Wed, 26 Jan 2022 20:01:35 +0000 (20:01 +0000)]
Only view milestones from current repo (#18414)

The endpoint /{username}/{reponame}/milestone/{id} is not currently restricted to
the repo. This PR restricts the milestones to those within the repo.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoValidate migration files (#18203)
Aravinth Manivannan [Wed, 26 Jan 2022 09:45:51 +0000 (09:45 +0000)]
Validate migration files (#18203)

JSON Schema validation for data used by Gitea during migrations

Discussion at https://forum.forgefriends.org/t/common-json-schema-for-repository-information/563

Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoUse base32 for 2FA scratch token (#18384)
wxiaoguang [Wed, 26 Jan 2022 04:10:10 +0000 (12:10 +0800)]
Use base32 for 2FA scratch token (#18384)

* Use base32 for 2FA scratch token
* rename Secure* to Crypto*, add comments

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 26 Jan 2022 00:28:46 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix broken oauth2 authentication source edit page (#18412)
zeripath [Wed, 26 Jan 2022 00:23:46 +0000 (00:23 +0000)]
Fix broken oauth2 authentication source edit page (#18412)

It appears that there was a broken merge of the edit.tmpl page during the merge
of #16594 - I am not entirely sure how this happened as the PR was correct.

This PR fixes the broken template.

Fix #18388

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoPrevent deadlocks in persistable channel pause test (#18410)
zeripath [Tue, 25 Jan 2022 23:09:57 +0000 (23:09 +0000)]
Prevent deadlocks in persistable channel pause test (#18410)

* Prevent deadlocks in persistable channel pause test

Because of reuse of the old paused/resumed channels in this test there
was a potential for deadlock. This PR ensures that the channels are always
reobtained.

It further adds some control code to detect hangs in future - and it
ensures that the pausing warning is not shown on shutdown.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* do not warn but do pause

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoBump golangci-lint version (#18411)
Gusted [Tue, 25 Jan 2022 22:09:49 +0000 (22:09 +0000)]
Bump golangci-lint version (#18411)

- Bump golangci-lint version to v1.44.0 (no new linter errors detected)

2 years agoUnexport git.GlobalCommandArgs (#18376)
6543 [Tue, 25 Jan 2022 18:15:58 +0000 (19:15 +0100)]
Unexport git.GlobalCommandArgs (#18376)

Unexport the git.GlobalCommandArgs variable.

2 years agoPlace inline diff comment dialogs on split diff in 4th and 8th columns (#18403)
zeripath [Tue, 25 Jan 2022 12:18:30 +0000 (12:18 +0000)]
Place inline diff comment dialogs on split diff in 4th and 8th columns (#18403)

Fix #18391
Fix #18320

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAPI: Return primary language and repository language stats API URL (#18396)
Lauris BH [Tue, 25 Jan 2022 06:33:40 +0000 (08:33 +0200)]
API: Return primary language and repository language stats API URL (#18396)

2 years agoUpdate to work with latest VS Code go debugger (#18397)
Lauris BH [Tue, 25 Jan 2022 05:00:55 +0000 (07:00 +0200)]
Update to work with latest VS Code go debugger (#18397)

2 years agoFix restore without topic failure (#18387)
Lunny Xiao [Tue, 25 Jan 2022 02:44:12 +0000 (10:44 +0800)]
Fix restore without topic failure (#18387)

Co-authored-by: zeripath <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 25 Jan 2022 00:28:50 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMake WrappedQueues and PersistableChannelUniqueQueues Pausable (#18393)
zeripath [Mon, 24 Jan 2022 22:54:35 +0000 (22:54 +0000)]
Make WrappedQueues and PersistableChannelUniqueQueues Pausable (#18393)

Implements the Pausable interface on WrappedQueues and PersistableChannelUniqueQueues

Reference #15928

Signed-off-by: Andrew Thornton art27@cantab.net
2 years agoFix commit's time (#18375)
Gusted [Mon, 24 Jan 2022 22:11:40 +0000 (22:11 +0000)]
Fix commit's time (#18375)

* Fix commit's time

- Use the Committer's `when` as the CommitDate will be modified when the
commit is being moved around in the git tree(e.g. being rebased on top
of newer commits). The Author's `when` is created once and never touched
again.

* Update templates/repo/view_list.tmpl

* Commmt unstaged

* Add fallback

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoPrevent showing webauthn error for every time visiting `/user/settings/security`...
wxiaoguang [Mon, 24 Jan 2022 19:57:01 +0000 (03:57 +0800)]
Prevent showing webauthn error for every time visiting `/user/settings/security` (#18385)

2 years agoRefactor webhooks i18n (#18380)
wxiaoguang [Mon, 24 Jan 2022 11:36:54 +0000 (19:36 +0800)]
Refactor webhooks i18n (#18380)