-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[WIP] Refactor review related code #28544
base: main
Are you sure you want to change the base?
Conversation
…review will be deleted later anyway
PS: the review code need more cleanup - but this pull here mostly addresses bugs |
RequestReview get deleted on review. So we don't have to try to load them on comments. broken out #28544
RequestReview get deleted on review. So we don't have to try to load them on comments. broken out go-gitea#28544
RequestReview get deleted on review. So we don't have to try to load them on comments. broken out go-gitea#28544
@@ -85,6 +85,11 @@ const ( | |||
ReviewTypeRequest | |||
) | |||
|
|||
// AffectReview indicate if this review type alter a pull state |
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.
write about branch protection
And("type = ?", ReviewTypeApprove). | ||
And("official = ?", true). | ||
And("dismissed = ?", false) | ||
opt := &GetReviewOption{ |
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.
lunny suggest: How about reuse db.Find here?
) close go-gitea#28542 blocks go-gitea#28544 --- *Sponsored by Kithara Software GmbH*
// make sure user review requests are cleared | ||
if opts.Type != ReviewTypePending { | ||
if _, err := sess.Where(reviewCond.And(builder.Eq{"type": ReviewTypeRequest})).Delete(new(Review)); err != nil { | ||
if _, err := sess.Where(opt.toCond().And(builder.Eq{"type": ReviewTypeRequest})).Delete(new(Review)); err != nil { | ||
return nil, err | ||
} | ||
} | ||
// make sure if the created review gets dismissed no old review surface | ||
// other types can be ignored, as they don't affect branch protection |
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.
// other types can be ignored, as they don't affect branch protection |
with the new helper it should be self explaining cc @wxiaoguang ?
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.
PS: this code might be deleted later on anyway if i'm done refactoring
…8552) can we please PLEAS PLEASE only use raw SQL statements if it is relay needed!!! source is go-gitea#28544 (before refactoring)
RequestReview get deleted on review. So we don't have to try to load them on comments. broken out go-gitea#28544
) close go-gitea#28542 blocks go-gitea#28544 --- *Sponsored by Kithara Software GmbH*
RequestReview get deleted on review. So we don't have to try to load them on comments. broken out go-gitea#28544 (cherry picked from commit 6fad2c8)
clean up review related code
TODOs: