Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-03 18:48:17 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-05 15:13:42 +0300
commit0617876d9ff446fde21eca03a66ddb38c29a82bc (patch)
treeb9d2d9feec0f0eb868b698114c25e3c2fa3ab64a /app
parent65ea732cfebd7efe5a0ae9b31eef4349c38cfa4b (diff)
Fix subgroup repository disappearance if group was moved
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/models/namespace.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 1d4b1f7d590..9bfa731785f 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -150,7 +150,7 @@ class Namespace < ActiveRecord::Base
end
def any_project_has_container_registry_tags?
- projects.any?(&:has_container_registry_tags?)
+ all_projects.any?(&:has_container_registry_tags?)
end
def send_update_instructions
@@ -214,6 +214,12 @@ class Namespace < ActiveRecord::Base
@old_repository_storage_paths ||= repository_storage_paths
end
+ # Includes projects from this namespace and projects from all subgroups
+ # that belongs to this namespace
+ def all_projects
+ Project.inside_path(full_path)
+ end
+
private
def repository_storage_paths
@@ -221,7 +227,7 @@ class Namespace < ActiveRecord::Base
# pending delete. Unscoping also get rids of the default order, which causes
# problems with SELECT DISTINCT.
Project.unscoped do
- projects.select('distinct(repository_storage)').to_a.map(&:repository_storage_path)
+ all_projects.select('distinct(repository_storage)').to_a.map(&:repository_storage_path)
end
end