-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Prevent NPE on commenting on lines with invalidated comments #12548
Conversation
Only check for a review if we are replying to a previous review. Prevent the NPE in go-gitea#12239 by assuming that a comment without a Review is non-pending. Fix go-gitea#12239 Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
I think the problem with replyReviewID != 0 is that it will match for all real replies which do have replyReviewID set (it is only 0 for an initial review comment) and so then all comments on a review will have the 'Review' Tag displayed and have their own review entry in the database. The tag part is mostly cosmetic but not sure how it might effect other code for the database to consider every comment a separate full review. Shouldn't it be better to just fix models.ReviewExists which seems to have broken logic now that we have code to invalidate reviews? Another small issue is that the resolve conversation option for the 'reviewless' comments only shows on the main discussion but not the files view. I think thats OK though it is easy enough to dismiss these. |
Codecov Report
@@ Coverage Diff @@
## master #12548 +/- ##
==========================================
+ Coverage 43.48% 43.50% +0.01%
==========================================
Files 642 642
Lines 71040 71040
==========================================
+ Hits 30893 30904 +11
+ Misses 35136 35127 -9
+ Partials 5011 5009 -2
Continue to review full report at Codecov.
|
OK I've figured out how to create a migration for these and have a different fix which is 1.13 only in #12549 @mrsdizzie When you're replying to a comment you actually pass in the review which you're replying to. |
We should use these commits as the basis of a backport. Therefore I'll close this and if #12549 is merged the backported should grab these commits and rebase them on 1.12 for the backport. |
#12239 reports an NPE when viewing the diff page of a PR when comments are made on a line that has previously had comments invalidated on it.
@mrsdizzie discovered the mechanism and reason this occurs.
Fix #12239
Signed-off-by: Andrew Thornton [email protected]