Commit Graph
100 Commits
Author SHA1 Message Date
a196302472 Fix template bug of admin monitor (#21208)
Fix #21207

Co-authored-by: Lauris BH <lauris@nix.lv>
2022-09-19 20:53:39 -04:00
bc4cce138a Fix delete user missed some comments (#21067)
There is a mistake in the batched delete comments part of DeleteUser which causes some comments to not be deleted

The code incorrectly updates the `start` of the limit clause resulting in most comments not being deleted.

```go
			if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, start).Find(&comments); err != nil {
```

should be:

```go
			if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, 0).Find(&comments); err != nil {
```

Co-authored-by: zeripath <art27@cantab.net>
2022-09-05 19:41:16 +03:00
Lunny Xiao d74390ee39 [skip ci] Updated translations via Crowdin 2022-09-01 00:20:54 +00:00
de5b8cfad8 Fix missed sort bug (#20996)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-08-31 14:15:12 -04:00
Lunny XiaoandGitHub b0c62846f1 Fix download archiver of a commit (#20962) 2022-08-26 15:07:06 +02:00
1d8543e7db Move some files into models' sub packages (#20262)
* Move some files into models' sub packages

* Move functions

* merge main branch

* Fix check

* fix check

* Fix some tests

* Fix lint

* Fix lint

* Revert lint changes

* Fix error comments

* Fix lint

Co-authored-by: 6543 <6543@obermui.de>
2022-08-25 10:31:57 +08:00
999392f6a5 Fix owners cannot create organization repos bug (#20841)
* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

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

Co-authored-by: Gusted <williamzijl7@hotmail.com>
2022-08-18 11:58:21 +03:00
Lunny XiaoandGitHub 5d0f643461 Fix migration file name (#20843) 2022-08-18 13:38:59 +08:00
a4e91c4197 Add proxy host into allow list (#20798)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-08-16 20:15:54 -04:00
1f146090ec Add migrate repo archiver and packages storage support on command line (#20757)
* Add migrate repo archiver and packages storage support on command line

* Fix typo

* Use stdCtx

* Use packageblob and fix command description

* Add migrate packages unit tests

* Fix comment year

* Fix the migrate storage command line description

* Update cmd/migrate_storage.go

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

* Update cmd/migrate_storage.go

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

* Update cmd/migrate_storage.go

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

* Fix test

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2022-08-16 12:05:15 +08:00
86c85c19b6 Refactor AssertExistsAndLoadBean to use generics (#20797)
* Refactor AssertExistsAndLoadBean to use generics

* Fix tests

Co-authored-by: zeripath <art27@cantab.net>
2022-08-16 10:22:25 +08:00
Lunny XiaoandGitHub d26b652260 Fix disabled open in vscode menu when disabling download source from UI (#20713) 2022-08-12 13:16:05 +08:00
Lunny XiaoandGitHub 98190d0024 Fix disable download button (#20701) 2022-08-08 15:42:36 +02:00
Lunny Xiao 73e9854040 [skip ci] Updated translations via Crowdin 2022-08-08 00:21:03 +00:00
Lunny XiaoandGitHub 5b4a84beb4 Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702) 2022-08-08 02:16:22 +02:00
589677fafb Add disable download source configuration (#20548)
Add configuration to enable/disable download source from UI.

Co-authored-by: zeripath <art27@cantab.net>
2022-07-31 18:57:02 +02:00
6554d5197f Fix possible panic when repository is empty (#20509)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-07-28 00:46:34 +08:00
Lunny XiaoandGitHub d6779c7ad3 Fix public org members displayed too many informations (#20403) 2022-07-19 12:22:38 +02:00
184a7d4195 Check if project has the same repository id with issue when assign project to issue (#20133)
* Check if project has the same repository id with issue when assign project to issue

* Check if issue's repository id match project's repository id

* Add more permission checking

* Remove invalid argument

* Fix errors

* Add generic check

* Remove duplicated check

* Return error + add check for new issues

* Apply suggestions from code review

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
2022-06-30 23:55:08 +08:00
Lunny XiaoandGitHub 85d960d2a1 Hide notify mail setting ui if not enabled (#20138) 2022-06-28 00:59:47 +08:00
Lunny XiaoandGitHub 8575050eba Update security information to add a public gpg key to make sending encrypted message possible (#20117) 2022-06-24 11:40:01 +02:00
Lunny XiaoandGitHub d0507efb6a Fix wrong login requirement routers (#20101) 2022-06-23 12:56:39 +02:00
Lunny Xiao 3ba09103a4 [skip ci] Updated translations via Crowdin 2022-06-23 00:10:20 +00:00
Lunny XiaoandGitHub fd97c4e0ae Use correct variable for issue count (#20085) 2022-06-22 11:26:32 -05:00
Lunny XiaoandGitHub 0649c54275 Adjust transaction handling via db.Context (#20031) 2022-06-20 14:38:58 +02:00
Lunny XiaoandGitHub 27ba86d283 move agit dependcy (#19998) 2022-06-17 20:17:12 +02:00
bdde56c95c Fix Readme render bug (#19992)
Fix #19988 

Co-authored-by: zeripath <art27@cantab.net>
2022-06-17 06:48:10 +01:00
Lunny XiaoandGitHub 1e05adfc3e Delete duplicated update btn on pull request view page (#19993)
Fix #19987
2022-06-17 05:52:06 +01:00
b01dce2a6e Allow render HTML with css/js external links (#19017)
* Allow render HTML with css/js external links

* Fix bug because of filename escape chars

* Fix lint

* Update docs about new configuration item

* Fix bug of render HTML in sub directory

* Add CSP head for displaying iframe in rendering file

* Fix test

* Apply suggestions from code review

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

* Some improvements

* some improvement

* revert change in SanitizerDisabled of external renderer

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

* refactor

* fix

* fix lint

* fine tune

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

* fine tune CSP

* Apply suggestions from code review

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-06-16 11:33:23 +08:00
Lunny XiaoandGitHub d91d4db344 Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
ff82a18315 Fix mirror template bug (#19959)
* Fix mirror template bug

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2022-06-13 18:12:59 +02:00
Lunny XiaoandGitHub 3c6c150740 Add deprecated log when using MySQL with utf8 charset (#19952) 2022-06-13 20:55:08 +08:00
Lunny XiaoandGitHub 1a9821f57a Move issues related files into models/issues (#19931)
* Move access and repo permission to models/perm/access

* fix test

* fix git test

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

* Move issues related code to models/issues

* Move some issues related sub package

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

* Rename some files
2022-06-13 17:37:59 +08:00
Lunny Xiao 5f136783d1 [skip ci] Updated translations via Crowdin 2022-06-13 00:10:09 +00:00
Lunny XiaoandGitHub 110fc57cbc Move some code into models/git (#19879)
* Move access and repo permission to models/perm/access

* fix test

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

* Fix build

* fix git test

* move lfs to sub package

* move more git related functions to models/git

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh
2022-06-12 23:51:54 +08:00
ce3dd04c63 Fix some mirror bugs (#18649)
* Fix some mirror bugs

* Remove unnecessary code

* Fix lint

* rename stdard url

* Allow more charactors in git ssh protocol url

* improve the detection

* support ipv6 for git url parse

* Fix bug

* Fix template

* Fix bug

* fix template

* Fix tmpl

* Fix tmpl

* Fix parse ssh with interface

* Rename functions name

Co-authored-by: zeripath <art27@cantab.net>
2022-06-11 21:50:14 +08:00
dbe415fb91 Only log non ErrNotExist errors in git.GetNote (#19884)
* Fix GetNote

* Only log errors if the error is not ErrNotExist

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

Co-authored-by: Andrew Thornton <art27@cantab.net>
2022-06-07 16:39:50 +08:00
26095115f4 Move some repository related code into sub package (#19711)
* Move some repository related code into sub package

* Move more repository functions out of models

* Fix lint

* Some performance optimization for webhooks and others

* some refactors

* Fix lint

* Fix

* Update modules/repository/delete.go

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

* Fix test

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

Co-authored-by: delvh <dev.lh@web.de>
2022-06-06 16:01:49 +08:00
Lunny XiaoandGitHub 48be5e77e5 Increment tests time out from 40m to 50m because sometimes the machine is slow (#19887) 2022-06-05 12:24:51 +08:00
12c742f8dc Fix order by parameter (#19849)
Upgrade builder to v0.3.11
Upgrade xorm to v1.3.1 and fixed some hidden bugs.

Replace #19821
Replace #19834
Included #19850

Co-authored-by: zeripath <art27@cantab.net>
2022-06-04 20:18:50 +01:00
Lunny XiaoandGitHub e09fb30d34 improvement some release related code (#19867) 2022-06-03 02:13:58 -04:00
Lunny XiaoandGitHub fd7d83ace6 Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
2022-05-20 22:08:52 +08:00
Lunny XiaoandGitHub d81e31ad78 Move org functions (#19753)
* Move org functions

* Fix comment
2022-05-20 12:20:51 +02:00
Lunny XiaoandGitHub ea38e90e6b Fix oauth setting list bug (#19682) 2022-05-11 21:06:02 +08:00
Lunny XiaoandGitHub cbd45471b1 Move access and repo permission to models/perm/access (#19350)
* Move access and repo permission to models/perm/access

* Remove unnecessary code
2022-05-11 12:09:36 +02:00
Lunny XiaoandGitHub 64a40962cc Fix new release from tags list UI (#19670) 2022-05-10 15:41:37 +03:00
Lunny XiaoandGitHub e435283c0f Don't select join table's columns (#19660)
* Don't select join table

* Add comment
2022-05-09 23:19:16 +08:00
Lunny XiaoandGitHub 9efa47131f Admin should not delete himself (#19423)
Admin should not be able to delete themselves.

Also partially fix #15449
2022-05-08 21:22:55 +01:00
Lunny XiaoandGitHub 290cc884f2 Restore reviewed-on message (#19657)
Regression from #18177
2022-05-08 20:13:27 +01:00
4ca1d7547a Move some helper files out of models (#19355)
* Move some helper files out of models

* Some improvements

Co-authored-by: delvh <dev.lh@web.de>
2022-05-08 18:46:32 +02:00
Lunny XiaoandGitHub d4834071da Repository level enable package or disable (#19323) 2022-05-08 17:51:50 +02:00
4344a64107 Allow custom default merge message with .gitea/default_merge_message/<merge_style>_TEMPLATE.md (#18177)
* Allow custom default merge message with .gitea/MERGE_MESSAGE_<merge_style>_TEMPLATE.md

* Some improvements

* Follow some advices

* Fix bug

* Fix bug

* Fix lint

* Fix close comment

* Fix test

* Fix and docs

* Improve codes

* Update docs and remove unnecessary variables

* return error for GetDefaultMergeMessage

* Fix test

* improve code

* ignore unknow unit type

* return error for GetDefaultMergeMessage

* Update services/pull/merge.go

* Some improvements

* Follow some advices

* Fix bug

* Fix lint

* Improve codes

* Update docs and remove unnecessary variables

* return error for GetDefaultMergeMessage

* improve code

* Handle deleted HeadRepo in GetDefaultMergeMessage

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

* Fix test

* Fix test

Co-authored-by: zeripath <art27@cantab.net>
2022-05-08 20:32:45 +08:00
Lunny XiaoandGitHub 772ad761eb Fix some slice problems (incorrect slice length) (#19592) 2022-05-03 17:04:23 +08:00
5651c650c0 When view _Siderbar or _Footer, just display once (#19501)
Co-authored-by: zeripath <art27@cantab.net>
2022-04-26 19:24:20 -04:00
Lunny XiaoandGitHub 2728f0c213 Fix migrate release from github (#19510)
* Fix migrate release from github

* Fix bug
2022-04-26 19:24:06 -04:00
Lunny XiaoandGitHub d71df01077 Refactor readme file renderer (#19502)
* Refactor readme file renderer

* improve
2022-04-26 16:31:15 -04:00
Lunny XiaoandGitHub 6cc8aed737 Fix two typos (#19504) 2022-04-26 18:01:42 +02:00
Lunny XiaoandGitHub 03eba32bd9 Add a new menu in file view to open blame view and fix blame view select range bug (#19500) 2022-04-26 13:54:40 +03:00
Lunny XiaoandGitHub 7c164d5a91 Use queue instead of memory queue in webhook send service (#19390) 2022-04-25 20:03:01 +02:00
Lunny XiaoandGitHub fc002860d8 Simplify the code to get issue count (#19380)
* Simple the code to get issue count

* Improve codes
2022-04-25 15:04:42 +08:00
Lunny XiaoandGitHub b8911fb456 Use a struct as test options (#19393)
* Use a struct as test options

* Fix name

* Fix test
2022-04-14 21:58:21 +08:00
Lunny XiaoandGitHub 1dfa26e00e Move milestone to models/issues/ (#19278)
* Move milestone to models/issues/

* Fix lint

* Fix test

* Fix lint

* Fix lint
2022-04-08 17:11:15 +08:00
Lunny XiaoandGitHub 3c3d49899f Remove dependent on session auth for api/v1 routers (#19321)
* Remove dependent on session auth for api/v1 routers

* Remove unnecessary session on API context

* remove missed header

* fix test

* fix missed api/v1
2022-04-08 06:22:10 +02:00
Lunny XiaoandGitHub 783a021889 Never use /api/v1 from Gitea UI Pages (#19318)
Reusing `/api/v1` from Gitea UI Pages have pros and cons.
Pros:
1) Less code copy

Cons:
1) API/v1 have to support shared session with page requests.
2) You need to consider for each other when you want to change something about api/v1 or page.

This PR moves all dependencies to API/v1 from UI Pages.

Partially replace #16052
2022-04-07 20:59:56 +02:00
Lunny XiaoandGitHub cf5d4a7230 Upgrade xorm/builder from v0.3.9 to v0.3.10 (#19296)
xorm/builder v0.3.10 add support to EXISTS and NOT EXISTS.
2022-04-02 04:14:14 +08:00
89b9d42f08 Fix broken of team create (#19288)
* Fix broken of team create

* Update models/organization/team.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-04-01 14:05:31 +08:00
Lunny XiaoandGitHub 3a73645502 Performance improvement for add team user when org has more than 1000 repositories (#19227)
* performance improvement for add team user when org has more than 1000 repositories

* Fix bug

* Fix bug
2022-04-01 09:53:18 +08:00
Lunny XiaoandGitHub 420851ca1f Fix global packages enabled avaiable (#19276)
Fix #19275
2022-03-31 19:31:53 +02:00
d4f84f1c93 Move reaction to models/issues/ (#19264)
* Move reaction to models/issues/

* Fix test

* move the function

* improve code

* Update models/issues/reaction.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-03-31 17:20:39 +08:00
Lunny XiaoandGitHub 74731c3a5a Move some issue methods as functions (#19255)
* Move some issue methods as functions

* Fix bug
2022-03-29 16:57:33 +02:00
bd97736b9c Move project files into models/project sub package (#17704)
* Move project files into models/project sub package

* Fix test

* Fix test

* Fix test

* Fix build

* Fix test

* Fix template bug

* Fix bug

* Fix lint

* Fix test

* Fix import

* Improve codes

Co-authored-by: 6543 <6543@obermui.de>
2022-03-29 22:16:31 +08:00
76aa33d884 Move init repository related functions to modules (#19159)
* Move init repository related functions to modules

* Fix lint

* Use ctx but db.DefaultContext

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-03-29 15:23:45 +08:00
b06b9a056c Move organization related structs into sub package (#18518)
* Move organization related structs into sub package

* Fix test

* Fix lint

* Move more functions into sub packages

* Fix bug

* Fix test

* Update models/organization/team_repo.go

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

* Apply suggestions from code review

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

* Fix fmt

* Follow suggestion from @Gusted

* Fix test

* Fix test

* Fix bug

* Use ctx but db.DefaultContext on routers

* Fix bug

* Fix bug

* fix bug

* Update models/organization/team_user.go

* Fix bug

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-03-29 14:29:02 +08:00
Lunny XiaoandGitHub 54961f3ac9 Use goproxy.io instead of goproxy.cn (#19242) 2022-03-28 20:01:07 +03:00
6526733a58 Let web and API routes have different auth methods group (#19168)
* remove the global methods but create dynamiclly

* Fix lint

* Fix windows lint

* Fix windows lint

* some improvements

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-03-28 12:46:28 +08:00
c29fbc6d23 Hide sensitive content on admin panel progress monitor (#19218)
Sanitize urls within git process descriptions.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2022-03-27 12:54:09 +01:00
Lunny XiaoandGitHub 18033f49ba 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.
2022-03-14 18:39:54 +01:00
Lunny XiaoandGitHub 49db87a035 Fix lfs bug (#19072)
* Fix lfs bug
2022-03-14 16:18:27 +01:00
Lunny XiaoandGitHub 2448c5ad8b Upgrading binding package (#19034)
Fix #18855
2022-03-09 18:06:58 +00:00
b24e8d38af 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>
2022-03-06 16:41:54 +08:00
Lunny XiaoandGitHub 814750e647 Fix update hint bug (#18996) 2022-03-04 20:59:29 +00:00
04971c33a3 Improve the deletion of issue (#18945)
Co-authored-by: 6543 <6543@obermui.de>
2022-03-02 18:38:56 +01:00
Lunny XiaoandGitHub 38f6322164 Fix lfs management setting (#18946)
Fix #18782
2022-03-01 23:14:27 +00:00
Lunny XiaoandGitHub b75ad7b87f Improve mirror iterator (#18928)
* Improve mirror iterator

* fix test
2022-02-28 20:41:06 +01:00
Lunny XiaoandGitHub 59959ab222 Fix login with email panic when email is not exist (#18941) 2022-02-28 18:33:33 +01:00
36d31d521d Fix team management UI (#18886)
Co-authored-by: 6543 <6543@obermui.de>
2022-02-25 16:19:54 -05:00
Lunny XiaoandGitHub a5e8daee73 Fix migration v210 (#18892) 2022-02-25 15:04:59 +01:00
Lunny XiaoandGitHub 6621710deb Fix update user (#18878) 2022-02-24 19:29:10 +01:00
Lunny XiaoandGitHub f1b1472632 Fix ldap user sync missed email in email_address table (#18786)
* Fix ldap user sync missed email in email_address table

* Fix test
2022-02-24 14:13:59 +08:00
2b5e013430 Fix ldap edit bug (#18856)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-02-22 17:07:04 -05:00
dc988eae0c Fix bug for get user by email (#18833)
Co-authored-by: zeripath <art27@cantab.net>
2022-02-21 22:20:34 +08:00
Lunny XiaoandGitHub 00be0c1b21 Fix login with email for ldap users (#18800)
`authenticator.Authenticate` has assume the login name is not an email, but `username` maybe an email. So when we find the user via email address, we should use `user.LoginName` instead of `username` which is an email address.
2022-02-20 10:28:58 +00:00
Lunny XiaoandGitHub 931c2f40e7 Put buttons back in org dashboard (#18817)
Fix #18523
2022-02-19 12:08:12 +00:00
Lunny XiaoandGitHub a7b9d44d88 Fix problem when self-assign notification (#18797) 2022-02-18 14:06:57 +08:00
Lunny XiaoandGitHub 397d2ac303 Move deletebeans into models/db (#18781) 2022-02-17 16:37:48 +08:00
Lunny XiaoandGitHub f48771ae78 Fix template bug of LFS lock (#18784) 2022-02-16 11:22:25 -05:00
5348e198db Add example to render html files (#18736)
* Add example to render html files

* Use class in example

Co-authored-by: zeripath <art27@cantab.net>
2022-02-14 21:56:17 +08:00
08fe6f8c7e Fix broken cancel button link on patch page (#18718)
* Fix broken cacnel button link on patch page

* remove treepath="patch" elsewhere too

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

Co-authored-by: zeripath <art27@cantab.net>
2022-02-14 09:18:55 +00:00
Lunny XiaoandGitHub 581a563cac Ignore the migrate if u2f_registration is not exist (#18760) 2022-02-14 08:13:17 +00:00
Lunny XiaoandGitHub 1b1658d887 Fix isempty detection of git repository (#18746)
* Fix isempty detection of git repository

* Fix IsEmpty check
2022-02-14 00:01:23 +08:00