diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-04-13 15:28:10 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-04-13 15:28:10 -0300 |
commit | 11f46b459e9d97900cb71f7f6bd313b5e18fbaa6 (patch) | |
tree | df1b114345fd7d94e360aa73ef9ceaefe2b3e6fd /app/services | |
parent | f026e53c4df5b0b3bb7435c05d3c8662afe45881 (diff) | |
download | gitlab-ce-11f46b459e9d97900cb71f7f6bd313b5e18fbaa6.tar.gz |
Setup visibility level for project when transfering for a group
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/transfer_service.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 2e734654466..0d8f8c6fbee 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -34,9 +34,12 @@ module Projects raise TransferError.new("Project with same path in target namespace already exists") end - # Apply new namespace id - project.namespace = new_namespace - project.save! + # Apply new namespace id and visibility level + project.tap do |p| + p.namespace = new_namespace + setup_visibility_level(p, new_namespace) + p.save! + end # Notifications project.send_move_instructions(old_path) @@ -56,7 +59,7 @@ module Projects Gitlab::UploadsTransfer.new.move_project(project.path, old_namespace.path, new_namespace.path) project.old_path_with_namespace = old_path - + SystemHooksService.new.execute_hooks_for(project, :transfer) true end @@ -68,5 +71,15 @@ module Projects namespace.id != project.namespace_id && current_user.can?(:create_projects, namespace) end + + private + + def setup_visibility_level(project, new_namespace) + return unless new_namespace.is_a?(Group) + + if project.visibility_level > new_namespace.visibility_level + project.visibility_level = new_namespace.visibility_level + end + end end end |