models/webhook: restrict deletion to be explicitly with repo and org ID

This commit is contained in:
Unknwon 2016-07-17 08:33:59 +08:00
parent 5ff2dfb23e
commit 60110adc06
7 changed files with 55 additions and 48 deletions

View file

@ -384,8 +384,8 @@ func TestWebhook(ctx *context.Context) {
}
func DeleteWebhook(ctx *context.Context) {
if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteWebhook: " + err.Error())
if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteWebhookByRepoID: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
}