@@ -107,11 +107,11 @@ func toAPIHook(ctx *context.APIContext, repoLink string, hook *webhook.Webhook)
107
107
}
108
108
109
109
func 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 )
111
111
}
112
112
113
113
func 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 )
115
115
}
116
116
117
117
// 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
130
130
HookEvent : & webhook_module.HookEvent {
131
131
ChooseEvents : true ,
132
132
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 ),
136
136
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 ),
142
142
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 )),
147
147
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 ),
152
152
},
153
153
BranchFilter : form .BranchFilter ,
154
154
},
@@ -277,14 +277,14 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
277
277
w .PushOnly = false
278
278
w .SendEverything = false
279
279
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 )
288
288
w .BranchFilter = form .BranchFilter
289
289
290
290
err := w .SetHeaderAuthorization (form .AuthorizationHeader )
@@ -295,19 +295,19 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
295
295
296
296
// Issues
297
297
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 ))
302
302
303
303
// Pull requests
304
304
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 ))
309
309
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 ))
311
311
312
312
if err := w .UpdateEvent (); err != nil {
313
313
ctx .Error (http .StatusInternalServerError , "UpdateEvent" , err )
0 commit comments