Commit 1f64332e authored by Tommy Beadle's avatar Tommy Beadle

Include user_username in user_(add_to/remove_from)_(project/group) system hooks.

parent dada25d4
...@@ -100,6 +100,7 @@ class SystemHooksService ...@@ -100,6 +100,7 @@ class SystemHooksService
project_path: model.project.path, project_path: model.project.path,
project_path_with_namespace: model.project.path_with_namespace, project_path_with_namespace: model.project.path_with_namespace,
project_id: model.project.id, project_id: model.project.id,
user_username: model.user.username,
user_name: model.user.name, user_name: model.user.name,
user_email: model.user.email, user_email: model.user.email,
access_level: model.human_access, access_level: model.human_access,
...@@ -112,6 +113,7 @@ class SystemHooksService ...@@ -112,6 +113,7 @@ class SystemHooksService
group_name: model.group.name, group_name: model.group.name,
group_path: model.group.path, group_path: model.group.path,
group_id: model.group.id, group_id: model.group.id,
user_username: model.user.username,
user_name: model.user.name, user_name: model.user.name,
user_email: model.user.email, user_email: model.user.email,
user_id: model.user.id, user_id: model.user.id,
......
...@@ -96,6 +96,7 @@ X-Gitlab-Event: System Hook ...@@ -96,6 +96,7 @@ X-Gitlab-Event: System Hook
"project_path_with_namespace": "jsmith/storecloud", "project_path_with_namespace": "jsmith/storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"user_username": "johnsmith",
"user_id": 41, "user_id": 41,
"project_visibility": "private", "project_visibility": "private",
} }
...@@ -115,6 +116,7 @@ X-Gitlab-Event: System Hook ...@@ -115,6 +116,7 @@ X-Gitlab-Event: System Hook
"project_path_with_namespace": "jsmith/storecloud", "project_path_with_namespace": "jsmith/storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"user_username": "johnsmith",
"user_id": 41, "user_id": 41,
"project_visibility": "private", "project_visibility": "private",
} }
...@@ -217,6 +219,7 @@ X-Gitlab-Event: System Hook ...@@ -217,6 +219,7 @@ X-Gitlab-Event: System Hook
"group_path": "storecloud", "group_path": "storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"user_username": "johnsmith",
"user_id": 41 "user_id": 41
} }
``` ```
...@@ -233,6 +236,7 @@ X-Gitlab-Event: System Hook ...@@ -233,6 +236,7 @@ X-Gitlab-Event: System Hook
"group_path": "storecloud", "group_path": "storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"user_username": "johnsmith",
"user_id": 41 "user_id": 41
} }
``` ```
...@@ -13,8 +13,8 @@ describe SystemHooksService, services: true do ...@@ -13,8 +13,8 @@ describe SystemHooksService, services: true do
it { expect(event_data(user, :destroy)).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, :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, :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) } 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_username, :user_email, :access_level, :project_visibility) }
it { expect(event_data(project_member, :destroy)).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) } it { expect(event_data(project_member, :destroy)).to include(:event_name, :created_at, :updated_at, :project_name, :project_path, :project_path_with_namespace, :project_id, :user_name, :user_username, :user_email, :access_level, :project_visibility) }
it { expect(event_data(key, :create)).to include(:username, :key, :id) } it { expect(event_data(key, :create)).to include(:username, :key, :id) }
it { expect(event_data(key, :destroy)).to include(:username, :key, :id) } it { expect(event_data(key, :destroy)).to include(:username, :key, :id) }
...@@ -50,13 +50,13 @@ describe SystemHooksService, services: true do ...@@ -50,13 +50,13 @@ describe SystemHooksService, services: true do
it do it do
expect(event_data(group_member, :create)).to include( expect(event_data(group_member, :create)).to include(
:event_name, :created_at, :updated_at, :group_name, :group_path, :event_name, :created_at, :updated_at, :group_name, :group_path,
:group_id, :user_id, :user_name, :user_email, :group_access :group_id, :user_id, :user_username, :user_name, :user_email, :group_access
) )
end end
it do it do
expect(event_data(group_member, :destroy)).to include( expect(event_data(group_member, :destroy)).to include(
:event_name, :created_at, :updated_at, :group_name, :group_path, :event_name, :created_at, :updated_at, :group_name, :group_path,
:group_id, :user_id, :user_name, :user_email, :group_access :group_id, :user_id, :user_username, :user_name, :user_email, :group_access
) )
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment