Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/application_controller.rb Minor conflict due to glitch-soc's theming system
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user