|
|
|
@ -99,30 +99,26 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) {
|
|
|
|
|
// Add to hook queue for created repo after session commit.
|
|
|
|
|
if u.IsOrganization() {
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoCreated,
|
|
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner),
|
|
|
|
|
Organization: u.APIFormat(),
|
|
|
|
|
Sender: doer.APIFormat(),
|
|
|
|
|
}); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
|
|
|
|
|
}
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoCreated,
|
|
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner),
|
|
|
|
|
Organization: u.APIFormat(),
|
|
|
|
|
Sender: doer.APIFormat(),
|
|
|
|
|
}); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models.Repository) {
|
|
|
|
|
u := repo.MustOwner()
|
|
|
|
|
|
|
|
|
|
if u.IsOrganization() {
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoDeleted,
|
|
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner),
|
|
|
|
|
Organization: u.APIFormat(),
|
|
|
|
|
Sender: doer.APIFormat(),
|
|
|
|
|
}); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
|
|
|
|
|
}
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoDeleted,
|
|
|
|
|
Repository: repo.APIFormat(models.AccessModeOwner),
|
|
|
|
|
Organization: u.APIFormat(),
|
|
|
|
|
Sender: doer.APIFormat(),
|
|
|
|
|
}); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|