From 13e6611c00a7dd05ba85e6871f9bfa891c25a2c4 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 1 Oct 2017 23:11:52 +0300 Subject: [PATCH] Add separate payload type for confidential issues --- gitlab/gitlab.go | 6 ++++-- gitlab/payload.go | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index 865f97a..cac3a3e 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -114,8 +114,10 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) { hook.runProcessPayloadFunc(fn, te, hd) case ConfidentialIssuesEvents: - // Confidential issues have the same payload as normal issues. - fallthrough + var cie ConfidentialIssueEventPayload + json.Unmarshal([]byte(payload), &cie) + hook.runProcessPayloadFunc(fn, cie, hd) + case IssuesEvents: var ie IssueEventPayload json.Unmarshal([]byte(payload), &ie) diff --git a/gitlab/payload.go b/gitlab/payload.go index 3d06d5f..ea98144 100644 --- a/gitlab/payload.go +++ b/gitlab/payload.go @@ -40,6 +40,13 @@ type IssueEventPayload struct { 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 type MergeRequestEventPayload struct { ObjectKind string `json:"object_kind"`