summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-15 07:28:58 +0000
committerRémy Coutable <remy@rymai.me>2017-05-15 07:28:58 +0000
commitc48554edc24fcdddd4af374ff99f5953a5e672d4 (patch)
tree135fcbeb7c385fb174c0747042f2a1a9ce6577b7
parentc6d5389283624cfdd04191e8119195b30500e38d (diff)
parent47b8516c15415e4111973fbc9a3a2782c1de3ed8 (diff)
downloadgitlab-ce-c48554edc24fcdddd4af374ff99f5953a5e672d4.tar.gz
Merge branch 'dturner/username' into 'master'
add username field to push webhook Closes #32136 See merge request !11272
-rw-r--r--changelogs/unreleased/dturner-username.yml4
-rw-r--r--doc/user/project/integrations/webhooks.md1
-rw-r--r--lib/gitlab/data_builder/push.rb2
-rw-r--r--spec/lib/gitlab/data_builder/push_spec.rb1
4 files changed, 8 insertions, 0 deletions
diff --git a/changelogs/unreleased/dturner-username.yml b/changelogs/unreleased/dturner-username.yml
new file mode 100644
index 00000000000..09ba822ee65
--- /dev/null
+++ b/changelogs/unreleased/dturner-username.yml
@@ -0,0 +1,4 @@
+---
+title: add username field to push webhook
+merge_request:
+author: David Turner
diff --git a/doc/user/project/integrations/webhooks.md b/doc/user/project/integrations/webhooks.md
index e15daa2feae..48d49c5d40c 100644
--- a/doc/user/project/integrations/webhooks.md
+++ b/doc/user/project/integrations/webhooks.md
@@ -74,6 +74,7 @@ X-Gitlab-Event: Push Hook
"checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"user_id": 4,
"user_name": "John Smith",
+ "user_username": "jsmith",
"user_email": "john@example.com",
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
"project_id": 15,
diff --git a/lib/gitlab/data_builder/push.rb b/lib/gitlab/data_builder/push.rb
index 1ff34553f0a..e81d19a7a2e 100644
--- a/lib/gitlab/data_builder/push.rb
+++ b/lib/gitlab/data_builder/push.rb
@@ -11,6 +11,7 @@ module Gitlab
# ref: String,
# user_id: String,
# user_name: String,
+ # user_username: String,
# user_email: String
# project_id: String,
# repository: {
@@ -51,6 +52,7 @@ module Gitlab
message: message,
user_id: user.id,
user_name: user.name,
+ user_username: user.username,
user_email: user.email,
user_avatar: user.avatar_url,
project_id: project.id,
diff --git a/spec/lib/gitlab/data_builder/push_spec.rb b/spec/lib/gitlab/data_builder/push_spec.rb
index dbcfb9b7400..e59cba35b2f 100644
--- a/spec/lib/gitlab/data_builder/push_spec.rb
+++ b/spec/lib/gitlab/data_builder/push_spec.rb
@@ -35,6 +35,7 @@ describe Gitlab::DataBuilder::Push, lib: true do
it { expect(data[:ref]).to eq('refs/tags/v1.1.0') }
it { expect(data[:user_id]).to eq(user.id) }
it { expect(data[:user_name]).to eq(user.name) }
+ it { expect(data[:user_username]).to eq(user.username) }
it { expect(data[:user_email]).to eq(user.email) }
it { expect(data[:user_avatar]).to eq(user.avatar_url) }
it { expect(data[:project_id]).to eq(project.id) }