API: remove various associated fields included by default.

Remove various associated fields that were included by default on
certain endpoints. API users can use the only param to include the
full association if they need these fields.

* /artists.json: urls.
* /artist_urls.json: artist.
* /comments.json: creator_name and updater_name.
* /notes.json: creator_name.
* /pools.json: creator_name.
* /posts.json: uploader_name, children_ids, pixiv_ugoira_frame_data.
* /post_appeals.json: is_resolved.
* /post_versions.json: updater_name.
* /uploads.json: uploader_name.
This commit is contained in:
evazion
2020-02-14 20:15:51 -06:00
parent c5bcfb962f
commit 8649ff6dbe
15 changed files with 10 additions and 84 deletions

View File

@@ -15,7 +15,7 @@ class Pool < ApplicationRecord
after_save :create_version
after_create :synchronize!
api_attributes including: [:creator_name, :post_count]
api_attributes including: [:post_count]
module SearchMethods
def deleted
@@ -279,10 +279,6 @@ class Pool < ApplicationRecord
(post_count / CurrentUser.user.per_page.to_f).ceil
end
def creator_name
creator.name
end
def validate_name
case name
when /\A(any|none|series|collection)\z/i