-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix webhook test #2415
fix webhook test #2415
Conversation
LGTM |
models/webhook.go
Outdated
@@ -482,6 +482,57 @@ func UpdateHookTask(t *HookTask) error { | |||
return err | |||
} | |||
|
|||
// PrepareWebHook adds special webhook to task queue for given payload. | |||
func PrepareWebHook(w *Webhook, repo *Repository, event HookEventType, p api.Payloader) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call it PrepareWebhook
for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the function named PrepareWebHooks
for fire all webhooks of a repository or an orgnization, I named this funtion PrepareWebHook
for one webhook is reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lunny That function is named PrepareWebhooks
, not PrepareWebHooks
(https://github.com/go-gitea/gitea/blob/master/models/webhook.go#L486)
routers/repo/webhook.go
Outdated
@@ -582,7 +590,7 @@ func TestWebhook(ctx *context.Context) { | |||
Pusher: apiUser, | |||
Sender: apiUser, | |||
} | |||
if err := models.PrepareWebhooks(ctx.Repo.Repository, models.HookEventPush, p); err != nil { | |||
if err := models.PrepareWebHook(w, ctx.Repo.Repository, models.HookEventPush, p); err != nil { | |||
ctx.Flash.Error("PrepareWebhooks: " + err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
4438cef
to
e4c67e4
Compare
@ethantkoenig done and rebased. |
LGTM |
When click the test webhook, only this webhook should be fired but not all the webhooks of the repository.