-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Fix empty project displayed in issue sidebar #25802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ccce338
50b9574
e76a717
6c4eef4
901d374
0168d6b
ec6000e
6d3529b
632f284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,13 +16,14 @@ import ( | |||||||
| func (issue *Issue) LoadProject(ctx context.Context) (err error) { | ||||||||
| if issue.Project == nil { | ||||||||
| var p project_model.Project | ||||||||
| if _, err = db.GetEngine(ctx).Table("project"). | ||||||||
| has, err := db.GetEngine(ctx).Table("project"). | ||||||||
| Join("INNER", "project_issue", "project.id=project_issue.project_id"). | ||||||||
| Where("project_issue.issue_id = ?", issue.ID). | ||||||||
| Get(&p); err != nil { | ||||||||
| Where("project_issue.issue_id = ?", issue.ID).Get(&p) | ||||||||
| if err != nil { | ||||||||
| return err | ||||||||
| } else if has { | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Not a blocker. But these are two different checks
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They look the same to me. 🤔
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically you are 💯 correct. From the readability point of view PS: No blocker my side. Just a thought. :) |
||||||||
| issue.Project = &p | ||||||||
| } | ||||||||
| issue.Project = &p | ||||||||
| } | ||||||||
| return err | ||||||||
| } | ||||||||
|
|
||||||||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasis almost idiomatic within the gitea coderesis not what's returned here: The function returnsbool, err, not<any>, errto show whether the pointer got a new value (see 3.)&pmeans that the variablepis changed directly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only potential alternative to
hasthat would make sense and is also used throughout the code isexistswhich is probably a better name for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay, didn't know that it is used in Gitea 😆