summaryrefslogtreecommitdiff
path: root/app/models/group.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-03-22 00:09:20 +0100
committerDouwe Maan <douwe@selenight.nl>2016-03-22 00:09:20 +0100
commit31266c5be4748f57a7d56bbcc6f06d570cbf5356 (patch)
tree1ee744a7303335cf1a270d92ec6b9e955a52cace /app/models/group.rb
parentae7b2ef62cdf61c990f914d776a6fdfc2bc49fa2 (diff)
downloadgitlab-ce-31266c5be4748f57a7d56bbcc6f06d570cbf5356.tar.gz
Address feedback
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 900fcd71ff3..b332601c59b 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -7,7 +7,7 @@
# path :string(255) not null
# owner_id :integer
# visibility_level :integer default(20), not null
-# created_at :key => "value", datetime
+# created_at :datetime
# updated_at :datetime
# type :string(255)
# description :string(255) default(""), not null
@@ -83,9 +83,7 @@ class Group < Namespace
end
def visibility_level_allowed_by_projects
- projects_visibility = self.projects.pluck(:visibility_level)
-
- allowed_by_projects = projects_visibility.all? { |project_visibility| self.visibility_level >= project_visibility }
+ allowed_by_projects = self.projects.where('visibility_level > ?', self.visibility_level).none?
unless allowed_by_projects
level_name = Gitlab::VisibilityLevel.level_name(visibility_level).downcase