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

20 lines
382 B
Ruby

# frozen_string_literal: true
class WikiPagePolicy < ApplicationPolicy
def update?
unbanned? && (can_edit_locked? || !record.is_locked?)
end
def revert?
update?
end
def can_edit_locked?
user.is_builder?
end
def permitted_attributes
[:title, :body, :other_names, :other_names_string, :is_deleted, (:is_locked if can_edit_locked?)].compact
end
end