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:
@@ -24,8 +24,6 @@ class Comment < ApplicationRecord
|
||||
:body => ->(user_name) {"@#{creator.name} mentioned you in a \"comment\":/posts/#{post_id}#comment-#{id} on post ##{post_id}:\n\n[quote]\n#{DText.extract_mention(body, "@" + user_name)}\n[/quote]\n"}
|
||||
)
|
||||
|
||||
api_attributes including: [:creator_name, :updater_name]
|
||||
|
||||
module SearchMethods
|
||||
def deleted
|
||||
where("comments.is_deleted = true")
|
||||
@@ -155,14 +153,6 @@ class Comment < ApplicationRecord
|
||||
select { |comment| comment.visibility(user) == :visible }
|
||||
end
|
||||
|
||||
def creator_name
|
||||
creator.name
|
||||
end
|
||||
|
||||
def updater_name
|
||||
updater.name
|
||||
end
|
||||
|
||||
def delete!
|
||||
update(is_deleted: true)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user