Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
038cd1ab
Commit
038cd1ab
authored
Jan 08, 2021
by
Rémy Coutable
Committed by
Markus Koller
Jan 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include the user id in the webhook payload
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1c8deba0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
14 deletions
+52
-14
app/models/user.rb
app/models/user.rb
+1
-0
changelogs/unreleased/add-user-id-to-user-webhook-data.yml
changelogs/unreleased/add-user-id-to-user-webhook-data.yml
+5
-0
doc/system_hooks/system_hooks.md
doc/system_hooks/system_hooks.md
+3
-1
doc/user/project/integrations/webhooks.md
doc/user/project/integrations/webhooks.md
+39
-12
spec/lib/gitlab/data_builder/build_spec.rb
spec/lib/gitlab/data_builder/build_spec.rb
+1
-0
spec/lib/gitlab/data_builder/pipeline_spec.rb
spec/lib/gitlab/data_builder/pipeline_spec.rb
+1
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-1
No files found.
app/models/user.rb
View file @
038cd1ab
...
...
@@ -1358,6 +1358,7 @@ class User < ApplicationRecord
def
hook_attrs
{
id:
id
,
name:
name
,
username:
username
,
avatar_url:
avatar_url
(
only_path:
false
),
...
...
changelogs/unreleased/add-user-id-to-user-webhook-data.yml
0 → 100644
View file @
038cd1ab
---
title
:
Include the user id in the webhook payload
merge_request
:
50287
author
:
type
:
added
doc/system_hooks/system_hooks.md
View file @
038cd1ab
...
...
@@ -535,9 +535,11 @@ X-Gitlab-Event: System Hook
{
"object_kind"
:
"merge_request"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"email"
:
"admin@example.com"
},
"project"
:
{
"name"
:
"Example"
,
...
...
doc/user/project/integrations/webhooks.md
View file @
038cd1ab
...
...
@@ -257,6 +257,7 @@ X-Gitlab-Event: Issue Hook
"object_kind"
:
"issue"
,
"event_type"
:
"issue"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
...
...
@@ -420,9 +421,11 @@ X-Gitlab-Event: Note Hook
{
"object_kind"
:
"note"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project_id"
:
5
,
"project"
:{
...
...
@@ -500,9 +503,11 @@ X-Gitlab-Event: Note Hook
{
"object_kind"
:
"note"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project_id"
:
5
,
"project"
:{
...
...
@@ -627,9 +632,11 @@ X-Gitlab-Event: Note Hook
{
"object_kind"
:
"note"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project_id"
:
5
,
"project"
:{
...
...
@@ -733,9 +740,11 @@ X-Gitlab-Event: Note Hook
{
"object_kind"
:
"note"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project_id"
:
5
,
"project"
:{
...
...
@@ -809,9 +818,11 @@ X-Gitlab-Event: Merge Request Hook
{
"object_kind"
:
"merge_request"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project"
:
{
"id"
:
1
,
...
...
@@ -970,9 +981,11 @@ X-Gitlab-Event: Wiki Page Hook
{
"object_kind"
:
"wiki_page"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"project"
:
{
"id"
:
1
,
...
...
@@ -1061,6 +1074,7 @@ X-Gitlab-Event: Pipeline Hook
"url"
:
"http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1"
},
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
...
...
@@ -1102,9 +1116,11 @@ X-Gitlab-Event: Pipeline Hook
"manual"
:
true
,
"allow_failure"
:
false
,
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"runner"
:
null
,
"artifacts_file"
:{
...
...
@@ -1124,9 +1140,11 @@ X-Gitlab-Event: Pipeline Hook
"manual"
:
false
,
"allow_failure"
:
false
,
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"runner"
:
{
"id"
:
380987
,
...
...
@@ -1151,9 +1169,11 @@ X-Gitlab-Event: Pipeline Hook
"manual"
:
false
,
"allow_failure"
:
false
,
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"runner"
:
{
"id"
:
380987
,
...
...
@@ -1178,9 +1198,11 @@ X-Gitlab-Event: Pipeline Hook
"manual"
:
false
,
"allow_failure"
:
false
,
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"runner"
:
{
"id"
:
380987
,
...
...
@@ -1205,9 +1227,11 @@ X-Gitlab-Event: Pipeline Hook
"manual"
:
false
,
"allow_failure"
:
false
,
"user"
:{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"runner"
:
null
,
"artifacts_file"
:{
...
...
@@ -1254,7 +1278,8 @@ X-Gitlab-Event: Job Hook
"id"
:
3
,
"name"
:
"User"
,
"email"
:
"user@gitlab.com"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80
\u
0026d=identicon"
,
"email"
:
"admin@example.com"
},
"commit"
:
{
"id"
:
2366
,
...
...
@@ -1330,6 +1355,7 @@ X-Gitlab-Event: Deployment Hook
},
"short_sha"
:
"279484c0"
,
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
...
...
@@ -1472,6 +1498,7 @@ X-Gitlab-Event: Feature Flag Hook
"http_url"
:
"http://example.com/gitlabhq/gitlab-test.git"
},
"user"
:
{
"id"
:
1
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
...
...
spec/lib/gitlab/data_builder/build_spec.rb
View file @
038cd1ab
...
...
@@ -26,6 +26,7 @@ RSpec.describe Gitlab::DataBuilder::Build do
it
{
expect
(
data
[
:user
]).
to
eq
(
{
id:
user
.
id
,
name:
user
.
name
,
username:
user
.
username
,
avatar_url:
user
.
avatar_url
(
only_path:
false
),
...
...
spec/lib/gitlab/data_builder/pipeline_spec.rb
View file @
038cd1ab
...
...
@@ -41,6 +41,7 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do
expect
(
project_data
).
to
eq
(
project
.
hook_attrs
(
backward:
false
))
expect
(
data
[
:merge_request
]).
to
be_nil
expect
(
data
[
:user
]).
to
eq
({
id:
user
.
id
,
name:
user
.
name
,
username:
user
.
username
,
avatar_url:
user
.
avatar_url
(
only_path:
false
),
...
...
spec/models/user_spec.rb
View file @
038cd1ab
...
...
@@ -5089,9 +5089,10 @@ RSpec.describe User do
end
describe
'#hook_attrs'
do
it
'includes name, username, avatar_url, and email'
do
it
'includes
id,
name, username, avatar_url, and email'
do
user
=
create
(
:user
)
user_attributes
=
{
id:
user
.
id
,
name:
user
.
name
,
username:
user
.
username
,
avatar_url:
user
.
avatar_url
(
only_path:
false
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment