Prevent NPE on commenting on lines with invalidated comments (with migration) #12549

Merged
lunny merged 4 commits from fix-12239-review-page-500-with-migration into master 2020-08-21 07:53:15 +00:00
Contributor

#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.

This PR fixes the above NPE by preventing a review being assigned to 0 by only checking for a review if we are replying to a previous review and migrates all broken reviews to create a review and code comment for them.

Fix #12239
Closes #12548

Signed-off-by: Andrew Thornton art27@cantab.net

#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. This PR fixes the above NPE by preventing a review being assigned to 0 by only checking for a review if we are replying to a previous review and migrates all broken reviews to create a review and code comment for them. Fix #12239 Closes #12548 Signed-off-by: Andrew Thornton art27@cantab.net
mrsdizzie (Migrated from github.com) approved these changes 2020-08-20 22:12:04 +00:00
lafriks (Migrated from github.com) approved these changes 2020-08-21 07:53:01 +00:00
This repo is archived. You cannot comment on pull requests.
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#12549
No description provided.