summaryrefslogtreecommitdiff
path: root/app/policies/award_emoji_policy.rb
blob: 21e382e24b31482bf680212a864874b3d09d0673 (plain)
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

class AwardEmojiPolicy < BasePolicy
  delegate { @subject.awardable if DeclarativePolicy.has_policy?(@subject.awardable) }

  condition(:can_read_awardable) do
    can?(:"read_#{@subject.awardable.to_ability_name}")
  end

  rule { can_read_awardable }.enable :read_emoji
end