Merge pull request #18 from tulir/patch-2
[GitLab] Add support for confidential issues
This commit is contained in:
+14
-8
@@ -26,14 +26,15 @@ type Event string
|
|||||||
|
|
||||||
// GitLab hook types
|
// GitLab hook types
|
||||||
const (
|
const (
|
||||||
PushEvents Event = "Push Hook"
|
PushEvents Event = "Push Hook"
|
||||||
TagEvents Event = "Tag Push Hook"
|
TagEvents Event = "Tag Push Hook"
|
||||||
IssuesEvents Event = "Issue Hook"
|
IssuesEvents Event = "Issue Hook"
|
||||||
CommentEvents Event = "Note Hook"
|
ConfidentialIssuesEvents Event = "Confidential Issue Hook"
|
||||||
MergeRequestEvents Event = "Merge Request Hook"
|
CommentEvents Event = "Note Hook"
|
||||||
WikiPageEvents Event = "Wiki Page Hook"
|
MergeRequestEvents Event = "Merge Request Hook"
|
||||||
PipelineEvents Event = "Pipeline Hook"
|
WikiPageEvents Event = "Wiki Page Hook"
|
||||||
BuildEvents Event = "Build Hook"
|
PipelineEvents Event = "Pipeline Hook"
|
||||||
|
BuildEvents Event = "Build Hook"
|
||||||
)
|
)
|
||||||
|
|
||||||
// New creates and returns a WebHook instance denoted by the Provider type
|
// New creates and returns a WebHook instance denoted by the Provider type
|
||||||
@@ -112,6 +113,11 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {
|
|||||||
json.Unmarshal([]byte(payload), &te)
|
json.Unmarshal([]byte(payload), &te)
|
||||||
hook.runProcessPayloadFunc(fn, te, hd)
|
hook.runProcessPayloadFunc(fn, te, hd)
|
||||||
|
|
||||||
|
case ConfidentialIssuesEvents:
|
||||||
|
var cie ConfidentialIssueEventPayload
|
||||||
|
json.Unmarshal([]byte(payload), &cie)
|
||||||
|
hook.runProcessPayloadFunc(fn, cie, hd)
|
||||||
|
|
||||||
case IssuesEvents:
|
case IssuesEvents:
|
||||||
var ie IssueEventPayload
|
var ie IssueEventPayload
|
||||||
json.Unmarshal([]byte(payload), &ie)
|
json.Unmarshal([]byte(payload), &ie)
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ type IssueEventPayload struct {
|
|||||||
Assignee Assignee `json:"assignee"`
|
Assignee Assignee `json:"assignee"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfidentialIssueEventPayload contains the information for GitLab's confidential issue event
|
||||||
|
type ConfidentialIssueEventPayload struct {
|
||||||
|
// The data for confidential issues is currently the same as normal issues,
|
||||||
|
// so we can just embed the normal issue payload type here.
|
||||||
|
IssueEventPayload
|
||||||
|
}
|
||||||
|
|
||||||
// MergeRequestEventPayload contains the information for GitLab's merge request event
|
// MergeRequestEventPayload contains the information for GitLab's merge request event
|
||||||
type MergeRequestEventPayload struct {
|
type MergeRequestEventPayload struct {
|
||||||
ObjectKind string `json:"object_kind"`
|
ObjectKind string `json:"object_kind"`
|
||||||
|
|||||||
Reference in New Issue
Block a user