From 974281d140a37d8c480bcf871b9498c50d42769b Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 16 Jan 2014 11:40:33 +0200
Subject: [PATCH] FilteringService works with scope :all event if current user
 is not defined

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/services/filtering_service.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/services/filtering_service.rb b/app/services/filtering_service.rb
index f8adeb20ff7..b339065890b 100644
--- a/app/services/filtering_service.rb
+++ b/app/services/filtering_service.rb
@@ -44,7 +44,11 @@ class FilteringService
     when 'created-by-me', 'authored' then
       current_user.send(table_name)
     when 'all' then
-      klass.of_projects(current_user.authorized_projects.pluck(:id))
+      if current_user
+        klass.of_projects(current_user.authorized_projects.pluck(:id))
+      else
+        klass.of_projects(Project.public_only)
+      end
     when 'assigned-to-me' then
       current_user.send("assigned_#{table_name}")
     else
-- 
GitLab