Add tootctl media remove-orphans
(#12568)
This commit is contained in:
parent
6d7daf6154
commit
f3d232381d
3 changed files with 90 additions and 1 deletions
|
@ -167,6 +167,18 @@ class MediaAttachment < ApplicationRecord
|
|||
audio? || video?
|
||||
end
|
||||
|
||||
def variant?(other_file_name)
|
||||
return true if file_file_name == other_file_name
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue