]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoDelete related notifications on issue deletion too (#18953)
Otto Richter (fnetX) [Thu, 17 Mar 2022 22:04:09 +0000 (23:04 +0100)]
Delete related notifications on issue deletion too (#18953)

* use .Decr for issue comment counting

* Remove notification on issue removal

2 years agonit fix (#19116)
6543 [Thu, 17 Mar 2022 18:04:36 +0000 (19:04 +0100)]
nit fix (#19116)

2 years agoStore the foreign ID of issues during migration (#18446)
Aravinth Manivannan [Thu, 17 Mar 2022 17:08:35 +0000 (22:38 +0530)]
Store the foreign ID of issues during migration  (#18446)

Storing the foreign identifier of an imported issue in the database is a prerequisite to implement idempotent migrations or mirror for issues. It is a baby step towards mirroring that introduces a new table.

At the moment when an issue is created by the Gitea uploader, it fails if the issue already exists. The Gitea uploader could be modified so that, instead of failing, it looks up the database to find an existing issue. And if it does it would update the issue instead of creating a new one. However this is not currently possible because an information is missing from the database: the foreign identifier that uniquely represents the issue being migrated is not persisted. With this change, the foreign identifier is stored in the database and the Gitea uploader will then be able to run a query to figure out if a given issue being imported already exists.

The implementation of mirroring for issues, pull requests, releases, etc. can be done in three steps:

1. Store an identifier for the element being mirrored (issue, pull request...) in the database (this is the purpose of these changes)
2. Modify the Gitea uploader to be able to update an existing repository with all it contains (issues, pull request...) instead of failing if it exists
3. Optimize the Gitea uploader to speed up the updates, when possible.

The second step creates code that does not yet exist to enable idempotent migrations with the Gitea uploader. When a migration is done for the first time, the behavior is not changed. But when a migration is done for a repository that already exists, this new code is used to update it.

The third step can use the code created in the second step to optimize and speed up migrations. For instance, when a migration is resumed, an issue that has an update time that is not more recent can be skipped and only newly created issues or updated ones will be updated. Another example of optimization could be that a webhook notifies Gitea when an issue is updated. The code triggered by the webhook would download only this issue and call the code created in the second step to update the issue, as if it was in the process of an idempotent migration.

The ForeignReferences table is added to contain local and foreign ID pairs relative to a given repository. It can later be used for pull requests and other artifacts that can be mirrored. Although the foreign id could be added as a single field in issues or pull requests, it would need to be added to all tables that represent something that can be mirrored. Creating a new table makes for a simpler and more generic design. The drawback is that it requires an extra lookup to obtain the information. However, this extra information is only required during migration or mirroring and does not impact the way Gitea currently works.

The foreign identifier of an issue or pull request is similar to the identifier of an external user, which is stored in reactions, issues, etc. as OriginalPosterID and so on. The representation of a user is however different and the ability of users to link their account to an external user at a later time is also a logic that is different from what is involved in mirroring or migrations. For these reasons, despite some commonalities, it is unclear at this time how the two tables (foreign reference and external user) could be merged together.

The ForeignID field is extracted from the issue migration context so that it can be dumped in files with dump-repo and later restored via restore-repo.

The GetAllComments downloader method is introduced to simplify the implementation and not overload the Context for the purpose of pagination. It also clarifies in which context the comments are paginated and in which context they are not.

The Context interface is no longer useful for the purpose of retrieving the LocalID and ForeignID since they are now both available from the PullRequest and Issue struct. The Reviewable and Commentable interfaces replace and serve the same purpose.

The Context data member of PullRequest and Issue becomes a DownloaderContext to clarify that its purpose is not to support in memory operations while the current downloader is acting but is not otherwise persisted. It is, for instance, used by the GitLab downloader to store the IsMergeRequest boolean and sort out issues.

---
[source](https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/36)

Signed-off-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoRemove italics for `due_date_not_set` (#19113)
MeIchthys [Thu, 17 Mar 2022 15:43:10 +0000 (11:43 -0400)]
Remove italics for `due_date_not_set` (#19113)

To be more consistent with other `repo.issues.x` formatting, we can remove the italics from `dute_date_not_set`.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 17 Mar 2022 00:24:18 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFixed log path in fail2ban documentation (#19103)
Fredrik Ekre [Wed, 16 Mar 2022 16:39:13 +0000 (17:39 +0100)]
Fixed log path in fail2ban documentation (#19103)

This updates the log path in the [gitea-docker] jail configuration
to match the path in the [gitea] jail, which was updated in #13726.

2 years agorm .sample hooks which aren't used (#19101)
techknowlogick [Wed, 16 Mar 2022 10:33:07 +0000 (06:33 -0400)]
rm .sample hooks which aren't used (#19101)

2 years agouse go1.18 to build gitea (#19099)
techknowlogick [Wed, 16 Mar 2022 04:08:31 +0000 (00:08 -0400)]
use go1.18 to build gitea (#19099)

* use go1.18 to build gitea& update min go version to 1.17

* bump in a few more places

* add a few simple tests for isipprivate

* update go.mod

* update URL to https://go.dev/dl/

* golangci-lint

* attempt golangci-lint workaround

* change version

* bump fumpt version

* skip strings.title test

* go mod tidy

* update tests as some aren't private??

* update tests

2 years agoUse `go run` for tool dependencies, require go 1.17 (#18874)
silverwind [Wed, 16 Mar 2022 02:50:26 +0000 (03:50 +0100)]
Use `go run` for tool dependencies, require go 1.17 (#18874)

This ensures the tools only run in the versions we've tested and it also
does not polute PATH with those tools so they are truly isolated. This
syntax of `go run` requires go 1.17, so the minimum version is set
accordingly.

Fixes: https://github.com/go-gitea/gitea/issues/18867
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoUpdate golang.org/x/crypto (#19097)
Gusted [Wed, 16 Mar 2022 01:59:53 +0000 (01:59 +0000)]
Update golang.org/x/crypto (#19097)

* Update golang.org/x/crypto

- Update dependency to include fix for CVE.
- See https://groups.google.com/g/golang-announce/c/-cp44ypCT5s/m/wmegxkLiAQAJ?utm_medium=email&utm_source=footer

* Fix deprecation notice

* Remove workaround

- Introduced in https://github.com/go-gitea/gitea/pull/17281
- Fixed in x/crypto:
- https://github.com/golang/crypto/commit/5d542ad81a58c89581d596f49d0ba5d435481bcf
- & https://github.com/golang/crypto/commit/3147a52a75dda54ac3a611ef8978640d85188a2a

* Update Kex Algorithms

- Use standardized name for curve22519-sha256. https://github.com/golang/crypto/commit/9b076918e3c7e908b2bdea932f272a9979f2488a
- Prefer SHA256 version over SHA1 version. https://github.com/golang/crypto/commit/e4b3678e5f38521e67eba223ddd1902ceb3a303c

2 years agoHandle email address not exist. (#19089)
KN4CK3R [Tue, 15 Mar 2022 09:18:39 +0000 (10:18 +0100)]
Handle email address not exist. (#19089)

2 years agoFrontport Changelogs (#19088)
6543 [Mon, 14 Mar 2022 22:18:01 +0000 (23:18 +0100)]
Frontport Changelogs (#19088)

* Frontport Changelogs

* bump version in docs

2 years agoRestrict email address validation (#17688)
Lunny Xiao [Mon, 14 Mar 2022 17:39:54 +0000 (01:39 +0800)]
Restrict email address validation (#17688)

This didn't follow the RFC but it's a subset of that. I think we should narrow the allowed chars at first and discuss more possibility in future PRs.

2 years agoFix lfs bug (#19072)
Lunny Xiao [Mon, 14 Mar 2022 15:18:27 +0000 (23:18 +0800)]
Fix lfs bug (#19072)

* Fix lfs bug

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 14 Mar 2022 00:11:34 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix documentation and #19065 (#19067)
mscherer [Sun, 13 Mar 2022 17:30:58 +0000 (18:30 +0100)]
Fix documentation and #19065 (#19067)

2 years agoRSS/Atom support for Repos (#19055)
6543 [Sun, 13 Mar 2022 16:40:47 +0000 (17:40 +0100)]
RSS/Atom support for Repos (#19055)

* support for repos
* refactor
* advertise the feeds via meta tags
* allow feed suffix and feed header
* optimize performance

2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 13 Mar 2022 00:11:52 +0000 (00:11 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoFeeds: render markdown to html (#19058)
Norwin [Sat, 12 Mar 2022 22:05:12 +0000 (23:05 +0100)]
Feeds: render markdown to html (#19058)

* feeds: render markdown to html

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 12 Mar 2022 00:11:48 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPrevent 500 when there is an error during new auth source post (#19041)
zeripath [Thu, 10 Mar 2022 22:40:43 +0000 (22:40 +0000)]
Prevent 500 when there is an error during new auth source post (#19041)

Fix #19036

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate the webauthn_credential_id_sequence in Postgres (#19048)
zeripath [Thu, 10 Mar 2022 22:04:55 +0000 (22:04 +0000)]
Update the webauthn_credential_id_sequence in Postgres (#19048)

* Update the webauthn_credential_id_sequence in Postgres

There is (yet) another problem with v210 in that Postgres will silently allow preset
ID insertions ... but it will not update the sequence value.

This PR simply adds a little step to the end of the v210 migration to update the
sequence number.

Users who have already migrated who find that they cannot insert new
webauthn_credentials into the DB can either run:

```bash
gitea doctor recreate-table webauthn_credential
```

or

```bash
./gitea doctor --run=check-db-consistency --fix
```

which will fix the bad sequence.

Fix #19012

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIf rendering has failed due to a net.OpError stop rendering (attempt 2) (#19049)
zeripath [Thu, 10 Mar 2022 20:23:15 +0000 (20:23 +0000)]
If rendering has failed due to a net.OpError stop rendering (attempt 2) (#19049)

Unfortunately #18642 does not work because a `*net.OpError` does not implement
the `Is` interface to make `errors.Is` work correctly - thus leading to the
irritating conclusion that a `*net.OpError` is not a `*net.OpError`.

Here we keep the `errors.Is` because presumably this will be fixed at
some point in the golang main source code but also we add a simply type
cast to also check.

Fix #18629

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agouse xorm builder for models.getReviewers() (#19033)
6543 [Thu, 10 Mar 2022 18:12:10 +0000 (19:12 +0100)]
use xorm builder for models.getReviewers() (#19033)

* xorm builder

* dedup code

2 years agoRSS/Atom support for Orgs (#17714)
6543 [Thu, 10 Mar 2022 14:54:51 +0000 (15:54 +0100)]
RSS/Atom support for Orgs (#17714)

part of #569

2 years agoFix flag validation (#19046)
Norwin [Thu, 10 Mar 2022 10:11:26 +0000 (11:11 +0100)]
Fix flag validation (#19046)

Regression from #5785

2 years agoImprove SyncMirrors logging (#19045)
zeripath [Thu, 10 Mar 2022 10:09:48 +0000 (10:09 +0000)]
Improve SyncMirrors logging (#19045)

Yet another issue has come up where the logging from SyncMirrors does not provide
enough context. This PR adds more context to these logging events.

Related #19038

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agofix pam authorization (#19040)
zeripath [Thu, 10 Mar 2022 02:00:05 +0000 (02:00 +0000)]
fix pam authorization (#19040)

https://huntr.dev/bounties/8d221f92-b2b1-4878-bc31-66ff272e5ceb/

Co-authored-by: ysf <34326+ysf@users.noreply.github.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 10 Mar 2022 00:11:57 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpgrading binding package (#19034)
Lunny Xiao [Wed, 9 Mar 2022 18:06:58 +0000 (02:06 +0800)]
Upgrading binding package (#19034)

Fix #18855

2 years agoEnsure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028)
wxiaoguang [Wed, 9 Mar 2022 04:42:29 +0000 (12:42 +0800)]
Ensure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028)

When DISABLE_HTTP_GIT is set we should always show the SSH button

2 years agoAdd button for issue deletion (#19032)
Otto Richter (fnetX) [Wed, 9 Mar 2022 00:38:11 +0000 (01:38 +0100)]
Add button for issue deletion (#19032)

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix script compatiable with OpenWrt (#19000)
YISH [Tue, 8 Mar 2022 22:58:14 +0000 (06:58 +0800)]
Fix script compatiable with OpenWrt (#19000)

* Fix compatibility of upgrade.sh in openwrt and add service init script for openwrt.

* Apply suggestions from code review

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>
* Update contrib/upgrade.sh

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoAllow users to self-request a PR review (#19030)
Norwin [Tue, 8 Mar 2022 21:48:47 +0000 (22:48 +0100)]
Allow users to self-request a PR review (#19030)

The review request feature was added in https://github.com/go-gitea/gitea/pull/10756,
where the doer got explicitly excluded from available reviewers. I don't see a
functionality or security related reason to forbid this case.

As shown by GitHubs implementation, it may be useful to self-request a review,
to be reminded oneselves about reviewing, while communicating to team mates that a
review is missing.

Co-authored-by: delvh <dev.lh@web.de>
2 years agoFix wrong scopes caused by empty scope input (#19029)
wxiaoguang [Tue, 8 Mar 2022 18:56:40 +0000 (02:56 +0800)]
Fix wrong scopes caused by empty scope input (#19029)

2 years agoFeature: show issue assignee on project board (#15232)
Roger Luo [Tue, 8 Mar 2022 16:42:28 +0000 (00:42 +0800)]
Feature: show issue assignee on project board (#15232)

* Show assignees in project boards.

2 years agobump go deps (#19021)
techknowlogick [Tue, 8 Mar 2022 11:15:30 +0000 (06:15 -0500)]
bump go deps (#19021)

* update gitea.com/go-chi/binding

* update gitea.com/go-chi/cache

* update github.com/42wim/sshsig

* update github.com/PuerkitoBio/goquery

* update github.com/blevesearch/bleve/v2

* update github.com/caddyserver/certmagic

* update github.com/denisenkom/go-mssqldb

* update github.com/duo-labs/webauthn

* update github.com/dustin/go-humanize

* update github.com/editorconfig/editorconfig-core-go/v2

* update github.com/ethantkoenig/rupture

* update github.com/go-chi/chi/v5

* update github.com/go-git/go-git/v5

* update github.com/go-ldap/ldap/v3

* update github.com/go-redis/redis/v8

* update github.com/go-swagger/go-swagger

* update github.com/gogs/chardet

* update github.com/golang-jwt/jwt/v4

* update github.com/hashicorp/go-version

* update github.com/jaytaylor/html2text

* update github.com/klauspost/compress

* update github.com/lib/pq

* update github.com/markbates/goth

* update github.com/mattn/go-sqlite3

* update github.com/mholt/archiver/v3

* update github.com/microcosm-cc/bluemonday

* update github.com/minio/minio-go/v7

* update github.com/msteinert/pam

* update github.com/niklasfasching/go-org

* update github.com/olivere/elastic/v7

* update github.com/prometheus/client_golang

* update github.com/quasoft/websspi

* update github.com/stretchr/testify

* update github.com/unknwon/i18n

* update github.com/unrolled/render

* update github.com/xanzy/go-gitlab

* update github.com/yuin/goldmark

* update github.com/yuin/goldmark-highlighting

* update github.com/yuin/goldmark-meta

* post make vendor

Signed-off-by: Andrew Thornton <art27@cantab.net>
* add make vendor back into update_dependencies.sh

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update update_dependencies.sh

* Update contrib/update_dependencies.sh

Co-authored-by: zeripath <art27@cantab.net>
* update mvdan.cc/xurls/v2

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoDon't show context cancelled errors in attribute reader (#19006)
zeripath [Tue, 8 Mar 2022 08:30:14 +0000 (08:30 +0000)]
Don't show context cancelled errors in attribute reader (#19006)

Fix #18997

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoSet `rel="nofollow noindex"` on new issue links (#19023)
zeripath [Mon, 7 Mar 2022 22:08:05 +0000 (22:08 +0000)]
Set `rel="nofollow noindex"` on new issue links (#19023)

Fix #19018

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoupdate to correct stable version
techknowlogick [Mon, 7 Mar 2022 07:03:06 +0000 (02:03 -0500)]
update to correct stable version

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 7 Mar 2022 00:11:49 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd Index to comment for migrations and mirroring (#18806)
singuliere [Sun, 6 Mar 2022 19:00:41 +0000 (20:00 +0100)]
Add Index to comment for migrations and mirroring (#18806)

Comments have an id (see Gitea[0], GitLab[1], GitHub[2], etc.), and the
comment migration format must represent it during migrations so that
it can be used during mirroring or incremental migrations.

[0] https://try.gitea.io/api/swagger#/issue/issueGetComment
[1] https://docs.gitlab.com/ee/api/discussions.html#get-single-issue-discussion-item
[2] https://docs.github.com/en/rest/reference/issues#get-an-issue-comment

Signed-off-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoSupport ignore all santize for external renderer (#18984)
Lunny Xiao [Sun, 6 Mar 2022 08:41:54 +0000 (16:41 +0800)]
Support ignore all santize for external renderer (#18984)

* Support ignore all santize for external renderer

* Update docs

* Apply suggestions from code review

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

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix EasyMDE error when input Enter (#19004)
wxiaoguang [Sat, 5 Mar 2022 17:53:34 +0000 (01:53 +0800)]
Fix EasyMDE error when input Enter (#19004)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix update hint bug (#18996)
Lunny Xiao [Fri, 4 Mar 2022 20:59:29 +0000 (04:59 +0800)]
Fix update hint bug (#18996)

2 years agoFix the editor height in review box (#19003)
wxiaoguang [Fri, 4 Mar 2022 20:57:26 +0000 (04:57 +0800)]
Fix the editor height in review box (#19003)

Fix the height problem in  https://github.com/go-gitea/gitea/pull/18862#issuecomment-1059329539

I have tested this fix.

# Screenshots

### Min-height

<img width="1138" alt="image" src="https://user-images.githubusercontent.com/2114189/156811831-93d4d31a-1b0a-4c4c-a7b4-fafc706133d6.png">

### Max-height

<img width="1126" alt="image" src="https://user-images.githubusercontent.com/2114189/156811889-10ae41de-c63b-45e7-9d89-21a1ed29e58b.png">

2 years agoAdd a "admin user generate-access-token" subcommand (#17722)
mscherer [Fri, 4 Mar 2022 19:53:35 +0000 (20:53 +0100)]
Add a "admin user generate-access-token" subcommand (#17722)

* Add a "admin user generate-access-token" subcommand

Fixes #17721

* Update cmd/admin.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update cmd/admin.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix code to match new interfaces

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix potential assignee query for repo (#18994)
Otto Richter (fnetX) [Fri, 4 Mar 2022 18:29:12 +0000 (19:29 +0100)]
Fix potential assignee query for repo (#18994)

* Fix potential assignee query for repo

* Add tests for `GetRepoAssignees`

- As per https://github.com/go-gitea/gitea/pull/18994#issuecomment-1058506640

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd config option to disable "Update branch by rebase" (#18745)
Jimmy Praet [Fri, 4 Mar 2022 08:30:49 +0000 (09:30 +0100)]
Add config option to disable "Update branch by rebase" (#18745)

2 years agoUpdate `go-enry` to v2.8.0 (#18993)
Gusted [Fri, 4 Mar 2022 00:56:31 +0000 (00:56 +0000)]
Update `go-enry` to v2.8.0 (#18993)

- It was reported in the Matrix channel that Chroma [has support](https://github.com/alecthomas/chroma/commit/d40210297631298bde98a8fcfd52c3d2555cc367)
for the Fennel language, go-enry only added detection support for this
[in v2.7.2](https://github.com/go-enry/go-enry/commit/0affa3ccca37cd781600760956581c5f94ef8a3c).

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agohomebrew updates via cron
techknowlogick [Thu, 3 Mar 2022 20:59:26 +0000 (15:59 -0500)]
homebrew updates via cron

2 years agoignore missing comment for user notifications (#18954)
eladyn [Thu, 3 Mar 2022 15:18:26 +0000 (16:18 +0100)]
ignore missing comment for user notifications (#18954)

* ignore missing comment for user notifications

* instead fix bug in notifications model

* use local variable instead

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoallow overwrite artifacts for github releases (#18987)
6543 [Thu, 3 Mar 2022 14:28:41 +0000 (15:28 +0100)]
allow overwrite artifacts for github releases (#18987)

2 years agofix & refactor (#18973)
6543 [Thu, 3 Mar 2022 11:51:13 +0000 (12:51 +0100)]
fix & refactor (#18973)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDon't clean up hardcoded `tmp` (#18983)
KN4CK3R [Wed, 2 Mar 2022 22:50:29 +0000 (23:50 +0100)]
Don't clean up hardcoded `tmp` (#18983)

* Don't clean up hardcoded `tmp`.

* Fixed import.

2 years agogit backend ignore replace objects (#18979)
6543 [Wed, 2 Mar 2022 20:13:19 +0000 (21:13 +0100)]
git backend ignore replace objects (#18979)

* git backend ignore replace objects

* comment

2 years agoImprove the deletion of issue (#18945)
Lunny Xiao [Wed, 2 Mar 2022 17:38:56 +0000 (01:38 +0800)]
Improve the deletion of issue (#18945)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd note to GPG key response if user has no keys (#18961)
KN4CK3R [Wed, 2 Mar 2022 16:32:18 +0000 (17:32 +0100)]
Add note to GPG key response if user has no keys (#18961)

* Prevent invalid key response.

* Display note instead of 404 response.

* Fixed test.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoadds restore docs for docker based instances (#18844)
Marco Blessing [Wed, 2 Mar 2022 16:20:00 +0000 (17:20 +0100)]
adds restore docs for docker based instances (#18844)

* adds docke restore section

* fix typo

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

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* fix container id placeholder

* adds restore help for docker-rootless

* restore yml autoformater quotes

Co-authored-by: Marco Blessing <marco.blessing@komm.one>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRefactor admin user filter query parameters (#18965)
wxiaoguang [Wed, 2 Mar 2022 15:30:14 +0000 (23:30 +0800)]
Refactor admin user filter query parameters (#18965)

Only pass `status_filter` on admin page
Use a more general method to pass query parameters, remove hard-coded keys

2 years agoRefactor mirror code & fix `StartToMirror` (#18904)
Gusted [Wed, 2 Mar 2022 07:43:11 +0000 (07:43 +0000)]
Refactor mirror code & fix `StartToMirror` (#18904)

* Use MirrorID instead of RepoID

- Use the MirrorID as index(SQL uses `id` column not the `repo_id`).
Passes the Mirror ID's into the Sync functions.

* Check for MirrorID == 0

* Fix `StartToMirror` + refactor

* Update services/mirror/mirror.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoSend 404 on `/{org}.gpg` (#18959)
Gusted [Wed, 2 Mar 2022 01:37:32 +0000 (01:37 +0000)]
Send 404 on `/{org}.gpg` (#18959)

2 years agoAccounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case...
6543 [Wed, 2 Mar 2022 00:24:31 +0000 (01:24 +0100)]
Accounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case (#18897)

2 years agoFix lfs management setting (#18946)
Lunny Xiao [Tue, 1 Mar 2022 23:14:27 +0000 (07:14 +0800)]
Fix lfs management setting (#18946)

Fix #18782

2 years agoFix admin user list pagination (#18957)
Otto Richter (fnetX) [Tue, 1 Mar 2022 19:21:37 +0000 (20:21 +0100)]
Fix admin user list pagination (#18957)

2 years ago[API] Allow removing issues (#18879)
Otto Richter (fnetX) [Tue, 1 Mar 2022 00:20:15 +0000 (01:20 +0100)]
[API] Allow removing issues (#18879)

Add new feature to delete issues and pulls via API

Co-authored-by: fnetx <git@fralix.ovh>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoRefactor SecToTime() function (#18863)
René Schaar [Mon, 28 Feb 2022 22:57:20 +0000 (23:57 +0100)]
Refactor SecToTime() function (#18863)

- Add helper method to reduce redundancy
- Expand the scope from displaying days to years
- Reduce irrelevance by not displaying small units (hours, minutes, seconds) when bigger ones apply (years)

2 years agoImprove mirror iterator (#18928)
Lunny Xiao [Mon, 28 Feb 2022 19:41:06 +0000 (03:41 +0800)]
Improve mirror iterator (#18928)

* Improve mirror iterator

* fix test

2 years agoFix login with email panic when email is not exist (#18941)
Lunny Xiao [Mon, 28 Feb 2022 17:33:33 +0000 (01:33 +0800)]
Fix login with email panic when email is not exist (#18941)

2 years agoAdjust error for already locked db and prevent level db lock on malformed connstr...
zeripath [Sun, 27 Feb 2022 19:45:06 +0000 (19:45 +0000)]
Adjust error for already locked db and prevent level db lock on malformed connstr (#18923)

This PR adjusts the error returned when there is failure to lock the level db, and
permits a connections to the same leveldb where there is a different connection string.

Reference #18921
Reference #18917

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAvoid database lookups for `DescriptionHTML` (#18924)
Gusted [Sun, 27 Feb 2022 17:51:34 +0000 (17:51 +0000)]
Avoid database lookups for `DescriptionHTML` (#18924)

* Avoid database lookups for `DescriptionHTML`

- Don't Compose meta's for DescriptionHTML, they are only needed in
order to correctly format and show issue's but it's highly unlikely that
a repository description will refer to a local issue.

Using 125 Connections for 5 seconds: on `/explore/repos`(which is the most
noticeable usage by this function's database lookups):

Before:

Statistics        Avg      Stdev        Max
  Reqs/sec       569.41     506.05    2715.00
  Latency      214.27ms    16.60ms   294.84ms
  HTTP codes:
    1xx - 0, 2xx - 2974, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    27.17MB/s

After:

Statistics        Avg      Stdev        Max
  Reqs/sec      1585.04     789.84    4144.56
  Latency       78.89ms    15.89ms   206.94ms
  HTTP codes:
    1xx - 0, 2xx - 7975, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    73.85MB/s

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoUpdate go-org to v1.6.1 (#18932)
Gusted [Sun, 27 Feb 2022 16:56:44 +0000 (16:56 +0000)]
Update go-org to v1.6.1 (#18932)

- v1.6.0 has a inconsistency with the proxy and github's tagged version,
updating to v1.6.1 should fix this issue.
- Resolves #18864

2 years agoFix trace log to show value instead of pointers (#18926)
Gusted [Sun, 27 Feb 2022 15:49:22 +0000 (15:49 +0000)]
Fix trace log to show value instead of pointers (#18926)

- Fixes a issue with a trace of repo.Units whereby it would show the pointers.

Before:
![image](https://user-images.githubusercontent.com/25481501/155876811-036bf40e-db89-4e09-ac00-0c78ce3f5bef.png)

After:
![image](https://user-images.githubusercontent.com/25481501/155885102-16c9cf29-314b-4f32-bcee-80e332f63dec.png)

2 years agoAdd announcement steps to release-howto (#18896)
Norwin [Sun, 27 Feb 2022 15:48:09 +0000 (16:48 +0100)]
Add announcement steps to release-howto (#18896)

* add announcements steps to release-howto

* Also add homebrew update

2 years agoFix `<strong>` html in translation (#18929)
Gusted [Sun, 27 Feb 2022 15:46:45 +0000 (15:46 +0000)]
Fix `<strong>` html in translation (#18929)

2 years agoFix page and missing return on unadopted repos API (#18848)
qwerty287 [Sun, 27 Feb 2022 12:17:42 +0000 (13:17 +0100)]
Fix page and missing return on unadopted repos API (#18848)

* Fix page and missing return on unadopted repos API

Page must be 1 if it's not specified and it should return after sending an internal server error.

* Allow ignore pages

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 27 Feb 2022 00:16:04 +0000 (00:16 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoAllow adminstrator teams members to see other teams (#18918)
Gusted [Sat, 26 Feb 2022 20:12:01 +0000 (20:12 +0000)]
Allow adminstrator teams members to see other teams (#18918)

* Allow adminstrator teams to see other teams

- Allow team members with adminstrator access, to view other teams.
- Resolves #18885

2 years agoUpdate nginx reverse proxy docs (#18922)
JonRB [Sat, 26 Feb 2022 18:32:09 +0000 (18:32 +0000)]
Update nginx reverse proxy docs (#18922)

Add additional config lines for the set_header to forward additional information (eg the IP)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDon't treat BOM escape sequence as hidden character. (#18909)
Gusted [Sat, 26 Feb 2022 16:48:23 +0000 (16:48 +0000)]
Don't treat BOM escape sequence as hidden character. (#18909)

* Don't treat BOM escape sequence as hidden character.

- BOM sequence is a common non-harmfull escape sequence, it shouldn't be
shown as hidden character.
- Follows GitHub's behavior.
- Resolves #18837

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRemove CodeMirror dependencies (#18911)
silverwind [Sat, 26 Feb 2022 15:47:52 +0000 (16:47 +0100)]
Remove CodeMirror dependencies (#18911)

EasyMDE already loads all the modes and plugins it needs, so there is no reason for neither the webpack dependency nor the vendored copy

2 years agoUncapitalize errors (#18915)
Gusted [Sat, 26 Feb 2022 12:15:32 +0000 (12:15 +0000)]
Uncapitalize errors (#18915)

- See: https://github.com/golang/go/wiki/CodeReviewComments#error-strings

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDisable service worker by default (#18914)
silverwind [Sat, 26 Feb 2022 10:14:23 +0000 (11:14 +0100)]
Disable service worker by default (#18914)

The service worker causes a lot of issues with JS errors after instance
upgrades while not bringing any real performance gain over regular HTTP
caching.

Disable it by default for this reason. Maybe later we can remove it
completely, as I simply see no benefit in having it.

2 years agoSet is_empty in fixtures (#18869)
KN4CK3R [Sat, 26 Feb 2022 06:15:25 +0000 (07:15 +0100)]
Set is_empty in fixtures (#18869)

2 years agoDon't update email for organisation (#18905)
Gusted [Sat, 26 Feb 2022 02:38:08 +0000 (02:38 +0000)]
Don't update email for organisation (#18905)

- Fix regression caused by: f1b1472632e36c3bb5df73f184a6efeef47f5d01
- Don't try to insert a email for Organisation(as they don't have one).
- Resolves #18891

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoCorrectly link URLs to users/repos with dashes, dots or underscores (#18890)
Alexander Neumann [Fri, 25 Feb 2022 23:26:43 +0000 (00:26 +0100)]
Correctly link URLs to users/repos with dashes, dots or underscores (#18890)

* Add tests for references with dashes

This commit adds tests for full URLs referencing repos names and user
names containing a dash.

* Extend regex to match URLs to repos/users with dashes

2 years agoSet is_private in fixtures. (#18868)
KN4CK3R [Fri, 25 Feb 2022 21:22:20 +0000 (22:22 +0100)]
Set is_private in fixtures. (#18868)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix team management UI (#18886)
Lunny Xiao [Fri, 25 Feb 2022 21:19:54 +0000 (05:19 +0800)]
Fix team management UI (#18886)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoUpdate JS dependencies (#18898)
silverwind [Fri, 25 Feb 2022 20:08:35 +0000 (21:08 +0100)]
Update JS dependencies (#18898)

- Updated all JS dependencies minus Vue (update 2 to 3 requires a ton of
  work and is probably blocked by dependencies)
- Tested editor, swagger-ui

2 years agoFix migration v210 (#18892)
Lunny Xiao [Fri, 25 Feb 2022 14:04:59 +0000 (22:04 +0800)]
Fix migration v210 (#18892)

2 years agomigrations: add test for importing pull requests in gitea uploader (#18752)
singuliere [Fri, 25 Feb 2022 09:20:50 +0000 (10:20 +0100)]
migrations: add test for importing pull requests in gitea uploader (#18752)

* logs: add the buffer logger to inspect logs during testing

Signed-off-by: Loïc Dachary <loic@dachary.org>
* migrations: add test for importing pull requests in gitea uploader

Signed-off-by: Loïc Dachary <loic@dachary.org>
* for each git.OpenRepositoryCtx, call Close

* Content is expected to return the content of the log

* test for errors before defer

Co-authored-by: Loïc Dachary <loic@dachary.org>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoBeforeSourcePath should point to base commit (#18799)
Jimmy Praet [Fri, 25 Feb 2022 06:46:15 +0000 (07:46 +0100)]
BeforeSourcePath should point to base commit (#18799)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoPrevent Stats Indexer reporting error if repo dir missing (#18870)
zeripath [Fri, 25 Feb 2022 04:22:09 +0000 (04:22 +0000)]
Prevent Stats Indexer reporting error if repo dir missing (#18870)

Repositories missing their directory should not report an error from the stats
indexer.

Close #18847

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 [Fri, 25 Feb 2022 00:16:08 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix update user (#18878)
Lunny Xiao [Thu, 24 Feb 2022 18:29:10 +0000 (02:29 +0800)]
Fix update user (#18878)

2 years agoFix ldap user sync missed email in email_address table (#18786)
Lunny Xiao [Thu, 24 Feb 2022 06:13:59 +0000 (14:13 +0800)]
Fix ldap user sync missed email in email_address table (#18786)

* Fix ldap user sync missed email in email_address table

* Fix test

2 years agoUpdate assignees check to include any writing team and change org sidebar (#18680)
zeripath [Wed, 23 Feb 2022 22:07:05 +0000 (22:07 +0000)]
Update assignees check to include any writing team and change org sidebar (#18680)

Following the merging of #17811 teams can now have differing write and readonly permissions, however the assignee list will not include teams which have mixed perms.

Further the org sidebar is no longer helpful as it can't describe these mixed permissions situations.

Fix #18572

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoSet max text height to prevent overflow (#18862)
Kyle D [Wed, 23 Feb 2022 20:17:14 +0000 (13:17 -0700)]
Set max text height to prevent overflow (#18862)

Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png)

After:
![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png)

Interestingly, I don't see this bug on Firefox.

2 years agoLock gofumpt to v0.3.0 and run it (#18866)
silverwind [Wed, 23 Feb 2022 20:16:07 +0000 (21:16 +0100)]
Lock gofumpt to v0.3.0 and run it (#18866)

We can't depend on `latest` version of gofumpt because the output will
not be stable across versions. Lock it down to the latest version
released yesterday and run it again.

2 years agoFix ldap edit bug (#18856)
Lunny Xiao [Tue, 22 Feb 2022 22:07:04 +0000 (06:07 +0800)]
Fix ldap edit bug (#18856)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>