Skip to content

Commit 6004547

Browse files
committed
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 <[email protected]>
1 parent b8c58ed commit 6004547

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

modules/notification/webhook/webhook.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models
122122
}
123123
}
124124

125+
// NotifyMigrateRepository places a place holder function
126+
func (m *webhookNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) {
127+
// Add to hook queue for created repo after session commit.
128+
if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
129+
Action: api.HookRepoCreated,
130+
Repository: convert.ToRepo(repo, models.AccessModeOwner),
131+
Organization: convert.ToUser(u, false, false),
132+
Sender: convert.ToUser(doer, false, false),
133+
}); err != nil {
134+
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
135+
}
136+
}
137+
125138
func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) {
126139
if issue.IsPull {
127140
mode, _ := models.AccessLevelUnit(doer, issue.Repo, models.UnitTypePullRequests)

0 commit comments

Comments
 (0)