Remove the ability to skip secondary validations when creating a BUR. The only skippable validation that still existed was the requirement that both tags in an implication must have wiki pages. It's now mandatory to write wiki pages for tags before you can request an implication. This doesn't apply to empty tags.
34 lines
726 B
Ruby
34 lines
726 B
Ruby
class BulkUpdateRequestPolicy < ApplicationPolicy
|
|
def create?
|
|
unbanned? && (record.forum_topic.blank? || policy(record.forum_topic).reply?)
|
|
end
|
|
|
|
def update?
|
|
unbanned? && (user.is_builder? || record.user_id == user.id)
|
|
end
|
|
|
|
def approve?
|
|
unbanned? && !record.is_approved? && (user.is_admin? || (user.is_builder? && record.is_tag_move_allowed?))
|
|
end
|
|
|
|
def destroy?
|
|
record.is_pending? && update?
|
|
end
|
|
|
|
def can_update_forum?
|
|
user.is_admin?
|
|
end
|
|
|
|
def permitted_attributes_for_create
|
|
[:script, :title, :reason, :forum_topic_id]
|
|
end
|
|
|
|
def permitted_attributes_for_update
|
|
if can_update_forum?
|
|
[:script, :forum_topic_id, :forum_post_id]
|
|
else
|
|
[:script]
|
|
end
|
|
end
|
|
end
|