Commit 974281d140a37d8c480bcf871b9498c50d42769b
1 parent
a77dfc46
Exists in
spb-stable
and in
3 other branches
FilteringService works with scope :all event if current user is not defined
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
app/services/filtering_service.rb
| ... | ... | @@ -44,7 +44,11 @@ class FilteringService |
| 44 | 44 | when 'created-by-me', 'authored' then |
| 45 | 45 | current_user.send(table_name) |
| 46 | 46 | when 'all' then |
| 47 | - klass.of_projects(current_user.authorized_projects.pluck(:id)) | |
| 47 | + if current_user | |
| 48 | + klass.of_projects(current_user.authorized_projects.pluck(:id)) | |
| 49 | + else | |
| 50 | + klass.of_projects(Project.public_only) | |
| 51 | + end | |
| 48 | 52 | when 'assigned-to-me' then |
| 49 | 53 | current_user.send("assigned_#{table_name}") |
| 50 | 54 | else | ... | ... |