Backport #26490 related: #26012 1. missing project filter on the issue page. 1e76a824bc/modules/indexer/issues/dboptions.go (L11-L15) 2. incorrect SQL condition: some issue does not belong to a project but exists on the project_issue table. f5dbac9d36/models/issues/issue_search.go (L233) ![before](https://github.com/go-gitea/gitea/assets/50507092/1dcde39e-3e2f-4151-b2c6-4d67bf493c2f) ![after](https://github.com/go-gitea/gitea/assets/50507092/badfb81f-056d-4a2f-9838-1cba9c15768d) (cherry picked from commit 94f86964b4)
1e76a824bc/modules/indexer/issues/dboptions.go (L11-L15)
f5dbac9d36/models/issues/issue_search.go (L233)
94f86964b4
Access the issue list page and select `No assignee`, you will get 500 error: ![image](https://github.com/go-gitea/gitea/assets/18380374/a7435fd3-c3d5-4801-894e-9353a8ddc1af) You can see this page in try.gitea.io: https://try.gitea.io/yp05327/testrepo/issues?q=&type=all&sort=&state=open&labels=&milestone=0&project=0&assignee=-1&poster=0 Caused by https://github.com/go-gitea/gitea/pull/24707/files#diff-d7c7dc2da4fcfdc09997648e11a018414dc116472054350b5590ab407adcd44dR1748 Co-authored-by: Giteabot <teabot@gitea.io>
This PR - [x] Move some functions from `issues.go` to `issue_stats.go` and `issue_label.go` - [x] Remove duplicated issue options `UserIssueStatsOption` to keep only one `IssuesOptions`