summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommy Beadle <tbeadle@arbor.net>2016-01-07 12:54:35 -0500
committerTommy Beadle <tbeadle@arbor.net>2016-01-07 12:54:35 -0500
commitdada25d4472ec9ad601447fdd12da2301ac9ee79 (patch)
tree0960ddb2221823a1ffaec714c997183b02129996
parentfc386b65d090848322b70ca915d9140482a51494 (diff)
downloadgitlab-ce-dada25d4472ec9ad601447fdd12da2301ac9ee79.tar.gz
Include the username in user_create/destroy system hooks.
-rw-r--r--app/services/system_hooks_service.rb3
-rw-r--r--doc/system_hooks/system_hooks.md2
-rw-r--r--spec/services/system_hooks_service_spec.rb4
3 files changed, 6 insertions, 3 deletions
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index 6dc854ec33d..2bd8223fbd8 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -47,7 +47,8 @@ class SystemHooksService
data.merge!({
name: model.name,
email: model.email,
- user_id: model.id
+ user_id: model.id,
+ username: model.username
})
when ProjectMember
data.merge!(project_member_data(model))
diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md
index 49f98ded046..0539f30e802 100644
--- a/doc/system_hooks/system_hooks.md
+++ b/doc/system_hooks/system_hooks.md
@@ -129,6 +129,7 @@ X-Gitlab-Event: System Hook
"email": "js@gitlabhq.com",
"event_name": "user_create",
"name": "John Smith",
+ "username": "js",
"user_id": 41
}
```
@@ -142,6 +143,7 @@ X-Gitlab-Event: System Hook
"email": "js@gitlabhq.com",
"event_name": "user_destroy",
"name": "John Smith",
+ "username": "js",
"user_id": 41
}
```
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 4455ae7b321..1824e51ebfe 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -9,8 +9,8 @@ describe SystemHooksService, services: true do
let(:group_member) { create(:group_member) }
context 'event data' do
- it { expect(event_data(user, :create)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id) }
- it { expect(event_data(user, :destroy)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id) }
+ it { expect(event_data(user, :create)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id, :username) }
+ it { expect(event_data(user, :destroy)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id, :username) }
it { expect(event_data(project, :create)).to include(:event_name, :name, :created_at, :updated_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { expect(event_data(project, :destroy)).to include(:event_name, :name, :created_at, :updated_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { expect(event_data(project_member, :create)).to include(:event_name, :created_at, :updated_at, :project_name, :project_path, :project_path_with_namespace, :project_id, :user_name, :user_email, :access_level, :project_visibility) }