Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1349 from vntw/fix-snippet-comment-note
Browse files Browse the repository at this point in the history
Update snippet comment note webhook with current payload
  • Loading branch information
svanharmelen authored Mar 8, 2022
2 parents ae600d9 + 0e37eda commit e63371f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
17 changes: 16 additions & 1 deletion event_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,22 @@ type SnippetCommentEvent struct {
Description string `json:"description"`
URL string `json:"url"`
} `json:"object_attributes"`
Snippet *Snippet `json:"snippet"`
Snippet *struct {
ID int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
AuthorID int `json:"author_id"`
ProjectID int `json:"project_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Filename string `json:"file_name"`
ExpiresAt string `json:"expires_at"`
Type string `json:"type"`
VisibilityLevel int `json:"visibility_level"`
Description string `json:"description"`
Secret bool `json:"secret"`
RepositoryReadOnly bool `json:"repository_read_only"`
} `json:"snippet"`
}

// SubGroupEvent represents a subgroup event.
Expand Down
24 changes: 20 additions & 4 deletions testdata/webhooks/note_snippet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"object_kind": "note",
"event_type": "note",
"user": {
"id": 42,
"name": "User1",
Expand Down Expand Up @@ -40,11 +41,20 @@
"updated_at": "2015-05-17 18:35:50 UTC",
"project_id": 5,
"attachment": null,
"change_position": null,
"discussion_id": "e1c5835f5f99414806f6fe45b28s48cfebb89ee1",
"line_code": null,
"commit_id": "",
"commit_id": null,
"noteable_id": 53,
"system": false,
"original_position": null,
"position": null,
"resolved_at": null,
"resolved_by_id": null,
"resolved_by_push": null,
"st_diff": null,
"type": null,
"updated_by_id": null,
"description": "Is this snippet doing what it's supposed to be doing?",
"url": "http://example.com/gitlab-org/gitlab-test/snippets/53#note_1245"
},
Expand All @@ -54,11 +64,17 @@
"content": "puts 'Hello world'",
"author_id": 1,
"project_id": 5,
"created_at": "2016-01-04T15:31:46.176Z",
"updated_at": "2016-01-04T15:31:46.176Z",
"created_at": "2016-01-04 15:31:46 UTC",
"updated_at": "2016-01-04 15:32:46 UTC",
"file_name": "test.rb",
"expires_at": null,
"type": "ProjectSnippet",
"visibility_level": 0
"visibility_level": 0,
"description": "Prints 'Hello world'",
"encrypted_secret_token": null,
"encrypted_secret_token_iv": null,
"secret": false,
"repository_read_only": false,
"secret_token": null
}
}

0 comments on commit e63371f

Please sign in to comment.