Merge branch 'add_username_to_user_system_hooks' of https://github.com/tbeadle/gitlabhq
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
		
						commit
						32a5b741c2
					
				|  | @ -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)) | ||||
|  | @ -99,6 +100,7 @@ class SystemHooksService | |||
|       project_path: model.project.path, | ||||
|       project_path_with_namespace: model.project.path_with_namespace, | ||||
|       project_id: model.project.id, | ||||
|       user_username: model.user.username, | ||||
|       user_name: model.user.name, | ||||
|       user_email: model.user.email, | ||||
|       user_id: model.user.id, | ||||
|  | @ -112,6 +114,7 @@ class SystemHooksService | |||
|       group_name: model.group.name, | ||||
|       group_path: model.group.path, | ||||
|       group_id: model.group.id, | ||||
|       user_username: model.user.username, | ||||
|       user_name: model.user.name, | ||||
|       user_email: model.user.email, | ||||
|       user_id: model.user.id, | ||||
|  |  | |||
|  | @ -96,6 +96,7 @@ X-Gitlab-Event: System Hook | |||
|  "project_path_with_namespace": "jsmith/storecloud", | ||||
|                   "user_email": "johnsmith@gmail.com", | ||||
|                    "user_name": "John Smith", | ||||
|                "user_username": "johnsmith", | ||||
|                      "user_id": 41, | ||||
|           "project_visibility": "private", | ||||
| } | ||||
|  | @ -115,6 +116,7 @@ X-Gitlab-Event: System Hook | |||
|  "project_path_with_namespace": "jsmith/storecloud", | ||||
|                   "user_email": "johnsmith@gmail.com", | ||||
|                    "user_name": "John Smith", | ||||
|                "user_username": "johnsmith", | ||||
|                      "user_id": 41, | ||||
|           "project_visibility": "private", | ||||
| } | ||||
|  | @ -129,6 +131,7 @@ X-Gitlab-Event: System Hook | |||
|         "email": "js@gitlabhq.com", | ||||
|    "event_name": "user_create", | ||||
|          "name": "John Smith", | ||||
|      "username": "js", | ||||
|       "user_id": 41 | ||||
| } | ||||
| ``` | ||||
|  | @ -142,6 +145,7 @@ X-Gitlab-Event: System Hook | |||
|         "email": "js@gitlabhq.com", | ||||
|    "event_name": "user_destroy", | ||||
|          "name": "John Smith", | ||||
|      "username": "js", | ||||
|       "user_id": 41 | ||||
| } | ||||
| ``` | ||||
|  | @ -215,6 +219,7 @@ X-Gitlab-Event: System Hook | |||
|     "group_path": "storecloud", | ||||
|     "user_email": "johnsmith@gmail.com", | ||||
|      "user_name": "John Smith", | ||||
|  "user_username": "johnsmith", | ||||
|        "user_id": 41 | ||||
| } | ||||
| ``` | ||||
|  | @ -231,6 +236,7 @@ X-Gitlab-Event: System Hook | |||
|     "group_path": "storecloud", | ||||
|     "user_email": "johnsmith@gmail.com", | ||||
|      "user_name": "John Smith", | ||||
|  "user_username": "johnsmith", | ||||
|        "user_id": 41 | ||||
| } | ||||
| ``` | ||||
|  |  | |||
|  | @ -9,54 +9,54 @@ 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, :user_id, :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, :user_id, :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, :user_id, :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, :user_id, :access_level, :project_visibility) } | ||||
|     it { expect(event_data(key, :create)).to include(:username, :key, :id) } | ||||
|     it { expect(event_data(key, :destroy)).to include(:username, :key, :id) } | ||||
| 
 | ||||
|     it do | ||||
|       project.old_path_with_namespace = 'renamed_from_path' | ||||
|       expect(event_data(project, :rename)).to include( | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :project_id,  | ||||
|         :owner_name, :owner_email, :project_visibility,  | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :project_id, | ||||
|         :owner_name, :owner_email, :project_visibility, | ||||
|         :old_path_with_namespace | ||||
|       )  | ||||
|       ) | ||||
|     end | ||||
|     it do | ||||
|       project.old_path_with_namespace = 'transfered_from_path' | ||||
|       expect(event_data(project, :transfer)).to include( | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :project_id,  | ||||
|         :owner_name, :owner_email, :project_visibility,  | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :project_id, | ||||
|         :owner_name, :owner_email, :project_visibility, | ||||
|         :old_path_with_namespace | ||||
|       )  | ||||
|       ) | ||||
|     end | ||||
| 
 | ||||
|     it do | ||||
|       expect(event_data(group, :create)).to include( | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :group_id,  | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :group_id, | ||||
|         :owner_name, :owner_email | ||||
|       ) | ||||
|     end | ||||
|     it do | ||||
|       expect(event_data(group, :destroy)).to include( | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :group_id,  | ||||
|         :event_name, :name, :created_at, :updated_at, :path, :group_id, | ||||
|         :owner_name, :owner_email | ||||
|       ) | ||||
|     end | ||||
|     it do | ||||
|       expect(event_data(group_member, :create)).to include( | ||||
|         :event_name, :created_at, :updated_at, :group_name, :group_path,  | ||||
|         :group_id, :user_id, :user_name, :user_email, :group_access | ||||
|         :event_name, :created_at, :updated_at, :group_name, :group_path, | ||||
|         :group_id, :user_id, :user_username, :user_name, :user_email, :group_access | ||||
|       ) | ||||
|     end | ||||
|     it do | ||||
|       expect(event_data(group_member, :destroy)).to include( | ||||
|         :event_name, :created_at, :updated_at, :group_name, :group_path,  | ||||
|         :group_id, :user_id, :user_name, :user_email, :group_access | ||||
|         :event_name, :created_at, :updated_at, :group_name, :group_path, | ||||
|         :group_id, :user_id, :user_username, :user_name, :user_email, :group_access | ||||
|       ) | ||||
|     end | ||||
|   end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue