Consistent usage of CLI dry_run? method (#25116)

This commit is contained in:
Matt Jankowski 2023-05-30 10:07:44 -04:00 committed by GitHub
parent 3d253b9830
commit ec9bc7e604
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 58 deletions

View file

@ -27,7 +27,6 @@ module Mastodon::CLI
DESC
def remove
time_ago = options[:days].days.ago
dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
link = options[:link] ? 'link-type ' : ''
scope = PreviewCard.cached
scope = scope.where(type: :link) if options[:link]
@ -38,7 +37,7 @@ module Mastodon::CLI
size = preview_card.image_file_size
unless options[:dry_run]
unless dry_run?
preview_card.image.destroy
preview_card.save
end
@ -46,7 +45,7 @@ module Mastodon::CLI
size
end
say("Removed #{processed} #{link}preview cards (approx. #{number_to_human_size(aggregate)})#{dry_run}", :green, true)
say("Removed #{processed} #{link}preview cards (approx. #{number_to_human_size(aggregate)})#{dry_run_mode_suffix}", :green, true)
end
end
end