forked from gitea/gitea
Add support for new webhooks
Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
parent
0f64dad74b
commit
6e55557228
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue