|
|
@ -53,7 +53,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ |
|
|
@ -61,7 +61,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -77,7 +77,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo |
|
|
|
if err := webhook_module.PrepareWebhooks(oldRepo, models.HookEventFork, &api.ForkPayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(oldRepo, models.HookEventFork, &api.ForkPayload{ |
|
|
|
Forkee: oldRepo.APIFormat(oldMode), |
|
|
|
Forkee: oldRepo.APIFormat(oldMode), |
|
|
|
Repo: repo.APIFormat(mode), |
|
|
|
Repo: repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err) |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -89,8 +89,8 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
Action: api.HookRepoCreated, |
|
|
|
Action: api.HookRepoCreated, |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Organization: u.APIFormat(), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -102,8 +102,8 @@ func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.Us |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
Action: api.HookRepoCreated, |
|
|
|
Action: api.HookRepoCreated, |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Organization: u.APIFormat(), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -115,8 +115,8 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ |
|
|
|
Action: api.HookRepoDeleted, |
|
|
|
Action: api.HookRepoDeleted, |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Organization: u.APIFormat(), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -135,7 +135,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if removed { |
|
|
|
if removed { |
|
|
|
apiPullRequest.Action = api.HookIssueUnassigned |
|
|
|
apiPullRequest.Action = api.HookIssueUnassigned |
|
|
@ -153,7 +153,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if removed { |
|
|
|
if removed { |
|
|
|
apiIssue.Action = api.HookIssueUnassigned |
|
|
|
apiIssue.Action = api.HookIssueUnassigned |
|
|
@ -187,7 +187,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model |
|
|
|
}, |
|
|
|
}, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ |
|
|
@ -200,7 +200,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model |
|
|
|
}, |
|
|
|
}, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: issue.Poster.APIFormat(), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -222,7 +222,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if isClosed { |
|
|
|
if isClosed { |
|
|
|
apiPullRequest.Action = api.HookIssueClosed |
|
|
|
apiPullRequest.Action = api.HookIssueClosed |
|
|
@ -235,7 +235,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if isClosed { |
|
|
|
if isClosed { |
|
|
|
apiIssue.Action = api.HookIssueClosed |
|
|
|
apiIssue.Action = api.HookIssueClosed |
|
|
@ -265,7 +265,7 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue) { |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: issue.Poster.APIFormat(), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -291,7 +291,7 @@ func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest) { |
|
|
|
Index: pull.Issue.Index, |
|
|
|
Index: pull.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pull), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pull), |
|
|
|
Repository: pull.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: pull.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: pull.Issue.Poster.APIFormat(), |
|
|
|
Sender: convert.ToUser(pull.Issue.Poster, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -312,7 +312,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod |
|
|
|
}, |
|
|
|
}, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ |
|
|
@ -325,7 +325,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod |
|
|
|
}, |
|
|
|
}, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -355,28 +355,28 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme |
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentEdited, |
|
|
|
Action: api.HookIssueCommentEdited, |
|
|
|
Issue: convert.ToAPIIssue(c.Issue), |
|
|
|
Issue: convert.ToAPIIssue(c.Issue), |
|
|
|
Comment: c.APIFormat(), |
|
|
|
Comment: convert.ToComment(c), |
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
Body: &api.ChangesFromPayload{ |
|
|
|
Body: &api.ChangesFromPayload{ |
|
|
|
From: oldContent, |
|
|
|
From: oldContent, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentEdited, |
|
|
|
Action: api.HookIssueCommentEdited, |
|
|
|
Issue: convert.ToAPIIssue(c.Issue), |
|
|
|
Issue: convert.ToAPIIssue(c.Issue), |
|
|
|
Comment: c.APIFormat(), |
|
|
|
Comment: convert.ToComment(c), |
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
Body: &api.ChangesFromPayload{ |
|
|
|
Body: &api.ChangesFromPayload{ |
|
|
|
From: oldContent, |
|
|
|
From: oldContent, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -395,18 +395,18 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Comment: comment.APIFormat(), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Comment: comment.APIFormat(), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -439,18 +439,18 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models |
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Comment: comment.APIFormat(), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{ |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Comment: comment.APIFormat(), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -490,7 +490,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Repository: issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ |
|
|
@ -498,7 +498,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -532,7 +532,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueMilestone, &api.IssuePayload{ |
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueMilestone, &api.IssuePayload{ |
|
|
@ -540,7 +540,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -549,7 +549,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { |
|
|
|
func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { |
|
|
|
apiPusher := pusher.APIFormat() |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) |
|
|
|
apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("commits.ToAPIPayloadCommits failed: %v", err) |
|
|
|
log.Error("commits.ToAPIPayloadCommits failed: %v", err) |
|
|
@ -598,7 +598,7 @@ func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mod |
|
|
|
Index: pr.Issue.Index, |
|
|
|
Index: pr.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Action: api.HookIssueClosed, |
|
|
|
Action: api.HookIssueClosed, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -631,7 +631,7 @@ func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *models.User, |
|
|
|
}, |
|
|
|
}, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -670,7 +670,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review |
|
|
|
Index: review.Issue.Index, |
|
|
|
Index: review.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: review.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: review.Issue.Repo.APIFormat(mode), |
|
|
|
Sender: review.Reviewer.APIFormat(), |
|
|
|
Sender: convert.ToUser(review.Reviewer, false, false), |
|
|
|
Review: &api.ReviewPayload{ |
|
|
|
Review: &api.ReviewPayload{ |
|
|
|
Type: string(reviewHookType), |
|
|
|
Type: string(reviewHookType), |
|
|
|
Content: review.Content, |
|
|
|
Content: review.Content, |
|
|
@ -681,7 +681,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { |
|
|
|
func (m *webhookNotifier) NotifyCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { |
|
|
|
apiPusher := pusher.APIFormat() |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
|
|
|
|
|
|
|
@ -725,14 +725,14 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *m |
|
|
|
Index: pr.Issue.Index, |
|
|
|
Index: pr.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Sender: doer.APIFormat(), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err) |
|
|
|
log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { |
|
|
|
func (m *webhookNotifier) NotifyDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { |
|
|
|
apiPusher := pusher.APIFormat() |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
|
|
|
|
|
|
|
@ -756,9 +756,9 @@ func sendReleaseHook(doer *models.User, rel *models.Release, action api.HookRele |
|
|
|
mode, _ := models.AccessLevel(rel.Publisher, rel.Repo) |
|
|
|
mode, _ := models.AccessLevel(rel.Publisher, rel.Repo) |
|
|
|
if err := webhook_module.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ |
|
|
|
Action: action, |
|
|
|
Action: action, |
|
|
|
Release: rel.APIFormat(), |
|
|
|
Release: convert.ToRelease(rel), |
|
|
|
Repository: rel.Repo.APIFormat(mode), |
|
|
|
Repository: rel.Repo.APIFormat(mode), |
|
|
|
Sender: rel.Publisher.APIFormat(), |
|
|
|
Sender: convert.ToUser(rel.Publisher, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -777,7 +777,7 @@ func (m *webhookNotifier) NotifyDeleteRelease(doer *models.User, rel *models.Rel |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { |
|
|
|
func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { |
|
|
|
apiPusher := pusher.APIFormat() |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) |
|
|
|
apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("commits.ToAPIPayloadCommits failed: %v", err) |
|
|
|
log.Error("commits.ToAPIPayloadCommits failed: %v", err) |
|
|
|