diff options
author | zeripath <art27@cantab.net> | 2020-12-17 12:26:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 13:26:22 +0100 |
commit | 0851a895819e0a5a1a79dcbd596d4c93d4d47a76 (patch) | |
tree | 14e973b53f5544ee97d95036ebdd4fbb74d34d82 /modules/notification | |
parent | 80a299d307bd3135eb3fb2f5e2deba600f0698ae (diff) | |
download | gitea-0851a895819e0a5a1a79dcbd596d4c93d4d47a76.tar.gz gitea-0851a895819e0a5a1a79dcbd596d4c93d4d47a76.zip |
Cause NotifyMigrateRepository to emit a repo create webhook (#14004)
* Cause NotifyMigrateRepository to emit a repo create webhook
This PR simply makes NotifyMigrateRepository emit a Create Repo webhook.
The reason for no new payload is that the information sent to
NotifyMigrateRepository is only essentially the same as
NotifyCreateRepository
Fix #13996
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/notification')
-rw-r--r-- | modules/notification/webhook/webhook.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go index 2a06eba219..4b159f6248 100644 --- a/modules/notification/webhook/webhook.go +++ b/modules/notification/webhook/webhook.go @@ -122,6 +122,18 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models } } +func (m *webhookNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) { + // Add to hook queue for created repo after session commit. + if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ + Action: api.HookRepoCreated, + Repository: convert.ToRepo(repo, models.AccessModeOwner), + Organization: convert.ToUser(u, false, false), + Sender: convert.ToUser(doer, false, false), + }); err != nil { + log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) + } +} + func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) { if issue.IsPull { mode, _ := models.AccessLevelUnit(doer, issue.Repo, models.UnitTypePullRequests) |