|
|
@ -52,7 +52,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model |
|
|
|
Action: api.HookIssueLabelCleared, |
|
|
|
Action: api.HookIssueLabelCleared, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -60,7 +60,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model |
|
|
|
Action: api.HookIssueLabelCleared, |
|
|
|
Action: api.HookIssueLabelCleared, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -75,8 +75,8 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo |
|
|
|
|
|
|
|
|
|
|
|
// forked webhook
|
|
|
|
// forked webhook
|
|
|
|
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: convert.ToRepo(oldRepo, oldMode), |
|
|
|
Repo: repo.APIFormat(mode), |
|
|
|
Repo: convert.ToRepo(repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
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) |
|
|
@ -88,7 +88,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo |
|
|
|
if u.IsOrganization() { |
|
|
|
if u.IsOrganization() { |
|
|
|
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: convert.ToRepo(repo, models.AccessModeOwner), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
@ -101,7 +101,7 @@ func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.Us |
|
|
|
// Add to hook queue for created repo after session commit.
|
|
|
|
// Add to hook queue for created repo after session commit.
|
|
|
|
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: convert.ToRepo(repo, models.AccessModeOwner), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
@ -114,7 +114,7 @@ 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: convert.ToRepo(repo, models.AccessModeOwner), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Organization: convert.ToUser(u, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
@ -134,7 +134,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if removed { |
|
|
|
if removed { |
|
|
@ -152,7 +152,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo |
|
|
|
apiIssue := &api.IssuePayload{ |
|
|
|
apiIssue := &api.IssuePayload{ |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if removed { |
|
|
|
if removed { |
|
|
@ -186,7 +186,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: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -199,7 +199,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -221,7 +221,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if isClosed { |
|
|
|
if isClosed { |
|
|
@ -234,7 +234,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode |
|
|
|
apiIssue := &api.IssuePayload{ |
|
|
|
apiIssue := &api.IssuePayload{ |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
} |
|
|
|
} |
|
|
|
if isClosed { |
|
|
|
if isClosed { |
|
|
@ -264,7 +264,7 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue) { |
|
|
|
Action: api.HookIssueOpened, |
|
|
|
Action: api.HookIssueOpened, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
Sender: convert.ToUser(issue.Poster, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
@ -290,7 +290,7 @@ func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest) { |
|
|
|
Action: api.HookIssueOpened, |
|
|
|
Action: api.HookIssueOpened, |
|
|
|
Index: pull.Issue.Index, |
|
|
|
Index: pull.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pull), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pull), |
|
|
|
Repository: pull.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(pull.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(pull.Issue.Poster, false, false), |
|
|
|
Sender: convert.ToUser(pull.Issue.Poster, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
@ -311,7 +311,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: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -324,7 +324,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -361,7 +361,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme |
|
|
|
From: oldContent, |
|
|
|
From: oldContent, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(c.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -375,7 +375,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme |
|
|
|
From: oldContent, |
|
|
|
From: oldContent, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Repository: c.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(c.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -396,7 +396,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -405,7 +405,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Action: api.HookIssueCommentCreated, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -440,7 +440,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(comment.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: true, |
|
|
|
IsPull: true, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -449,7 +449,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Action: api.HookIssueCommentDeleted, |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Issue: convert.ToAPIIssue(comment.Issue), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Comment: convert.ToComment(comment), |
|
|
|
Repository: comment.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(comment.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
IsPull: false, |
|
|
|
IsPull: false, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -489,7 +489,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode |
|
|
|
Action: api.HookIssueLabelUpdated, |
|
|
|
Action: api.HookIssueLabelUpdated, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Repository: convert.ToRepo(issue.Repo, models.AccessModeNone), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -497,7 +497,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode |
|
|
|
Action: api.HookIssueLabelUpdated, |
|
|
|
Action: api.HookIssueLabelUpdated, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -531,7 +531,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m |
|
|
|
Action: hookAction, |
|
|
|
Action: hookAction, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -539,7 +539,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m |
|
|
|
Action: hookAction, |
|
|
|
Action: hookAction, |
|
|
|
Index: issue.Index, |
|
|
|
Index: issue.Index, |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Issue: convert.ToAPIIssue(issue), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -562,7 +562,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re |
|
|
|
After: opts.NewCommitID, |
|
|
|
After: opts.NewCommitID, |
|
|
|
CompareURL: setting.AppURL + commits.CompareURL, |
|
|
|
CompareURL: setting.AppURL + commits.CompareURL, |
|
|
|
Commits: apiCommits, |
|
|
|
Commits: apiCommits, |
|
|
|
Repo: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Repo: convert.ToRepo(repo, models.AccessModeOwner), |
|
|
|
Pusher: apiPusher, |
|
|
|
Pusher: apiPusher, |
|
|
|
Sender: apiPusher, |
|
|
|
Sender: apiPusher, |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
@ -597,7 +597,7 @@ func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mod |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
apiPullRequest := &api.PullRequestPayload{ |
|
|
|
Index: pr.Issue.Index, |
|
|
|
Index: pr.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(pr.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Action: api.HookIssueClosed, |
|
|
|
Action: api.HookIssueClosed, |
|
|
|
} |
|
|
|
} |
|
|
@ -630,7 +630,7 @@ func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *models.User, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest), |
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -669,7 +669,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review |
|
|
|
Action: api.HookIssueReviewed, |
|
|
|
Action: api.HookIssueReviewed, |
|
|
|
Index: review.Issue.Index, |
|
|
|
Index: review.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: review.Issue.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(review.Issue.Repo, mode), |
|
|
|
Sender: convert.ToUser(review.Reviewer, false, false), |
|
|
|
Sender: convert.ToUser(review.Reviewer, false, false), |
|
|
|
Review: &api.ReviewPayload{ |
|
|
|
Review: &api.ReviewPayload{ |
|
|
|
Type: string(reviewHookType), |
|
|
|
Type: string(reviewHookType), |
|
|
@ -682,7 +682,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 := convert.ToUser(pusher, false, false) |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
apiRepo := convert.ToRepo(repo, models.AccessModeNone) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
|
|
|
|
|
|
|
|
gitRepo, err := git.OpenRepository(repo.RepoPath()) |
|
|
|
gitRepo, err := git.OpenRepository(repo.RepoPath()) |
|
|
@ -724,7 +724,7 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *m |
|
|
|
Action: api.HookIssueSynchronized, |
|
|
|
Action: api.HookIssueSynchronized, |
|
|
|
Index: pr.Issue.Index, |
|
|
|
Index: pr.Issue.Index, |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
PullRequest: convert.ToAPIPullRequest(pr), |
|
|
|
Repository: pr.Issue.Repo.APIFormat(models.AccessModeNone), |
|
|
|
Repository: convert.ToRepo(pr.Issue.Repo, models.AccessModeNone), |
|
|
|
Sender: convert.ToUser(doer, false, false), |
|
|
|
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) |
|
|
@ -733,7 +733,7 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *m |
|
|
|
|
|
|
|
|
|
|
|
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 := convert.ToUser(pusher, false, false) |
|
|
|
apiPusher := convert.ToUser(pusher, false, false) |
|
|
|
apiRepo := repo.APIFormat(models.AccessModeNone) |
|
|
|
apiRepo := convert.ToRepo(repo, models.AccessModeNone) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
refName := git.RefEndName(refFullName) |
|
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{ |
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{ |
|
|
@ -757,7 +757,7 @@ func sendReleaseHook(doer *models.User, rel *models.Release, action api.HookRele |
|
|
|
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: convert.ToRelease(rel), |
|
|
|
Release: convert.ToRelease(rel), |
|
|
|
Repository: rel.Repo.APIFormat(mode), |
|
|
|
Repository: convert.ToRepo(rel.Repo, mode), |
|
|
|
Sender: convert.ToUser(rel.Publisher, false, false), |
|
|
|
Sender: convert.ToUser(rel.Publisher, false, false), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
|
log.Error("PrepareWebhooks: %v", err) |
|
|
@ -790,7 +790,7 @@ func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *model |
|
|
|
After: opts.NewCommitID, |
|
|
|
After: opts.NewCommitID, |
|
|
|
CompareURL: setting.AppURL + commits.CompareURL, |
|
|
|
CompareURL: setting.AppURL + commits.CompareURL, |
|
|
|
Commits: apiCommits, |
|
|
|
Commits: apiCommits, |
|
|
|
Repo: repo.APIFormat(models.AccessModeOwner), |
|
|
|
Repo: convert.ToRepo(repo, models.AccessModeOwner), |
|
|
|
Pusher: apiPusher, |
|
|
|
Pusher: apiPusher, |
|
|
|
Sender: apiPusher, |
|
|
|
Sender: apiPusher, |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|