gitea/routers/web
Lunny Xiao d21ce9fa07
Improve the performance when detecting the file editable (#34653)
Noticed the SQL will be executed 4 times when visit the file render view
page. For a repository which have many pull requests, it maybe slow.
```SQL
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 2.004167ms
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 1.03975ms
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 881.583µs
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 935.084µs
```

This PR did a refactor to query it once only.
2025-06-12 18:12:45 +00:00
..
admin Fix last admin check when syncing users (#34649) 2025-06-09 20:57:45 +00:00
auth Fix last admin check when syncing users (#34649) 2025-06-09 20:57:45 +00:00
devtest Grey out expired artifact on Artifacts list (#34314) 2025-05-05 21:53:17 -07:00
events Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
explore Do not mutate incoming options to SearchRepositoryByName (#34553) 2025-06-02 17:33:25 +00:00
feed feat(api): add date range filtering to commit retrieval endpoints (#34497) 2025-05-19 18:57:58 -07:00
healthcheck Always enable caches (#28527) 2023-12-19 09:29:05 +00:00
misc Fix various problems (#34708) 2025-06-12 09:19:24 -07:00
org Validate hex colors when creating/editing labels (#34623) 2025-06-07 11:25:08 +03:00
repo Improve the performance when detecting the file editable (#34653) 2025-06-12 18:12:45 +00:00
shared Refactor FindOrgOptions to use enum instead of bool, fix membership visibility (#34629) 2025-06-09 03:30:34 +00:00
user Only activity tab needs heatmap data loading (#34652) 2025-06-09 21:02:16 +08:00
base.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
githttp.go Fix git client accessing renamed repo (#34034) 2025-03-28 07:28:58 +08:00
goget.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
home.go Do not mutate incoming options to SearchRepositoryByName (#34553) 2025-06-02 17:33:25 +00:00
metrics.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
nodeinfo.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
passkey.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
swagger_json.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
web.go Add "View workflow file" to Actions list page (#34538) 2025-05-28 20:30:00 +08:00
webfinger.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00