Files
danbooru/app/policies/favorite_group_policy.rb
evazion a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00

28 lines
465 B
Ruby

# frozen_string_literal: true
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