mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
#3274 fix can't get webhook detail of organization
This commit is contained in:
@@ -98,7 +98,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook
|
||||
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
|
||||
w, err := models.GetWebhookByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
w, err := models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
if err != nil {
|
||||
if models.IsErrWebhookNotExist(err) {
|
||||
ctx.Status(404)
|
||||
|
@@ -154,7 +154,7 @@ func Webhooks(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ws, err := models.GetWebhooksByOrgId(ctx.Org.Organization.Id)
|
||||
ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.Id)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetWebhooksByOrgId", err)
|
||||
return
|
||||
|
@@ -220,7 +220,12 @@ func checkWebhook(ctx *context.Context) (*OrgRepoCtx, *models.Webhook) {
|
||||
}
|
||||
ctx.Data["BaseLink"] = orCtx.Link
|
||||
|
||||
w, err := models.GetWebhookByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
var w *models.Webhook
|
||||
if orCtx.RepoID > 0 {
|
||||
w, err = models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
} else {
|
||||
w, err = models.GetWebhookByOrgID(ctx.Org.Organization.Id, ctx.ParamsInt64(":id"))
|
||||
}
|
||||
if err != nil {
|
||||
if models.IsErrWebhookNotExist(err) {
|
||||
ctx.Handle(404, "GetWebhookByID", nil)
|
||||
|
Reference in New Issue
Block a user