You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
290 B

  1. # frozen_string_literal: true
  2. class AccountWarningPolicy < ApplicationPolicy
  3. def show?
  4. target? || staff?
  5. end
  6. def appeal?
  7. target? && record.created_at >= Appeal::MAX_STRIKE_AGE.ago
  8. end
  9. private
  10. def target?
  11. record.target_account_id == current_account&.id
  12. end
  13. end