-
-
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
Replies to outdated code comments should also be outdated #13217
Replies to outdated code comments should also be outdated #13217
Conversation
…s page This happened because the comment took the latest commitID as its base instead of the reviewID that it was replying to. There was also no way of creating an already outdated comment - and a reply to a review on an outdated line should be outdated. Signed-off-by: Andrew Thornton <[email protected]>
I think we can backport this unless there have been other new migrations since the 1.13 branch. |
Signed-off-by: Andrew Thornton <[email protected]>
ca9469e
to
abc626d
Compare
Codecov Report
@@ Coverage Diff @@
## master #13217 +/- ##
=======================================
Coverage 41.96% 41.96%
=======================================
Files 683 684 +1
Lines 75279 75360 +81
=======================================
+ Hits 31589 31628 +39
- Misses 38524 38563 +39
- Partials 5166 5169 +3
Continue to review full report at Codecov.
|
@zeripath pleace resolve :) |
I think we should still backport just without the migration perhaps adding to doctor instead... |
…should-have-the-same-sha
…should-have-the-same-sha
…3217) * When replying to an outdated comment it should not appear on the files page This happened because the comment took the latest commitID as its base instead of the reviewID that it was replying to. There was also no way of creating an already outdated comment - and a reply to a review on an outdated line should be outdated. Signed-off-by: Andrew Thornton <[email protected]> * fix test Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]>
Backport: #13433 |
…13433) * When replying to an outdated comment it should not appear on the files page This happened because the comment took the latest commitID as its base instead of the reviewID that it was replying to. There was also no way of creating an already outdated comment - and a reply to a review on an outdated line should be outdated. Signed-off-by: Andrew Thornton <[email protected]> * fix test Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]> Co-authored-by: zeripath <[email protected]> Co-authored-by: techknowlogick <[email protected]>
@@ -976,6 +980,12 @@ func (opts *FindCommentsOptions) toConds() builder.Cond { | |||
if opts.Type != CommentTypeUnknown { | |||
cond = cond.And(builder.Eq{"comment.type": opts.Type}) | |||
} | |||
if opts.Line > 0 { |
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.
Are there database index on this columns? If not, this will be slow when the database is big.
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.
You only need one index per a query. ReviewID has an index.
AND comment.tree_path = first.tree_path AND comment.line = first.line | ||
WHERE comment.type = 21 | ||
AND comment.id != first.id | ||
AND comment.commit_sha != first.commit_sha`).Limit(batchSize, start).Find(&comments); err != nil { |
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.
No. SQL
and Limit
cannot be used both. This may result in horrible memory usage if the sites have many comments.
} | ||
|
||
for _, comment := range comments { | ||
if _, err := sess.Table("comment").Cols("commit_sha", "patch", "invalidated").Update(comment); err != nil { |
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.
ID(comment.ID).
, oh. God, this will update all the comments
No, only migration is broken. |
this could be why I had issues with #13436 ... too |
So a migration was reverted which made existing installs unable to start because it won't downgrade the database. Makes me wonder why we don't have a test that tries to start the server which would have failed in this case :) |
This happened because the comment took the latest commit as its base instead of the
commit_sha of the first comment that it was replying to.
There was also no way of creating an already outdated comment - and a
reply to a review on an outdated line should be outdated.
Signed-off-by: Andrew Thornton [email protected]