提交 b7b49c4a 编写于 作者: M Mike Greiling

prefer !x.exists? instead of x.none? to prevent unnecessary instantiation of records

上级 1c3b3fac
......@@ -129,11 +129,11 @@ class Group < Namespace
end
def visibility_level_allowed_by_projects?(level = self.visibility_level)
projects.where('visibility_level > ?', level).none?
!projects.where('visibility_level > ?', level).exists?
end
def visibility_level_allowed_by_sub_groups?(level = self.visibility_level)
children.where('visibility_level > ?', level).none?
!children.where('visibility_level > ?', level).exists?
end
def visibility_level_allowed?(level = self.visibility_level)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册