forked from e621ng/e621ng
[Cleanup] Remove more upload attributes
This commit is contained in:
parent
92a0a36589
commit
2a4f97610e
@ -5,7 +5,6 @@ module Downloads
|
||||
|
||||
RETRIABLE_ERRORS = [Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EIO, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Timeout::Error, IOError]
|
||||
|
||||
delegate :data, to: :strategy
|
||||
attr_reader :url
|
||||
|
||||
validate :validate_url
|
||||
|
@ -100,12 +100,10 @@ class Upload < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
attr_accessor :as_pending, :replaced_post, :file, :direct_url, :is_apng, :original_post_id, :locked_tags, :locked_rating, :replacement_id
|
||||
belongs_to :uploader, :class_name => "User"
|
||||
belongs_to :post, optional: true
|
||||
|
||||
before_validation :initialize_attributes, on: :create
|
||||
before_validation :assign_rating_from_tags
|
||||
before_validation :fixup_source, on: :create
|
||||
validate :uploader_is_not_limited, on: :create
|
||||
@ -114,11 +112,6 @@ class Upload < ApplicationRecord
|
||||
validates :rating, inclusion: { in: %w(q e s) }, allow_nil: false
|
||||
validates :md5, confirmation: true, if: -> (rec) { rec.md5_confirmation.present? }
|
||||
validates_with FileValidator, on: :file
|
||||
serialize :context, JSON
|
||||
|
||||
def initialize_attributes
|
||||
self.server = Danbooru.config.server_host
|
||||
end
|
||||
|
||||
module FileMethods
|
||||
def is_image?
|
||||
@ -269,10 +262,6 @@ class Upload < ApplicationRecord
|
||||
q = q.where("uploads.tag_string LIKE ? ESCAPE E'\\\\'", params[:tag_string].to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
if params[:server].present?
|
||||
q = q.where(server: params[:server])
|
||||
end
|
||||
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
end
|
||||
|
@ -42,11 +42,11 @@ module Danbooru
|
||||
|
||||
# Contact email address of the admin.
|
||||
def contact_email
|
||||
"management@#{server_host}"
|
||||
"management@#{domain}"
|
||||
end
|
||||
|
||||
def takedown_email
|
||||
"management@#{server_host}"
|
||||
"management@#{domain}"
|
||||
end
|
||||
|
||||
def takedown_links
|
||||
@ -428,11 +428,6 @@ fart'
|
||||
}
|
||||
end
|
||||
|
||||
# The name of the server the app is hosted on.
|
||||
def server_host
|
||||
Socket.gethostname
|
||||
end
|
||||
|
||||
# The method to use for storing image files.
|
||||
def storage_manager
|
||||
# Store files on the local filesystem.
|
||||
|
@ -7,7 +7,6 @@ FactoryBot.define do
|
||||
uploader_ip_addr { "127.0.0.1" }
|
||||
tag_string { "special" }
|
||||
status { "pending" }
|
||||
server { Socket.gethostname }
|
||||
source { "xxx" }
|
||||
|
||||
factory(:source_upload) do
|
||||
|
@ -95,8 +95,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
||||
rating: @upload.rating,
|
||||
has_post: "yes",
|
||||
post_tags_match: @upload.tag_string,
|
||||
status: @upload.status,
|
||||
server: @upload.server,
|
||||
status: @upload.status
|
||||
}
|
||||
|
||||
get uploads_path, params: { search: search_params }
|
||||
|
Loading…
Reference in New Issue
Block a user