Skip to content
Snippets Groups Projects
Commit 0559ab42 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Changed activities filter

parent badacd18
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,11 @@ class ActivityPolicy < ApplicationPolicy ...@@ -9,7 +9,11 @@ class ActivityPolicy < ApplicationPolicy
end end
def resolve def resolve
scope.includes(:owner,:recipient).where("privacy = 'public'").where.not(key: activities_filter).order('created_at DESC').all if user.is_admin?
scope.includes(:owner,:recipient).order('created_at DESC').all
else
scope.includes(:owner,:recipient).where("privacy = 'public'").where(key: activities_filter).order('created_at DESC').all
end
end end
end end
......
module ActivitiesFilterService module ActivitiesFilterService
def activities_filtered def activities_filtered
self.activities.where.not(key: activities_filter) if !self.try(:draft?)
self.activities.where(key: activities_filter)
else
[]
end
end end
def activities_filter def activities_filter
[ 'complaint.update', 'complaint.destroy', [ 'complaint.create',
'complaint_reason.create', 'complaint_reason.update', 'complaint_reason.destroy', 'collection.create', 'collection.update', 'collection.destroy',
'institution.create', 'institution.update', 'institution.destroy', 'collection_item.create', 'collection_item.update', 'collection_item.destroy',
'review.update', 'review.destroy', 'learning_object.create', 'learning_object.update', 'learning_object.destroy',
'rate.create', 'rate.update', 'rate.destroy', 'review.create',
'follow.create', 'follow.update', 'follow.destroy', 'download.create',
'share.create', 'share.update', 'share.destroy', 'like.create', 'like.destroy'
'view.create', 'view.update', 'view.destroy',
'tagging.create', 'tagging.update', 'tagging.destroy',
'bookmark.create', 'bookmark.update', 'bookmark.destroy',
'download.update', 'download.destroy',
'like.update'
] ]
end end
end 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