forked from e621ng/e621ng
[Cleanup] Remove legacy api code
This commit is contained in:
parent
5ebc8756c9
commit
95337c59bd
@ -1552,35 +1552,6 @@ class Post < ApplicationRecord
|
||||
hash
|
||||
end
|
||||
|
||||
def legacy_attributes
|
||||
hash = {
|
||||
"has_comments" => last_commented_at.present?,
|
||||
"parent_id" => parent_id,
|
||||
"status" => status,
|
||||
"has_children" => has_children?,
|
||||
"created_at" => created_at.to_formatted_s(:db),
|
||||
"has_notes" => has_notes?,
|
||||
"rating" => rating,
|
||||
"author" => uploader_name,
|
||||
"creator_id" => uploader_id,
|
||||
"width" => image_width,
|
||||
"source" => source,
|
||||
"score" => score,
|
||||
"tags" => tag_string,
|
||||
"height" => image_height,
|
||||
"file_size" => file_size,
|
||||
"id" => id
|
||||
}
|
||||
|
||||
if visible?
|
||||
hash["file_url"] = file_url
|
||||
hash["preview_url"] = preview_file_url
|
||||
hash["md5"] = md5
|
||||
end
|
||||
|
||||
hash
|
||||
end
|
||||
|
||||
def status
|
||||
if is_pending?
|
||||
"pending"
|
||||
|
@ -64,19 +64,6 @@ class Tag < ApplicationRecord
|
||||
|
||||
before_save :update_category, if: :category_changed?
|
||||
|
||||
module ApiMethods
|
||||
def to_legacy_json
|
||||
return {
|
||||
"name" => name,
|
||||
"id" => id,
|
||||
"created_at" => created_at.try(:strftime, "%Y-%m-%d %H:%M"),
|
||||
"count" => post_count,
|
||||
"type" => category,
|
||||
"ambiguous" => false
|
||||
}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
class CategoryMapping
|
||||
TagCategory.reverse_mapping.each do |value, category|
|
||||
define_method(category) do
|
||||
@ -1196,7 +1183,6 @@ class Tag < ApplicationRecord
|
||||
true
|
||||
end
|
||||
|
||||
include ApiMethods
|
||||
include CountMethods
|
||||
include CategoryMethods
|
||||
extend StatisticsMethods
|
||||
|
@ -693,15 +693,6 @@ class User < ApplicationRecord
|
||||
:neutral_feedback_count, :negative_feedback_count, :upload_limit
|
||||
]
|
||||
end
|
||||
|
||||
def to_legacy_json
|
||||
return {
|
||||
"name" => name,
|
||||
"id" => id,
|
||||
"level" => level,
|
||||
"created_at" => created_at.strftime("%Y-%m-%d %H:%M")
|
||||
}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
module CountMethods
|
||||
|
@ -1 +0,0 @@
|
||||
[<%= raw @artists.map(&:to_json).join(",") %>]
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artists type="array">
|
||||
<% @artists.each do |artist| %>
|
||||
<artist group_name="<%= artist.group_name %>" other_names="<%= artist.other_names %>" urls="<%= artist.urls.map {|x| x.url}.join(" ") %>" is_active="<%= artist.is_active? %>" name="<%= artist.name %>" updater_id="0" id="<%= artist.id %>" version="0"/>
|
||||
<% end %>
|
||||
</artists>
|
@ -1 +0,0 @@
|
||||
[<%= @tags.map {|x| x.to_legacy_json}.join(", ").html_safe %>]
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tags type="array">
|
||||
<% @tags.each do |tag| %>
|
||||
<tag name="<%= tag.name %>" id="<%= tag.id %>" ambiguous="false" created_at="<%= tag.created_at.try(:strftime, '%Y-%m-%d %H:%M') %>" count="<%= tag.post_count %>" type="<%= tag.category %>"></tag>
|
||||
<% end %>
|
||||
</tags>
|
@ -1 +0,0 @@
|
||||
[<%= @users.map {|x| x.to_legacy_json}.join(", ").html_safe %>]
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<users type="array">
|
||||
<% @users.each do |user| %>
|
||||
<user name="<%= user.name %>" id="<%= user.id %>" created_at="<%= user.created_at.strftime('%Y-%m-%d %H:%M') %>" level="<%= user.level %>"></user>
|
||||
<% end %>
|
||||
</users>
|
Loading…
Reference in New Issue
Block a user