aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-07-12 23:10:35 +0900
committerGitHub <noreply@github.com>2023-07-12 16:10:35 +0200
commit8b89563bf1031089a218e6d05dc61047281b35ee (patch)
tree3da01a7882437bf32daf0fd843d7099f1ed52806 /routers/web/org
parentb137a032977b39925f95baedf80acf4c2a10f6a0 (diff)
downloadgitea-8b89563bf1031089a218e6d05dc61047281b35ee.tar.gz
gitea-8b89563bf1031089a218e6d05dc61047281b35ee.zip
Fix empty project displayed in issue sidebar (#25802)
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: Denys Konovalov <privat@denyskon.de>
Diffstat (limited to 'routers/web/org')
-rw-r--r--routers/web/org/projects.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go
index 60032c777d..50bb5591e5 100644
--- a/routers/web/org/projects.go
+++ b/routers/web/org/projects.go
@@ -438,8 +438,7 @@ func UpdateIssueProject(ctx *context.Context) {
projectID := ctx.FormInt64("id")
for _, issue := range issues {
if issue.Project != nil {
- oldProjectID := issue.Project.ID
- if oldProjectID == projectID {
+ if issue.Project.ID == projectID {
continue
}
}