@@ -107,11 +107,11 @@ func toAPIHook(ctx *context.APIContext, repoLink string, hook *webhook.Webhook)
107107}
108108
109109func issuesHook (events []string , event string ) bool {
110- return util .IsStringInSlice (event , events , true ) || util .IsStringInSlice (string (webhook .HookEventIssues ), events , true )
110+ return util .IsStringInSlice (event , events , true ) || util .IsStringInSlice (string (webhook_module .HookEventIssues ), events , true )
111111}
112112
113113func pullHook (events []string , event string ) bool {
114- return util .IsStringInSlice (event , events , true ) || util .IsStringInSlice (string (webhook .HookEventPullRequest ), events , true )
114+ return util .IsStringInSlice (event , events , true ) || util .IsStringInSlice (string (webhook_module .HookEventPullRequest ), events , true )
115115}
116116
117117// addHook add the hook specified by `form`, `orgID` and `repoID`. If there is
@@ -130,25 +130,25 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID
130130 HookEvent : & webhook_module.HookEvent {
131131 ChooseEvents : true ,
132132 HookEvents : webhook_module.HookEvents {
133- Create : util .IsStringInSlice (string (webhook .HookEventCreate ), form .Events , true ),
134- Delete : util .IsStringInSlice (string (webhook .HookEventDelete ), form .Events , true ),
135- Fork : util .IsStringInSlice (string (webhook .HookEventFork ), form .Events , true ),
133+ Create : util .IsStringInSlice (string (webhook_module .HookEventCreate ), form .Events , true ),
134+ Delete : util .IsStringInSlice (string (webhook_module .HookEventDelete ), form .Events , true ),
135+ Fork : util .IsStringInSlice (string (webhook_module .HookEventFork ), form .Events , true ),
136136 Issues : issuesHook (form .Events , "issues_only" ),
137- IssueAssign : issuesHook (form .Events , string (webhook .HookEventIssueAssign )),
138- IssueLabel : issuesHook (form .Events , string (webhook .HookEventIssueLabel )),
139- IssueMilestone : issuesHook (form .Events , string (webhook .HookEventIssueMilestone )),
140- IssueComment : issuesHook (form .Events , string (webhook .HookEventIssueComment )),
141- Push : util .IsStringInSlice (string (webhook .HookEventPush ), form .Events , true ),
137+ IssueAssign : issuesHook (form .Events , string (webhook_module .HookEventIssueAssign )),
138+ IssueLabel : issuesHook (form .Events , string (webhook_module .HookEventIssueLabel )),
139+ IssueMilestone : issuesHook (form .Events , string (webhook_module .HookEventIssueMilestone )),
140+ IssueComment : issuesHook (form .Events , string (webhook_module .HookEventIssueComment )),
141+ Push : util .IsStringInSlice (string (webhook_module .HookEventPush ), form .Events , true ),
142142 PullRequest : pullHook (form .Events , "pull_request_only" ),
143- PullRequestAssign : pullHook (form .Events , string (webhook .HookEventPullRequestAssign )),
144- PullRequestLabel : pullHook (form .Events , string (webhook .HookEventPullRequestLabel )),
145- PullRequestMilestone : pullHook (form .Events , string (webhook .HookEventPullRequestMilestone )),
146- PullRequestComment : pullHook (form .Events , string (webhook .HookEventPullRequestComment )),
143+ PullRequestAssign : pullHook (form .Events , string (webhook_module .HookEventPullRequestAssign )),
144+ PullRequestLabel : pullHook (form .Events , string (webhook_module .HookEventPullRequestLabel )),
145+ PullRequestMilestone : pullHook (form .Events , string (webhook_module .HookEventPullRequestMilestone )),
146+ PullRequestComment : pullHook (form .Events , string (webhook_module .HookEventPullRequestComment )),
147147 PullRequestReview : pullHook (form .Events , "pull_request_review" ),
148- PullRequestSync : pullHook (form .Events , string (webhook .HookEventPullRequestSync )),
149- Wiki : util .IsStringInSlice (string (webhook .HookEventWiki ), form .Events , true ),
150- Repository : util .IsStringInSlice (string (webhook .HookEventRepository ), form .Events , true ),
151- Release : util .IsStringInSlice (string (webhook .HookEventRelease ), form .Events , true ),
148+ PullRequestSync : pullHook (form .Events , string (webhook_module .HookEventPullRequestSync )),
149+ Wiki : util .IsStringInSlice (string (webhook_module .HookEventWiki ), form .Events , true ),
150+ Repository : util .IsStringInSlice (string (webhook_module .HookEventRepository ), form .Events , true ),
151+ Release : util .IsStringInSlice (string (webhook_module .HookEventRelease ), form .Events , true ),
152152 },
153153 BranchFilter : form .BranchFilter ,
154154 },
@@ -277,14 +277,14 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
277277 w .PushOnly = false
278278 w .SendEverything = false
279279 w .ChooseEvents = true
280- w .Create = util .IsStringInSlice (string (webhook .HookEventCreate ), form .Events , true )
281- w .Push = util .IsStringInSlice (string (webhook .HookEventPush ), form .Events , true )
282- w .Create = util .IsStringInSlice (string (webhook .HookEventCreate ), form .Events , true )
283- w .Delete = util .IsStringInSlice (string (webhook .HookEventDelete ), form .Events , true )
284- w .Fork = util .IsStringInSlice (string (webhook .HookEventFork ), form .Events , true )
285- w .Repository = util .IsStringInSlice (string (webhook .HookEventRepository ), form .Events , true )
286- w .Wiki = util .IsStringInSlice (string (webhook .HookEventWiki ), form .Events , true )
287- w .Release = util .IsStringInSlice (string (webhook .HookEventRelease ), form .Events , true )
280+ w .Create = util .IsStringInSlice (string (webhook_module .HookEventCreate ), form .Events , true )
281+ w .Push = util .IsStringInSlice (string (webhook_module .HookEventPush ), form .Events , true )
282+ w .Create = util .IsStringInSlice (string (webhook_module .HookEventCreate ), form .Events , true )
283+ w .Delete = util .IsStringInSlice (string (webhook_module .HookEventDelete ), form .Events , true )
284+ w .Fork = util .IsStringInSlice (string (webhook_module .HookEventFork ), form .Events , true )
285+ w .Repository = util .IsStringInSlice (string (webhook_module .HookEventRepository ), form .Events , true )
286+ w .Wiki = util .IsStringInSlice (string (webhook_module .HookEventWiki ), form .Events , true )
287+ w .Release = util .IsStringInSlice (string (webhook_module .HookEventRelease ), form .Events , true )
288288 w .BranchFilter = form .BranchFilter
289289
290290 err := w .SetHeaderAuthorization (form .AuthorizationHeader )
@@ -295,19 +295,19 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
295295
296296 // Issues
297297 w .Issues = issuesHook (form .Events , "issues_only" )
298- w .IssueAssign = issuesHook (form .Events , string (webhook .HookEventIssueAssign ))
299- w .IssueLabel = issuesHook (form .Events , string (webhook .HookEventIssueLabel ))
300- w .IssueMilestone = issuesHook (form .Events , string (webhook .HookEventIssueMilestone ))
301- w .IssueComment = issuesHook (form .Events , string (webhook .HookEventIssueComment ))
298+ w .IssueAssign = issuesHook (form .Events , string (webhook_module .HookEventIssueAssign ))
299+ w .IssueLabel = issuesHook (form .Events , string (webhook_module .HookEventIssueLabel ))
300+ w .IssueMilestone = issuesHook (form .Events , string (webhook_module .HookEventIssueMilestone ))
301+ w .IssueComment = issuesHook (form .Events , string (webhook_module .HookEventIssueComment ))
302302
303303 // Pull requests
304304 w .PullRequest = pullHook (form .Events , "pull_request_only" )
305- w .PullRequestAssign = pullHook (form .Events , string (webhook .HookEventPullRequestAssign ))
306- w .PullRequestLabel = pullHook (form .Events , string (webhook .HookEventPullRequestLabel ))
307- w .PullRequestMilestone = pullHook (form .Events , string (webhook .HookEventPullRequestMilestone ))
308- w .PullRequestComment = pullHook (form .Events , string (webhook .HookEventPullRequestComment ))
305+ w .PullRequestAssign = pullHook (form .Events , string (webhook_module .HookEventPullRequestAssign ))
306+ w .PullRequestLabel = pullHook (form .Events , string (webhook_module .HookEventPullRequestLabel ))
307+ w .PullRequestMilestone = pullHook (form .Events , string (webhook_module .HookEventPullRequestMilestone ))
308+ w .PullRequestComment = pullHook (form .Events , string (webhook_module .HookEventPullRequestComment ))
309309 w .PullRequestReview = pullHook (form .Events , "pull_request_review" )
310- w .PullRequestSync = pullHook (form .Events , string (webhook .HookEventPullRequestSync ))
310+ w .PullRequestSync = pullHook (form .Events , string (webhook_module .HookEventPullRequestSync ))
311311
312312 if err := w .UpdateEvent (); err != nil {
313313 ctx .Error (http .StatusInternalServerError , "UpdateEvent" , err )
0 commit comments