diff options
author | Alex <alex.house@performancehorizon.com> | 2014-05-12 13:23:24 +0400 |
---|---|---|
committer | Alex <alex.house@performancehorizon.com> | 2014-05-12 13:23:24 +0400 |
commit | 31b0e14981d57c2f38734872181c6dc49a2e6f5a (patch) | |
tree | 03b43f3c1f5c8f6e440dbfafaee9773764805a36 | |
parent | c355b9abfe441da1d164cb1a27a8e6dbee266bb2 (diff) |
Adding project visibility to system hooks
-rw-r--r-- | app/services/system_hooks_service.rb | 6 | ||||
-rw-r--r-- | doc/system_hooks/system_hooks.md | 36 | ||||
-rw-r--r-- | spec/services/system_hooks_service_spec.rb | 8 |
3 files changed, 28 insertions, 22 deletions
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index 4969198b8c2..41014f199d5 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -31,7 +31,8 @@ class SystemHooksService path_with_namespace: model.path_with_namespace, project_id: model.id, owner_name: owner.name, - owner_email: owner.respond_to?(:email) ? owner.email : nil + owner_email: owner.respond_to?(:email) ? owner.email : nil, + project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase }) when User data.merge!({ @@ -46,7 +47,8 @@ class SystemHooksService project_id: model.project_id, user_name: model.user.name, user_email: model.user.email, - project_access: model.human_access + project_access: model.human_access, + project_visibility: Project.visibility_levels.key(model.project.visibility_level_field).downcase }) end end diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md index 76ca2a59911..5c8daf466ab 100644 --- a/doc/system_hooks/system_hooks.md +++ b/doc/system_hooks/system_hooks.md @@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "stormcloud", "path_with_namespace": "jsmith/stormcloud", "project_id": 74, + "project_visibility": "private", } ``` @@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "underscore", "path_with_namespace": "jsmith/underscore", "project_id": 73, + "project_visibility": "internal", } ``` @@ -38,14 +40,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```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", + "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", + "project_visibility": "private", } ``` @@ -53,14 +56,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```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", + "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", + "project_visibility": "private", } ``` diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb index f1df7e55dd0..3c2eec6cfd9 100644 --- a/spec/services/system_hooks_service_spec.rb +++ b/spec/services/system_hooks_service_spec.rb @@ -8,10 +8,10 @@ describe SystemHooksService do context 'event data' do it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) } it { event_data(user, :destroy).should include(:event_name, :name, :created_at, :email, :user_id) } - it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } - it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } - it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } - it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } + it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } + it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } + it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } + it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } end context 'event names' do |