Clarify preview card CLI command handles media only (#39348)
This commit is contained in:
parent
885a9f1d84
commit
c51eb56a90
@ -11,18 +11,17 @@ module Mastodon::CLI
|
|||||||
option :verbose, type: :boolean, aliases: [:v]
|
option :verbose, type: :boolean, aliases: [:v]
|
||||||
option :dry_run, type: :boolean, default: false
|
option :dry_run, type: :boolean, default: false
|
||||||
option :link, type: :boolean, default: false
|
option :link, type: :boolean, default: false
|
||||||
desc 'remove', 'Remove preview cards'
|
desc 'remove', 'Remove preview card media'
|
||||||
long_desc <<-DESC
|
long_desc <<-DESC
|
||||||
Removes local thumbnails for preview cards.
|
Removes local thumbnails for preview cards.
|
||||||
|
|
||||||
The --days option specifies how old preview cards have to be before
|
The --days option sets the age a preview card must be before attached
|
||||||
they are removed. It defaults to 180 days. Since preview cards will
|
media will be removed. Preview cards will not be re-fetched unless the
|
||||||
not be re-fetched unless the link is re-posted after 2 weeks from
|
link is posted again two weeks after the last usage, so it is not
|
||||||
last time, it is not recommended to delete preview cards within the
|
recommended to delete preview card media from within the last 14 days.
|
||||||
last 14 days.
|
|
||||||
|
|
||||||
With the --link option, only link-type preview cards will be deleted,
|
With the --link option, only media from link-type preview cards will be
|
||||||
leaving video and photo cards untouched.
|
deleted, skipping video and photo cards.
|
||||||
DESC
|
DESC
|
||||||
def remove
|
def remove
|
||||||
time_ago = options[:days].days.ago
|
time_ago = options[:days].days.ago
|
||||||
@ -44,7 +43,7 @@ module Mastodon::CLI
|
|||||||
size
|
size
|
||||||
end
|
end
|
||||||
|
|
||||||
say("Removed #{processed} #{link}preview cards (approx. #{number_to_human_size(aggregate)})#{dry_run_mode_suffix}", :green, true)
|
say("Removed media from #{processed} #{link}preview cards (approx. #{number_to_human_size(aggregate)})#{dry_run_mode_suffix}", :green, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -26,7 +26,7 @@ RSpec.describe Mastodon::CLI::PreviewCards do
|
|||||||
it 'deletes thumbnails for local preview cards' do
|
it 'deletes thumbnails for local preview cards' do
|
||||||
expect { subject }
|
expect { subject }
|
||||||
.to output_results(
|
.to output_results(
|
||||||
'Removed 2 preview cards',
|
'Removed media from 2 preview cards',
|
||||||
'approx. 119 KB'
|
'approx. 119 KB'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -38,7 +38,7 @@ RSpec.describe Mastodon::CLI::PreviewCards do
|
|||||||
it 'deletes thumbnails for local preview cards' do
|
it 'deletes thumbnails for local preview cards' do
|
||||||
expect { subject }
|
expect { subject }
|
||||||
.to output_results(
|
.to output_results(
|
||||||
'Removed 1 link-type preview cards',
|
'Removed media from 1 link-type preview cards',
|
||||||
'approx. 59.6 KB'
|
'approx. 59.6 KB'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -50,7 +50,7 @@ RSpec.describe Mastodon::CLI::PreviewCards do
|
|||||||
it 'deletes thumbnails for local preview cards' do
|
it 'deletes thumbnails for local preview cards' do
|
||||||
expect { subject }
|
expect { subject }
|
||||||
.to output_results(
|
.to output_results(
|
||||||
'Removed 1 preview cards',
|
'Removed media from 1 preview cards',
|
||||||
'approx. 59.6 KB'
|
'approx. 59.6 KB'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user