Commit Graph
100 Commits
Author SHA1 Message Date
Lunny Xiao 39a01016cd Upgrade dependency crypto library (#32750) 2024-12-11 13:07:48 -05:00
Lunny Xiao fbe6d9dc6b Use batch database operations instead of one by one to optimze api pulls (#32680)
Resolve #31492

The response time for the Pull Requests API has improved significantly,
dropping from over `2000ms` to about `350ms` on my local machine. It's
about `6` times faster.

A key area for further optimization lies in batch-fetching data for
`apiPullRequest.ChangedFiles, apiPullRequest.Additions, and
apiPullRequest.Deletions`.

Tests `TestAPIViewPulls` does exist and new tests added.

- This PR also fixes some bugs in `GetDiff` functions.
- This PR also fixes data inconsistent in test data. For a pull request,
the head branch's reference should be equal to the reference in
`pull/xxx/head`.
2024-12-11 05:15:06 +08:00
Lunny Xiao 9d08d3fbf5 Fix compare page bug view as anonymous (#32754)
Fix a bug introduced from
https://github.com/go-gitea/gitea/pull/32403/files#diff-dc86301f15109eee38296d469630672193e0587ad1485fdd8f503bf4c789cf7eR692
2024-12-08 14:38:21 +08:00
Lunny Xiao cd7bf77b2f Split issue/pull view router function as multiple smaller functions (#32749)
This PR splits issue/pull view function into multiple smaller functions.
It also removed duplicated branches load.
2024-12-08 04:39:35 +00:00
Lunny Xiao 5a75160c92 Update changelog to add missed changelog (#32734) 2024-12-06 17:31:43 +00:00
Lunny Xiao b32f0cdfa0 Make wiki pages visit fast (#32732) 2024-12-06 07:39:50 +00:00
Lunny Xiao c5422fae9a Fix fork page branch selection (#32711)
Fix #32709
2024-12-05 00:57:32 +00:00
Lunny Xiao 5ab7aa700f Use new mail package instead of an unmintained one (#32682)
Resolve #18664
2024-12-05 06:33:43 +08:00
Lunny Xiao e45ffc530f Remove outdated code about fixture generation (#32708) 2024-12-04 07:59:28 +00:00
Lunny Xiao 17053e953f Fix delete branch perm checking (#32654) 2024-12-04 11:59:48 +08:00
Lunny Xiao 829c34129c Quick fix for license file name (#32696) 2024-12-03 07:59:07 -08:00
Lunny Xiao 79d593a9be Split mail sender sub package from mailer service package (#32618)
Move all mail sender related codes into a sub package of
services/mailer. Just move, no code change.
Then we just have dependencies on go-mail package in the new sub
package. We can use other package to replace it because it's
unmaintainable. ref #18664
2024-11-30 01:15:41 +00:00
Lunny Xiao 1ed5f379b9 Move GetFeeds to service layer (#32526)
Move GetFeeds from models to service layer, no code change.
2024-11-29 17:53:49 +00:00
Lunny Xiao 00f8090de4 Don't create action when syncing mirror pull refs (#32659)
Fix #27961
2024-11-28 07:43:38 +00:00
Lunny Xiao f62f68cbdd Move team related functions to service layer (#32537)
There are still some functions under `models` after last big refactor
about `models`. This change will move all team related functions to
service layer with no code change.
2024-11-27 21:12:26 +00:00
Lunny Xiao f49d82309b Introduce OrgList and add LoadTeams, optimaze Load teams for orgs (#32543) 2024-11-26 21:55:06 +00:00
Lunny Xiao 703be6bf30 Add github compatible tarball download API endpoints (#32572)
Fix #29654 
Fix #32481
2024-11-25 19:35:49 +00:00
Lunny Xiao c363bd06e9 Strict pagination check (#32548) 2024-11-25 09:56:50 +08:00
Lunny Xiao fe49cb0243 Fix get reviewers' bug (#32415)
This PR rewrites `GetReviewer` function and move it to service layer.

Reviewers should not be watchers, so that this PR removed all watchers
from reviewers. When the repository is under an organization, the pull
request unit read permission will be checked to resolve the bug of
#32394

Fix #32394
2024-11-22 10:44:48 -05:00
Lunny Xiao a175f9805c Add line-through for deleted branch on pull request view page (#32500)
Base branch deleted

![图片](https://github.com/user-attachments/assets/bc45aa33-d514-47c8-885a-de9732f2f3d5)

branch deleted comment

![图片](https://github.com/user-attachments/assets/83729bbb-2ee8-4bd3-b6f1-780d2daad3d4)

Head branch deleted

![图片](https://github.com/user-attachments/assets/90120b22-34a9-4387-aae9-5c882e8d421a)
2024-11-21 17:04:18 +00:00
Lunny Xiao 9bf821ae6c Fix GetInactiveUsers (#32540)
Fix #31480
2024-11-21 04:55:32 +00:00
Lunny Xiaoandwxiaoguang 33850a83fe Fix submodule parsing (#32571)
Fix #32568, parse `.gitmodules` correctly

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-11-20 19:26:12 +00:00
Lunny Xiao 0d5abd9b3e Remove unnecessary code (#32560)
PushMirrors only be used in the repository setting page. So it should
not be loaded on every repository page.
2024-11-19 16:21:13 +00:00
Lunny Xiao 896314c7a2 Fix some places which doesn't repsect org full name setting (#32243)
Partially fix #31345
2024-11-18 06:24:49 +00:00
Lunny Xiaoandwxiaoguang 696fbe6036 Refactor push mirror find and add check for updating push mirror (#32539)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-11-18 05:59:04 +00:00
Lunny Xiaoandwxiaoguang 4f879a00df Refactor find forks and fix possible bugs that weak permissions check (#32528)
- Move models/GetForks to services/FindForks
- Add doer as a parameter of FindForks to check permissions
- Slight performance optimization for get forks API with batch loading
of repository units
- Add tests for forking repository to organizations

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-11-18 03:06:25 +00:00
Lunny Xiao f122aaf9ff Use better name for userinfo structure (#32544) 2024-11-18 10:41:59 +08:00
Lunny Xiao c3dedcffa7 Fix basic auth with webauthn (#32531) 2024-11-16 17:52:16 +00:00
Lunny Xiao e1b269e956 Remove transaction for archive download (#32186)
Since there is a status column in the database, the transaction is
unnecessary when downloading an archive. The transaction is blocking
database operations, especially with SQLite.

Replace #27563
2024-11-15 12:04:20 +08:00
Lunny Xiao 4121f952d1 Fix oauth2 error handle not return immediately (#32514) 2024-11-15 02:13:01 +00:00
Lunny Xiao 98d9a71ffe Trim title before insert/update to database to match the size requirements of database (#32498)
Fix #32489
2024-11-14 07:19:14 +00:00
Lunny XiaoandZettat123 b4abb6deff Reimplement GetUserOrgsList to make it simple and clear (#32486)
Reimplement GetUserOrgsList and also move some functions and test to
org_list file.

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-11-14 05:31:47 +00:00
840ad7eefe Disable Oauth check if oauth disabled (#32368)
Fix #32367

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-11-12 21:33:35 +00:00
Lunny Xiaoandwxiaoguang a1892cf7e3 Move some functions from issue.go to standalone files (#32468)
Just functions move, no code change.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-11-11 04:28:54 +00:00
Lunny Xiao 331e878e81 Add new event commit status creation and webhook implementation (#27151)
This PR introduces a new event which is similar as Github's. When a new
commit status submitted, the event will be trigged. That means, now we
can receive all feedback from CI/CD system in webhooks or other notify
systems.

ref:
https://docs.github.com/en/webhooks/webhook-events-and-payloads#status

Fix #20749
2024-11-07 06:41:49 +00:00
Lunny Xiao 276500c314 Move AddCollabrator and CreateRepositoryByExample to service layer (#32419)
- [x] Move `CreateRepositoryByExample` to service layer
- [x] Move `AddCollabrator` to service layer
- [x] Add a new parameter for `AddCollabrator` so that changing mode
immediately after that will become unnecessary.
2024-11-07 11:28:11 +08:00
Lunny Xiao 913be9e8ac Add new index for action to resolve the performance problem (#32333)
Fix #32224
2024-11-06 22:04:48 +00:00
24b83ff63e Fix milestone deadline and date related problems (#32339)
Use zero instead of 9999-12-31 for deadline
Fix #32291

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-11-05 07:46:40 +00:00
Lunny Xiao 1887c75c35 Only query team tables if repository is under org when getting assignees (#32414)
It's unnecessary to query the team table if the repository is not under
organization when getting assignees.
2024-11-05 07:13:52 +00:00
Lunny Xiao 13a203828c Fix created_unix for mirroring (#32342)
Fix #32233
2024-11-02 06:11:38 +00:00
Lunny Xiaoandwxiaoguang feca8802b8 Fix clean tmp dir (#32360)
Try to fix #31792 

Credit to @jeroenlaylo
Copied from
https://github.com/go-gitea/gitea/issues/31792#issuecomment-2311920520

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-29 18:27:03 +02:00
Lunny Xiao 2abdbe88b5 Fix disable 2fa bug (#32320) 2024-10-23 06:41:00 +00:00
Lunny Xiao d46d34a655 Upgrade rollup to 4.24.0 (#32312) 2024-10-23 05:00:32 +00:00
Lunny Xiao 500774277c Upgrade vue to 3.5.12 (#32311) 2024-10-23 04:55:17 +00:00
Lunny Xiao a264c46fb0 Add warn log when deleting inactive users (#32318)
Add log for the problem #31480
2024-10-23 09:28:28 +08:00
Lunny Xiao 9df5ddaf44 Only rename a user when they should receive a different name (#32247)
Fix #31996
2024-10-13 03:13:55 +00:00
Lunny Xiao aebb741c08 Use per package global lock for container uploads instead of memory lock (#31860)
This PR uses a per-package lock instead of a global lock for container
uploads. So that different packages can be uploaded simultaneously.
2024-10-11 07:37:49 +00:00
Lunny Xiaoandwxiaoguang c2217670dd Move admin routers from /admin to /-/admin (#32189)
Resolve #32181

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-10 04:56:49 +00:00
Lunny Xiao d6d3c96e65 Fix bug when a token is given public only (#32204) 2024-10-08 12:51:09 +03:00
Lunny Xiao fa35ace9fb Fix bug when there are multiple triggers with workflow dispatch (#32200) 2024-10-07 03:50:38 +00:00
Lunny Xiaoandwxiaoguang a989404e23 Fix javascript error when an anonymous user visiting migration page (#32144)
This PR fixes javascript errors when an anonymous user visits the
migration page.
It also makes task view checking more restrictive.

The router moved from `/user/task/{id}/status` to
`/username/reponame/-/migrate/status` because it's a migrate status.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-02 04:37:16 +00:00
Lunny Xiao 3a4a1bffbe Make oauth2 code clear. Move oauth2 provider code to their own packages/files (#32148)
Fix #30266
Replace #31533
2024-10-02 08:03:19 +08:00
Lunny Xiao 3f9e360142 Don't join repository when loading action table data (#32127) 2024-09-26 04:50:30 +00:00
Lunny Xiao 5a8568459d Fix bug when deleting a migrated branch (#32075)
After migrating a repository with pull request, the branch is missed and
after the pull request merged, the branch cannot be deleted.
2024-09-24 07:42:08 +00:00
Lunny Xiao 4947bec836 Include collaboration repositories on dashboard source/forks/mirrors list (#31946)
Fix #13489

In the original implementation, only `All` will display your owned and
collaborated repositories. For other filters like `Source`, `Mirrors`
and etc. will only display your owned repositories.

This PR removed the limitations. Now except `collbrations`, other
filters will always display your owned and collaborated repositories.
2024-09-24 07:12:06 +00:00
Lunny Xiao e2f365b55c Display head branch more comfortable on pull request view (#32000)
This PR do some minor improvements for head branch display on pull
request view UI.

- [x] Remove the link if the head branch has been deleted with a
tooltip, so that users will not result in a 404 page
- [x] Display a label if this pull request is an agit based one.

![图片](https://github.com/user-attachments/assets/872f26b6-f1cf-4427-9e41-e3a5b176dfa4)
2024-09-24 04:14:57 +00:00
Lunny Xiao 2c6fa6c1e0 Fix template bug of pull request view (#32072)
Caused by #31924
2024-09-24 03:02:42 +00:00
Lunny Xiao 6eb5950835 Allow set branch protection in an empty repository (#32095) 2024-09-24 02:06:28 +00:00
Lunny Xiao 3f2d8f8730 Fix panic when cloning with wrong ssh format. (#32076) 2024-09-24 01:30:05 +00:00
Lunny Xiao 9e0db1b646 Fix rename branch permission bug (#32066)
The previous implementation requires admin permission to rename branches
which should be write permission.

Fix #31993
2024-09-22 18:08:27 +00:00
Lunny Xiao a802508f88 Fix wrong last modify time (#32102) 2024-09-21 21:56:25 +00:00
Lunny Xiao 5de41737a5 Fix upload maven pacakge parallelly (#31851)
Use globallock for maven package uploads.

Thanks @tlusser for the test code.

Depends on ~#31813~
2024-09-21 19:26:45 +00:00
Lunny Xiao 8e2dd5d3dd Use camo.Always instead of camo.Allways (#32097)
Fix #31575 

https://gitea.com/gitea/docs/pulls/73
2024-09-21 12:50:54 +03:00
Lunny Xiao 8cdf4e29c4 Fix CI (#32062) 2024-09-17 19:35:59 +00:00
Lunny Xiao 3febcaa53b Use a common message template instead of a special one (#31878) 2024-09-14 17:17:49 +00:00
Lunny Xiao d8f3498875 Upgrade cache to v0.2.1 (#32003)
Fix #31757
2024-09-07 17:12:37 +00:00
Lunny XiaoandJason Song 2da2000413 Use global lock instead of NewExclusivePool to allow distributed lock between multiple Gitea instances (#31813)
Replace #26486 
Fix #19620

---------

Co-authored-by: Jason Song <i@wolfogre.com>
2024-09-06 10:12:41 +00:00
Lunny Xiao a5818470fe Use forum.gitea.com instead of old URL (#31989) 2024-09-06 07:20:30 +00:00
Lunny Xiao 5c05dddbed Fix nuget/conan/container packages upload bugs (#31967) 2024-09-05 07:05:42 +00:00
Lunny Xiao a366af4b7a Remove html tags from create tag and branch translation (#31973)
Follow #31950 and Fix the display bug of #31966 .

This will only fix the English version. I will update all these
translation files in crowdin after this merged so that all the languages
can be fixed.

And all these files should be backported together.

This PR remove the bold effect around the name when creating a new tag
or branch.
2024-09-04 12:53:55 +08:00
Lunny Xiaoandtechknowlogick 7eef261c3e Replace v-html with v-text in search inputbox (#31966)
Credit for @techknowlogick

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
2024-09-04 02:52:00 +00:00
Lunny Xiaoanddelvh 85b1f3080c Improve get feed with pagination (#31821)
Fix #31752

@somera

---------

Co-authored-by: delvh <dev.lh@web.de>
2024-09-02 19:05:09 +00:00
Lunny Xiao ac34449747 Prevent update pull refs manually and will not affect other refs update (#31931)
All refs under `refs/pull` should only be changed from Gitea inside but
not by pushing from outside of Gitea.
This PR will prevent the pull refs update but allow other refs to be
updated on the same pushing with `--mirror` operations.

The main changes are to add checks on `update` hook but not
`pre-receive` because `update` will be invoked by every ref but
`pre-receive` will revert all changes once one ref update fails.
2024-09-02 07:38:27 +00:00
Lunny Xiao 286ede47ad Fix index too many file names bug (#31903)
Try to fix #31884
Fix #28584
2024-09-01 05:57:31 +00:00
Lunny Xiao 06c67c6d5a Fix search team (#31923)
Fix #20658
2024-08-29 13:26:25 +00:00
Lunny Xiao fcac28c878 Upgrade micromatch to 4.0.8 (#31939) 2024-08-29 04:54:38 +00:00
Lunny Xiao 0299bb97f0 Use correct function name (#31887) 2024-08-21 21:05:48 +00:00
Lunny Xiao d158472a5a Don't return 500 if mirror url contains special chars (#31859)
Fix #31640
2024-08-21 01:54:55 +00:00
Lunny Xiao c03baab678 Refactor the usage of batch catfile (#31754)
When opening a repository, it will call `ensureValidRepository` and also
`CatFileBatch`. But sometimes these will not be used until repository
closed. So it's a waste of CPU to invoke 3 times git command for every
open repository.

This PR removed all of these from `OpenRepository` but only kept
checking whether the folder exists. When a batch is necessary, the
necessary functions will be invoked.
2024-08-20 17:04:57 +00:00
Lunny Xiao 8b92eba21f Fix agit automerge (#31207) 2024-08-20 14:17:21 +08:00
Lunny Xiao ccf7366db0 Add tag name in the commits list (#31082)
Fix #10036

This PR adds some labels for tags of this commit after the commit
message on the commits table. The tag template is share as commit
graph's.

Desktop:
<img width="1302" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/ba94e1e6-2a3d-44f3-85a3-575fb5667c97">

Mobile:
<img width="370" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/e3eb1f44-3686-4012-aa9d-52cd88b22c0e">
2024-08-19 17:04:06 +00:00
Lunny Xiao 4f5c96627b Fix actions notify bug (#31866)
Try to fix
https://github.com/go-gitea/gitea/issues/31757#issuecomment-2295131062
2024-08-19 16:25:41 +00:00
Lunny Xiao b491b2104f Fix panic of ssh public key page after deletion of auth source (#31829)
Fix #31730 

This PR rewrote the function `PublicKeysAreExternallyManaged` with a
simple test. The new function removed the loop to make it more readable.
2024-08-15 23:59:01 +08:00
791d7fc76a Add issue comment when moving issues from one column to another of the project (#29311)
Fix #27278
Replace #27816

This PR adds a meta-comment for an issue when dragging an issue from one
column to another of a project.

<img width="600" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
2024-08-09 01:29:02 +00:00
Lunny Xiao df7f1c2ead Fix protected branch files detection on pre_receive hook (#31778)
Fix #31738

When pushing a new branch, the old commit is zero. Most git commands
cannot recognize the zero commit id. To get the changed files in the
push, we need to get the first diverge commit of this branch. In most
situations, we could check commits one by one until one commit is
contained by another branch. Then we will think that commit is the
diverge point.

And in a pre-receive hook, this will be more difficult because all
commits haven't been merged and they actually stored in a temporary
place by git. So we need to bring some envs to let git know the commit
exist.
2024-08-06 13:32:49 +00:00
Lunny Xiao 572aaebd96 Rename head branch of pull requests when renaming a branch (#31759)
Fix #31716
2024-08-04 03:21:42 +00:00
Lunny Xiao 976f78eb77 Fix wiki revision pagination (#31760)
Fix #31755
2024-08-03 18:35:55 +00:00
Lunny Xiao 237b981164 Upgrade bleve to 2.4.2 (#31762) 2024-08-02 19:32:31 +00:00
Lunny Xiao d109923ed8 Make GetRepositoryByName more safer (#31712)
Fix #31708
2024-07-29 01:32:54 +00:00
Lunny Xiaoand6543 0d08bb6112 Upgrade xorm to v1.3.9 and improve some migrations Sync (#29899)
Co-authored-by: 6543 <6543@obermui.de>
2024-07-14 17:15:59 -04:00
Lunny Xiao 1b0ccf4bea Upgrade security public key (#31594)
Fix #31591
2024-07-10 16:28:22 +00:00
Lunny Xiao 436af472a9 Fix wrong merge on removing docs (#31605) 2024-07-10 15:47:32 +00:00
Lunny Xiao af1f0dfcc6 Remove docs sub folder since docs has been moved to https://gitea.com/gitea/docs (#31536) 2024-07-10 01:46:08 +00:00
Lunny Xiao fa82a8af12 Have new announcement about docs contributions (#31364)
According to the maintainers' discussion and voting. We decide to move
docs to https://gitea.com/gitea/docs . Add some hints on this repository
to not make contributors confusing.
2024-06-14 11:17:05 +08:00
Lunny Xiao e4abaff7ff Fix bug filtering issues which have no project (#31337)
Fix #31327
This is a quick patch to fix the bug.
Some parameters are using 0, some are using -1. I think it needs a
refactor to keep consistent. But that will be another PR.
2024-06-14 02:31:07 +00:00
Lunny Xiao 7115dce773 Fix hash render end with colon (#31319)
Fix a hash render problem like `<hash>: xxxxx` which is usually used in
release notes.
2024-06-12 22:35:46 +00:00
Lunny Xiao 1968c2222d Fix adopt repository has empty object name in database (#31333)
Fix #31330
Fix #31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.
2024-06-12 18:22:01 +08:00
Lunny Xiao 2788a7ca27 Fix agit checkout command line hint & fix ShowMergeInstructions checking (#31219) 2024-06-03 06:45:21 +08:00
Lunny Xiao 98a61040b1 Fix the possible migration failure on 286 with postgres 16 (#31209)
Try to fix #31205
2024-06-02 03:01:08 +00:00
352a2cae24 Performance improvements for pull request list API (#30490)
Fix #30483

---------

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-05-31 12:10:11 +00:00