]> source.dussan.org Git - gitea.git/commitdiff
mark review comment as invalidated when file is deleted (#8751)
authorsucccubbus <16743652+succcubbus@users.noreply.github.com>
Thu, 31 Oct 2019 17:59:36 +0000 (18:59 +0100)
committertechknowlogick <techknowlogick@gitea.io>
Thu, 31 Oct 2019 17:59:36 +0000 (13:59 -0400)
models/issue_comment.go

index d7128bdbac3d7747009f6bf2c3e33c3f14306474..90bb8c53acfa10fd47fe44a6751f67e768079e17 100644 (file)
@@ -444,6 +444,10 @@ func (c *Comment) LoadReview() error {
 func (c *Comment) checkInvalidation(doer *User, repo *git.Repository, branch string) error {
        // FIXME differentiate between previous and proposed line
        commit, err := repo.LineBlame(branch, repo.Path, c.TreePath, uint(c.UnsignedLine()))
+       if err != nil && strings.Contains(err.Error(), "fatal: no such path") {
+               c.Invalidated = true
+               return UpdateComment(c, doer)
+       }
        if err != nil {
                return err
        }