Skip to content
Extraits de code Groupes Projets
Valider 249bdc16 rédigé par Akihiko Odaki's avatar Akihiko Odaki Validation de Eugen Rochko
Parcourir les fichiers

Explicitly define attached file of DeprecatedPreviewCard (#4786)

The path template of the attached files must explicitly be defined because
it is contradicting to the name of the class.
parent 9dd8dff6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -275,8 +275,15 @@ namespace :mastodon do ...@@ -275,8 +275,15 @@ namespace :mastodon do
task remove_deprecated_preview_cards: :environment do task remove_deprecated_preview_cards: :environment do
return unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards' return unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
class DeprecatedPreviewCard < PreviewCard class DeprecatedPreviewCard < ActiveRecord::Base
self.table_name = 'deprecated_preview_cards' self.inheritance_column = false
path = '/preview_cards/:attachment/:id_partition/:style/:filename'
if ENV['S3_ENABLED'] != 'true'
path = (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + path
end
has_attached_file :image, styles: { original: '280x120>' }, convert_options: { all: '-quality 80 -strip' }, path: path
end end
puts 'Delete records and associated files from deprecated preview cards? [y/N]: ' puts 'Delete records and associated files from deprecated preview cards? [y/N]: '
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter