gitea/models
Giteabot c334be8284
Fix empty project displayed in issue sidebar (#25802) (#25854)
Backport #25802 by @yp05327

You can confirm this issue in
https://try.gitea.io/yp05327/testrepo/issues/2

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/1ab476dc-2f9b-4c85-9e87-105fc73af1ee)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/786f984d-5c27-4eff-b3d9-159f68034ce4)

This issue comes from the change in #25468.
`LoadProject` will always return at least one record, so we use
`ProjectID` to check whether an issue is linked to a project in the old
code.
As other `issue.LoadXXX` functions, we need to check the return value
from `xorm.Session.Get`.

In recent unit tests, we only test `issueList.LoadAttributes()` but
don't test `issue.LoadAttributes()`. So I added a new test for
`issue.LoadAttributes()` in this PR.

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Denys Konovalov <privat@denyskon.de>
2023-07-12 19:07:03 +02:00
..
actions Fix content holes in Actions task logs file (#25560) (#25566) 2023-06-28 23:39:23 +00:00
activities Use a separate admin page to show global stats, remove actions stat (#25062) 2023-06-03 22:03:41 +08:00
admin Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
asymkey Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
auth Add ability to set multiple redirect URIs in OAuth application UI (#25072) 2023-06-05 15:00:12 +08:00
avatars Avoid warning for system setting when start up (#23054) 2023-02-24 18:23:13 +08:00
db Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
dbfs Fix content holes in Actions task logs file (#25560) (#25566) 2023-06-28 23:39:23 +00:00
fixtures Fix incorrect oldest sort in project list (#25806) (#25835) 2023-07-12 13:22:17 +08:00
git Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
issues Fix empty project displayed in issue sidebar (#25802) (#25854) 2023-07-12 19:07:03 +02:00
migrations Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
organization Remove unused code (#25734) (#25788) 2023-07-09 19:47:58 +00:00
packages Test if container blob is accessible before mounting (#22759) (#25784) 2023-07-09 12:00:04 +00:00
perm Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
project Fix incorrect oldest sort in project list (#25806) (#25835) 2023-07-12 13:22:17 +08:00
pull refactor some functions to support ctx as first parameter (#21878) 2022-12-03 10:48:26 +08:00
repo For API attachments, use API URL (#25639) (#25814) 2023-07-10 12:56:16 +00:00
secret Respect original content when creating secrets (#24745) 2023-05-16 14:49:40 +08:00
shared/types Display owner of a runner as a tooltip instead of static text (#24377) 2023-05-12 08:43:27 +00:00
system Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
unit Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
unittest Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
user Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
webhook Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00
error.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fixture_generation.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fixture_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
main_test.go Merge setting.InitXXX into one function with options (#24389) 2023-05-04 11:55:35 +08:00
migrate_test.go Check primary keys for all tables and drop ForeignReference (#21721) 2022-12-23 19:35:43 +08:00
migrate.go Check primary keys for all tables and drop ForeignReference (#21721) 2022-12-23 19:35:43 +08:00
org_team_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org_team.go Remove org users who belong to no teams (#24247) 2023-04-24 15:52:38 -04:00
org_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org.go refactor some functions to support ctx as first parameter (#21878) 2022-12-03 10:48:26 +08:00
repo_collaboration_test.go Rename repo.GetOwner to repo.LoadOwner (#22967) 2023-02-18 20:11:03 +08:00
repo_collaboration.go refactor some functions to support ctx as first parameter (#21878) 2022-12-03 10:48:26 +08:00
repo_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_transfer_test.go Rename almost all Ctx functions (#22071) 2022-12-10 10:46:31 +08:00
repo_transfer.go Fix unclear IsRepositoryExist logic (#24374) 2023-04-28 14:14:26 -04:00
repo.go Replace interface{} with any (#25686) (#25687) 2023-07-04 23:41:32 -04:00