posts: remove unused methods.
This commit is contained in:
@@ -103,16 +103,6 @@ class Post < ApplicationRecord
|
|||||||
Post.delete_files(id, md5, file_ext, force: true)
|
Post.delete_files(id, md5, file_ext, force: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def distribute_files(file, sample_file, preview_file)
|
|
||||||
storage_manager.store_file(file, self, :original)
|
|
||||||
storage_manager.store_file(sample_file, self, :large) if sample_file.present?
|
|
||||||
storage_manager.store_file(preview_file, self, :preview) if preview_file.present?
|
|
||||||
|
|
||||||
backup_storage_manager.store_file(file, self, :original)
|
|
||||||
backup_storage_manager.store_file(sample_file, self, :large) if sample_file.present?
|
|
||||||
backup_storage_manager.store_file(preview_file, self, :preview) if preview_file.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def backup_storage_manager
|
def backup_storage_manager
|
||||||
Danbooru.config.backup_storage_manager
|
Danbooru.config.backup_storage_manager
|
||||||
end
|
end
|
||||||
@@ -145,18 +135,6 @@ class Post < ApplicationRecord
|
|||||||
storage_manager.file_url(self, :preview)
|
storage_manager.file_url(self, :preview)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_path
|
|
||||||
storage_manager.file_path(self, file_ext, :original)
|
|
||||||
end
|
|
||||||
|
|
||||||
def large_file_path
|
|
||||||
storage_manager.file_path(self, file_ext, :large)
|
|
||||||
end
|
|
||||||
|
|
||||||
def preview_file_path
|
|
||||||
storage_manager.file_path(self, file_ext, :preview)
|
|
||||||
end
|
|
||||||
|
|
||||||
def crop_file_url
|
def crop_file_url
|
||||||
storage_manager.file_url(self, :crop)
|
storage_manager.file_url(self, :crop)
|
||||||
end
|
end
|
||||||
@@ -185,28 +163,12 @@ class Post < ApplicationRecord
|
|||||||
file_ext =~ /jpg|gif|png/i
|
file_ext =~ /jpg|gif|png/i
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_png?
|
|
||||||
file_ext =~ /png/i
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_gif?
|
|
||||||
file_ext =~ /gif/i
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_flash?
|
def is_flash?
|
||||||
file_ext =~ /swf/i
|
file_ext =~ /swf/i
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_webm?
|
|
||||||
file_ext =~ /webm/i
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_mp4?
|
|
||||||
file_ext =~ /mp4/i
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_video?
|
def is_video?
|
||||||
is_webm? || is_mp4?
|
file_ext.in?(%w[webm mp4])
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_ugoira?
|
def is_ugoira?
|
||||||
|
|||||||
@@ -405,7 +405,6 @@ class UploadServiceTest < ActiveSupport::TestCase
|
|||||||
should "work" do
|
should "work" do
|
||||||
as(@user) { @post.replace!(replacement_url: @post.source) }
|
as(@user) { @post.replace!(replacement_url: @post.source) }
|
||||||
assert_equal(@post_md5, @post.md5)
|
assert_equal(@post_md5, @post.md5)
|
||||||
assert_match(/#{@post_md5}/, @post.file_path)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user