From 6e55557228d41d90406188db547654fc743603da Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Thu, 17 May 2018 14:04:43 +0200 Subject: [PATCH] Add support for new webhooks Signed-off-by: Jonas Franz --- models/issue_comment.go | 8 ++++---- models/pull.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index bb48581b2b..c001b0068c 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -346,7 +346,7 @@ func (c *Comment) LoadReview() error { return c.loadReview(x) } -func (c *Comment) checkInvalidation(e Engine, repo *git.Repository, branch string) error { +func (c *Comment) checkInvalidation(e Engine, 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 { @@ -354,15 +354,15 @@ func (c *Comment) checkInvalidation(e Engine, repo *git.Repository, branch strin } if c.CommitSHA != commit.ID.String() { c.Invalidated = true - return UpdateComment(c) + return UpdateComment(doer, c, "") } return nil } // CheckInvalidation checks if the line of code comment got changed by another commit. // If the line got changed the comment is going to be invalidated. -func (c *Comment) CheckInvalidation(repo *git.Repository, branch string) error { - return c.checkInvalidation(x, repo, branch) +func (c *Comment) CheckInvalidation(repo *git.Repository, doer *User, branch string) error { + return c.checkInvalidation(x, doer, repo, branch) } // DiffSide returns "previous" if Comment.Line is a LOC of the previous changes and "proposed" if it is a LOC of the proposed changes. diff --git a/models/pull.go b/models/pull.go index fb5fcf46fb..bc5d10112f 100644 --- a/models/pull.go +++ b/models/pull.go @@ -1100,7 +1100,7 @@ func (prs PullRequestList) LoadAttributes() error { return prs.loadAttributes(x) } -func (prs PullRequestList) invalidateCodeComments(e Engine, repo *git.Repository, branch string) error { +func (prs PullRequestList) invalidateCodeComments(e Engine, doer *User, repo *git.Repository, branch string) error { if len(prs) == 0 { return nil } @@ -1113,7 +1113,7 @@ func (prs PullRequestList) invalidateCodeComments(e Engine, repo *git.Repository return fmt.Errorf("find code comments: %v", err) } for _, comment := range codeComments { - if err := comment.CheckInvalidation(repo, branch); err != nil { + if err := comment.CheckInvalidation(repo, doer, branch); err != nil { return err } } @@ -1121,8 +1121,8 @@ func (prs PullRequestList) invalidateCodeComments(e Engine, repo *git.Repository } // InvalidateCodeComments will lookup the prs for code comments which got invalidated by change -func (prs PullRequestList) InvalidateCodeComments(repo *git.Repository, branch string) error { - return prs.invalidateCodeComments(x, repo, branch) +func (prs PullRequestList) InvalidateCodeComments(doer *User, repo *git.Repository, branch string) error { + return prs.invalidateCodeComments(x, doer, repo, branch) } func addHeadRepoTasks(prs []*PullRequest) { @@ -1167,7 +1167,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool goto REQUIRED_PROCEDURE } go func() { - err := requests.InvalidateCodeComments(gitRepo, branch) + err := requests.InvalidateCodeComments(doer, gitRepo, branch) if err != nil { log.Error(4, "PullRequestList.InvalidateCodeComments: %v", err) }