Skip to content
Snippets Groups Projects
Commit 65a9d2f8 authored by Clarissa's avatar Clarissa
Browse files

#241: fix bug - show collection of cuurent_user (index)

parent 02b7b1a1
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,12 @@ class CollectionPolicy < ApplicationPolicy
class Scope < Scope
def resolve
if !user.nil? && user.is_admin?
scope.all
if !user.nil?
if user.is_admin?
scope.all
else
scope.includes(:collection_items).where.not(:collection_items => {:collection_id => nil}).where("privacy = ? OR owner_id = ?", 'public', user.id)
end
else
scope.includes(:collection_items).where.not(:collection_items => {:collection_id => nil}).where(privacy: 'public')
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment