0
0
Fork 0

Change tootctl media remove-orphans to work for all classes (#13316)

Change `tootctl media lookup` to not use an interactive prompt
This commit is contained in:
Eugen Rochko 2020-03-26 01:56:41 +01:00 committed by GitHub
parent e187537dfd
commit 0c8945e5ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 41 deletions

View file

@ -184,19 +184,6 @@ class MediaAttachment < ApplicationRecord
audio? || video?
end
def variant?(other_file_name)
return true if file_file_name == other_file_name
return false if file_file_name.nil?
formats = file.styles.values.map(&:format).compact
return false if formats.empty?
extension = File.extname(other_file_name)
formats.include?(extension.delete('.')) && File.basename(other_file_name, extension) == File.basename(file_file_name, File.extname(file_file_name))
end
def to_param
shortcode
end