From 817d4a93725aca884c638413334a0f08b88cc0ed Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 10 Jan 2020 00:10:17 +0100 Subject: Add --remote-only option to emoji purge (#12810) Fixes #12804 --- lib/mastodon/emoji_cli.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/emoji_cli.rb b/lib/mastodon/emoji_cli.rb index beac1b1fd..dbaf12018 100644 --- a/lib/mastodon/emoji_cli.rb +++ b/lib/mastodon/emoji_cli.rb @@ -72,9 +72,16 @@ module Mastodon say("Imported #{imported}, skipped #{skipped}, failed to import #{failed}", color(imported, skipped, failed)) end + option :remote_only, type: :boolean desc 'purge', 'Remove all custom emoji' + long_desc <<-LONG_DESC + Removes all custom emoji. + + With the --remote-only option, only remote emoji will be deleted. + LONG_DESC def purge - CustomEmoji.in_batches.destroy_all + scope = options[:remote_only] ? CustomEmoji.remote : CustomEmoji + scope.in_batches.destroy_all say('OK', :green) end -- cgit From 3b08535463029f45e3524ce2ccaea746eda15c57 Mon Sep 17 00:00:00 2001 From: Gomasy Date: Sat, 11 Jan 2020 14:41:37 +0900 Subject: Keep statuses bookmarked by local users in tootctl statuses remove (#12818) --- lib/mastodon/statuses_cli.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/statuses_cli.rb b/lib/mastodon/statuses_cli.rb index 74f15de5f..ecaac17e3 100644 --- a/lib/mastodon/statuses_cli.rb +++ b/lib/mastodon/statuses_cli.rb @@ -48,6 +48,8 @@ module Mastodon scope = scope.where('id NOT IN (SELECT statuses1.reblog_of_id FROM statuses AS statuses1 WHERE statuses.id = statuses1.reblog_of_id AND (statuses1.uri IS NULL OR statuses1.local OR statuses1.id >= ?))', max_id) # Skip statuses favourited by local users scope = scope.where('id NOT IN (SELECT favourites.status_id FROM favourites WHERE statuses.id = favourites.status_id AND favourites.account_id IN (SELECT accounts.id FROM accounts WHERE domain IS NULL))') + # Skip statuses bookmarked by local users + scope = scope.where('id NOT IN (SELECT bookmarks.status_id FROM bookmarks WHERE statuses.id = bookmarks.status_id AND bookmarks.account_id IN (SELECT accounts.id FROM accounts WHERE domain IS NULL))') unless options[:clean_followed] # Skip accounts followed by local accounts -- cgit From 10f1450bba228502ca897338d7ad883d6ed7ed1f Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 11 Jan 2020 21:38:02 +0100 Subject: Fix ruby 2.7 warnings about keyword parameters (#12824) --- app/helpers/routing_helper.rb | 4 ++-- lib/paperclip/blurhash_transcoder.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/app/helpers/routing_helper.rb b/app/helpers/routing_helper.rb index 998b7566f..fb24a1b28 100644 --- a/app/helpers/routing_helper.rb +++ b/app/helpers/routing_helper.rb @@ -13,13 +13,13 @@ module RoutingHelper end def full_asset_url(source, **options) - source = ActionController::Base.helpers.asset_url(source, options) unless use_storage? + source = ActionController::Base.helpers.asset_url(source, **options) unless use_storage? URI.join(root_url, source).to_s end def full_pack_url(source, **options) - full_asset_url(asset_pack_path(source, options)) + full_asset_url(asset_pack_path(source, **options)) end private diff --git a/lib/paperclip/blurhash_transcoder.rb b/lib/paperclip/blurhash_transcoder.rb index 08925a6dd..5c33c98b0 100644 --- a/lib/paperclip/blurhash_transcoder.rb +++ b/lib/paperclip/blurhash_transcoder.rb @@ -8,7 +8,7 @@ module Paperclip pixels = convert(':source RGB:-', source: File.expand_path(@file.path)).unpack('C*') geometry = options.fetch(:file_geometry_parser).from_file(@file) - attachment.instance.blurhash = Blurhash.encode(geometry.width, geometry.height, pixels, options[:blurhash] || {}) + attachment.instance.blurhash = Blurhash.encode(geometry.width, geometry.height, pixels, **(options[:blurhash] || {})) @file end -- cgit