Remove the `category_name` field from the `/wiki_page.json` API. This field was originally added only because it was needed by our autocomplete Javascript. It was also misnamed, it wasn't the tag's category name, it was the category's ID. Users should use `https://danbooru.donmai.us/wiki_pages.json?only=title,tag` instead if they need this. This triggered a N+1 query pattern when dumping wiki pages to BigQuery, which made dumping wiki pages very slow. It also meant this field was included in the database dump, even though it wasn't a real database column.
18 lines
351 B
Ruby
18 lines
351 B
Ruby
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
|