From 0fdce4a52b1a9ba9e0efd98f00e558e4f07daeb5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 5 Jun 2014 20:37:35 +0300 Subject: Refactor some search scopes to prevent wierd behaviour and PG::Error issues Signed-off-by: Dmitriy Zaporozhets --- app/models/group.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'app/models/group.rb') diff --git a/app/models/group.rb b/app/models/group.rb index 2e68779d367..e51e19ab60c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -27,12 +27,6 @@ class Group < Namespace mount_uploader :avatar, AttachmentUploader - def self.accessible_to(user) - accessible_ids = Project.accessible_to(user).pluck(:namespace_id) - accessible_ids += user.groups.pluck(:id) if user - where(id: accessible_ids) - end - def human_name name end @@ -77,4 +71,8 @@ class Group < Namespace self.errors.add :avatar, "only images allowed" end end + + def public_profile? + projects.public_only.any? + end end -- cgit v1.2.3