-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix tautological conditions #30735
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
Fix tautological conditions #30735
Changes from all commits
52c003a
392a25b
b88d4db
62ae228
ec76a02
95f5f64
c02d91d
5e19ed5
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 |
---|---|---|
|
@@ -211,13 +211,11 @@ func ToLabel(label *issues_model.Label, repo *repo_model.Repository, org *user_m | |
IsArchived: label.IsArchived(), | ||
} | ||
|
||
labelBelongsToRepo := label.BelongsToRepo() | ||
|
||
// calculate URL | ||
if label.BelongsToRepo() && repo != nil { | ||
if repo != nil { | ||
silverwind marked this conversation as resolved.
Show resolved
Hide resolved
|
||
result.URL = fmt.Sprintf("%s/labels/%d", repo.APIURL(), label.ID) | ||
} else { | ||
log.Error("ToLabel did not get repo to calculate url for label with id '%d'", label.ID) | ||
} | ||
if labelBelongsToRepo && repo != nil { | ||
result.URL = fmt.Sprintf("%s/labels/%d", repo.APIURL(), label.ID) | ||
} else { // BelongsToOrg | ||
if org != nil { | ||
result.URL = fmt.Sprintf("%sapi/v1/orgs/%s/labels/%d", setting.AppURL, url.PathEscape(org.Name), label.ID) | ||
|
@@ -226,6 +224,10 @@ func ToLabel(label *issues_model.Label, repo *repo_model.Repository, org *user_m | |
} | ||
} | ||
|
||
if labelBelongsToRepo && repo == nil { | ||
log.Error("ToLabel did not get repo to calculate url for label with id '%d'", label.ID) | ||
} | ||
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. I still have objection for doing pure-refactoring in this period. And ideally, it should be like this:
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. Those sections are unlikely to be targeted by backports, so I think it's okay. Feel free to raise a PR for that. |
||
|
||
return result | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.