]> cat aescling's git repositories - mastodon.git/commitdiff
Add --remote-only option to emoji purge (#12810)
authorThibG <thib@sitedethib.com>
Thu, 9 Jan 2020 23:10:17 +0000 (00:10 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 9 Jan 2020 23:10:17 +0000 (00:10 +0100)
Fixes #12804

lib/mastodon/emoji_cli.rb

index beac1b1fd22606f3821f71c98d8ad78bb5e2fc65..dbaf120182f2f004a77bee90c1e76e317dcd82d9 100644 (file)
@@ -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