]> source.dussan.org Git - gitea.git/commitdiff
Hide outdated comments in file view (#5017)
authorJonas Franz <info@jonasfranz.software>
Fri, 5 Oct 2018 15:49:30 +0000 (17:49 +0200)
committertechknowlogick <hello@techknowlogick.com>
Fri, 5 Oct 2018 15:49:30 +0000 (11:49 -0400)
* Hide outdated comments in file view

Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add unit test by adding "invalidated" comment to fixtures

Signed-off-by: Jonas Franz <info@jonasfranz.software>
models/fixtures/comment.yml
models/issue_comment.go

index 6d4812f096d5ec1861d9d383ea0c80a22ababb2a..6abd26973b561e62329ff5799a3799f60d0df024 100644 (file)
   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
index eb185a7662b01840e2bf4b7eb2dea93af543b5c1..0085c7a732ae56f4eefb06804a735b00f3233d8e 100644 (file)
@@ -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