From 5aa7e09645b27bae38a26030148b23e553ee2662 Mon Sep 17 00:00:00 2001 From: Maya Minatsuki Date: Wed, 29 Aug 2018 02:03:04 +0900 Subject: [PATCH] Fix that can't delete media files even if "tootctl media remove" execute when "--background" not attached. --- app/workers/maintenance/uncache_media_worker.rb | 2 +- lib/mastodon/media_cli.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/workers/maintenance/uncache_media_worker.rb b/app/workers/maintenance/uncache_media_worker.rb index 4bc62ef755..2d1a670a76 100644 --- a/app/workers/maintenance/uncache_media_worker.rb +++ b/app/workers/maintenance/uncache_media_worker.rb @@ -6,7 +6,7 @@ class Maintenance::UncacheMediaWorker sidekiq_options queue: 'pull' def perform(media_attachment_id) - media = media_attachment_id.is_a?(MediaAttachment) ? media_attachment_id : MediaAttachment.find(media_attachment_id) + media = MediaAttachment.find(media_attachment_id) return if media.file.blank? diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb index ee28270da7..f9204395f5 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/media_cli.rb @@ -34,7 +34,7 @@ module Mastodon Maintenance::UncacheMediaWorker.push_bulk(media_attachments.map(&:id)) else media_attachments.each do |m| - Maintenance::UncacheMediaWorker.new.perform(m) + Maintenance::UncacheMediaWorker.new.perform(m.id) say('.', :green, false) processed += 1 end