hooks: Add full project namespace to payload
Payload of "project_member, :create" and "project_member, :destroy" now also have a field project_path_with_namespace.
This commit is contained in:
		
							parent
							
								
									b5c12f742a
								
							
						
					
					
						commit
						42be5ee1cd
					
				| 
						 | 
				
			
			@ -28,6 +28,7 @@ v 8.1.0 (unreleased)
 | 
			
		|||
  - Ensure code blocks are properly highlighted after a note is updated
 | 
			
		||||
  - Fix wrong access level badge on MR comments
 | 
			
		||||
  - Hide password in the service settings form
 | 
			
		||||
  - Add full project namespace to payload of system webhooks (Ricardo Band)
 | 
			
		||||
 | 
			
		||||
v 8.0.3
 | 
			
		||||
  - Fix URL shown in Slack notifications
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,6 +54,7 @@ class SystemHooksService
 | 
			
		|||
      data.merge!({
 | 
			
		||||
        project_name: model.project.name,
 | 
			
		||||
        project_path: model.project.path,
 | 
			
		||||
        project_path_with_namespace: model.project.path_with_namespace,
 | 
			
		||||
        project_id: model.project.id,
 | 
			
		||||
        user_name: model.user.name,
 | 
			
		||||
        user_email: model.user.email,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,16 +48,17 @@ X-Gitlab-Event: System Hook
 | 
			
		|||
 | 
			
		||||
```json
 | 
			
		||||
{
 | 
			
		||||
         "created_at": "2012-07-21T07:30:56Z",
 | 
			
		||||
         "event_name": "user_add_to_team",
 | 
			
		||||
     "project_access": "Master",
 | 
			
		||||
         "project_id": 74,
 | 
			
		||||
       "project_name": "StoreCloud",
 | 
			
		||||
       "project_path": "storecloud",
 | 
			
		||||
         "user_email": "johnsmith@gmail.com",
 | 
			
		||||
          "user_name": "John Smith",
 | 
			
		||||
            "user_id": 41,
 | 
			
		||||
 "project_visibility": "private",
 | 
			
		||||
                  "created_at": "2012-07-21T07:30:56Z",
 | 
			
		||||
                  "event_name": "user_add_to_team",
 | 
			
		||||
              "project_access": "Master",
 | 
			
		||||
                  "project_id": 74,
 | 
			
		||||
                "project_name": "StoreCloud",
 | 
			
		||||
                "project_path": "storecloud",
 | 
			
		||||
 "project_path_with_namespace": "jsmith/storecloud",
 | 
			
		||||
                  "user_email": "johnsmith@gmail.com",
 | 
			
		||||
                   "user_name": "John Smith",
 | 
			
		||||
                     "user_id": 41,
 | 
			
		||||
          "project_visibility": "private",
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -65,16 +66,17 @@ X-Gitlab-Event: System Hook
 | 
			
		|||
 | 
			
		||||
```json
 | 
			
		||||
{
 | 
			
		||||
         "created_at": "2012-07-21T07:30:56Z",
 | 
			
		||||
         "event_name": "user_remove_from_team",
 | 
			
		||||
     "project_access": "Master",
 | 
			
		||||
         "project_id": 74,
 | 
			
		||||
       "project_name": "StoreCloud",
 | 
			
		||||
       "project_path": "storecloud",
 | 
			
		||||
         "user_email": "johnsmith@gmail.com",
 | 
			
		||||
          "user_name": "John Smith",
 | 
			
		||||
            "user_id": 41,
 | 
			
		||||
 "project_visibility": "private",
 | 
			
		||||
                  "created_at": "2012-07-21T07:30:56Z",
 | 
			
		||||
                  "event_name": "user_remove_from_team",
 | 
			
		||||
              "project_access": "Master",
 | 
			
		||||
                  "project_id": 74,
 | 
			
		||||
                "project_name": "StoreCloud",
 | 
			
		||||
                "project_path": "storecloud",
 | 
			
		||||
 "project_path_with_namespace": "jsmith/storecloud",
 | 
			
		||||
                  "user_email": "johnsmith@gmail.com",
 | 
			
		||||
                   "user_name": "John Smith",
 | 
			
		||||
                     "user_id": 41,
 | 
			
		||||
          "project_visibility": "private",
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,8 +13,8 @@ describe SystemHooksService do
 | 
			
		|||
    it { expect(event_data(user, :destroy)).to include(:event_name, :name, :created_at, :email, :user_id) }
 | 
			
		||||
    it { expect(event_data(project, :create)).to include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
 | 
			
		||||
    it { expect(event_data(project, :destroy)).to include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
 | 
			
		||||
    it { expect(event_data(project_member, :create)).to include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :access_level, :project_visibility) }
 | 
			
		||||
    it { expect(event_data(project_member, :destroy)).to include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :access_level, :project_visibility) }
 | 
			
		||||
    it { expect(event_data(project_member, :create)).to include(:event_name, :created_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, :project_name, :project_path, :project_path_with_namespace, :project_id, :user_name, :user_email, :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) }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue