Make private favgroups a Gold-only option. This is for consistency with private favorites and upvotes being Gold-only options. Existing Members with private favgroups are allowed to keep them, as long as they don't disable privacy. If they disable it, then they can't re-enable it again without upgrading to Gold first.
26 lines
434 B
Ruby
26 lines
434 B
Ruby
class FavoriteGroupPolicy < ApplicationPolicy
|
|
def show?
|
|
record.creator_id == user.id || record.is_public
|
|
end
|
|
|
|
def create?
|
|
!user.is_anonymous?
|
|
end
|
|
|
|
def update?
|
|
record.creator_id == user.id
|
|
end
|
|
|
|
def add_post?
|
|
update?
|
|
end
|
|
|
|
def can_enable_privacy?
|
|
record.creator.is_gold?
|
|
end
|
|
|
|
def permitted_attributes
|
|
[:name, :post_ids_string, :is_public, :is_private, :post_ids, { post_ids: [] }]
|
|
end
|
|
end
|