Skip to content

Commit

Permalink
Cause NotifyMigrateRepository to emit a repo create webhook
Browse files Browse the repository at this point in the history
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 go-gitea#13996

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Dec 15, 2020
1 parent b8c58ed commit 6004547
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/notification/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models
}
}

// NotifyMigrateRepository places a place holder function
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)
Expand Down

0 comments on commit 6004547

Please sign in to comment.