From 095b2843ade25118c384436c636995f1cdf9135f Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Fri, 5 Oct 2018 12:51:54 +0200 Subject: [PATCH 1/2] Hide outdated comments in file view Signed-off-by: Jonas Franz --- models/issue_comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index eb185a7662b0..0085c7a732ae 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -1084,7 +1084,7 @@ func fetchCodeCommentsByReview(e Engine, issue *Issue, currentUser *User, review } conds := opts.toConds() if review.ID == 0 { - conds.And(builder.Eq{"invalidated": false}) + conds = conds.And(builder.Eq{"invalidated": false}) } var comments []*Comment From 91c348a4953ac380f9828e1daa81ffacc13cc55d Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Fri, 5 Oct 2018 13:05:50 +0200 Subject: [PATCH 2/2] Add unit test by adding "invalidated" comment to fixtures Signed-off-by: Jonas Franz --- models/fixtures/comment.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/models/fixtures/comment.yml b/models/fixtures/comment.yml index 6d4812f096d5..6abd26973b56 100644 --- a/models/fixtures/comment.yml +++ b/models/fixtures/comment.yml @@ -41,3 +41,14 @@ tree_path: "README.md" created_unix: 946684812 invalidated: false + +- + id: 6 + type: 21 # code comment + poster_id: 1 + issue_id: 2 + content: "it's already invalidated. boring..." + line: -4 + tree_path: "README.md" + created_unix: 946684812 + invalidated: true