mirror of
https://github.com/go-gitea/gitea
synced 2025-08-02 15:48:35 +00:00
Webhooks for repo creation/deletion (#1663)
* Webhooks for repo creation/deletion * add createHookTask * Add handles for GetSlackPayload and GetDiscordPayload
This commit is contained in:
@@ -125,7 +125,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||
}
|
||||
}
|
||||
|
||||
repo, err := models.ForkRepository(ctxUser, forkRepo, form.RepoName, form.Description)
|
||||
repo, err := models.ForkRepository(ctx.User, ctxUser, forkRepo, form.RepoName, form.Description)
|
||||
if err != nil {
|
||||
ctx.Data["Err_RepoName"] = true
|
||||
switch {
|
||||
|
@@ -127,7 +127,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||
return
|
||||
}
|
||||
|
||||
repo, err := models.CreateRepository(ctxUser, models.CreateRepoOptions{
|
||||
repo, err := models.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
|
||||
Name: form.RepoName,
|
||||
Description: form.Description,
|
||||
Gitignores: form.Gitignores,
|
||||
@@ -143,7 +143,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||
}
|
||||
|
||||
if repo != nil {
|
||||
if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
|
||||
if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
|
||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||
return
|
||||
}
|
||||
|
||||
repo, err := models.MigrateRepository(ctxUser, models.MigrateRepoOptions{
|
||||
repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
|
||||
Name: form.RepoName,
|
||||
Description: form.Description,
|
||||
IsPrivate: form.Private || setting.Repository.ForcePrivate,
|
||||
@@ -218,7 +218,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||
}
|
||||
|
||||
if repo != nil {
|
||||
if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
|
||||
if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
|
||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||
}
|
||||
}
|
||||
|
@@ -314,7 +314,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
||||
}
|
||||
}
|
||||
|
||||
if err := models.DeleteRepository(ctx.Repo.Owner.ID, repo.ID); err != nil {
|
||||
if err := models.DeleteRepository(ctx.User, ctx.Repo.Owner.ID, repo.ID); err != nil {
|
||||
ctx.Handle(500, "DeleteRepository", err)
|
||||
return
|
||||
}
|
||||
|
@@ -121,6 +121,7 @@ func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
|
||||
Create: form.Create,
|
||||
Push: form.Push,
|
||||
PullRequest: form.PullRequest,
|
||||
Repository: form.Repository,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user