From 1075277d3610a52b84d9f8b1a0c27cbeeaac3872 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 26 Sep 2021 07:58:06 -0500 Subject: [PATCH] posts: remove unused methods. --- app/models/post.rb | 40 +------------------------------- test/unit/upload_service_test.rb | 1 - 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index ea36ce9a5..b5ba47597 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -103,16 +103,6 @@ class Post < ApplicationRecord Post.delete_files(id, md5, file_ext, force: true) 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 Danbooru.config.backup_storage_manager end @@ -145,18 +135,6 @@ class Post < ApplicationRecord storage_manager.file_url(self, :preview) 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 storage_manager.file_url(self, :crop) end @@ -185,28 +163,12 @@ class Post < ApplicationRecord file_ext =~ /jpg|gif|png/i end - def is_png? - file_ext =~ /png/i - end - - def is_gif? - file_ext =~ /gif/i - end - def is_flash? file_ext =~ /swf/i end - def is_webm? - file_ext =~ /webm/i - end - - def is_mp4? - file_ext =~ /mp4/i - end - def is_video? - is_webm? || is_mp4? + file_ext.in?(%w[webm mp4]) end def is_ugoira? diff --git a/test/unit/upload_service_test.rb b/test/unit/upload_service_test.rb index 48b5b05e1..b16fe466a 100644 --- a/test/unit/upload_service_test.rb +++ b/test/unit/upload_service_test.rb @@ -405,7 +405,6 @@ class UploadServiceTest < ActiveSupport::TestCase should "work" do as(@user) { @post.replace!(replacement_url: @post.source) } assert_equal(@post_md5, @post.md5) - assert_match(/#{@post_md5}/, @post.file_path) end end