Add tootctl command for set custom emoji size if not set

This commit is contained in:
KMY 2023-03-23 07:23:39 +09:00
parent 2cdaf2af76
commit a319dbb7d5
2 changed files with 28 additions and 6 deletions

View file

@ -132,6 +132,21 @@ module Mastodon
say('OK', :green)
end
desc 'size', 'Set custom emojis width/height'
long_desc <<-LONG_DESC
Set custom emojis width/height if width/height is nil or zero.
LONG_DESC
def size
scope = CustomEmoji.where(image_width: nil).or(CustomEmoji.where(image_height: [0, nil]))
size = scope.size
count = 0
scope.find_each do |emoji|
emoji.update_size
count += 1
say("(#{count}/#{size}) proceed #{emoji.shortcode}@#{emoji.domain}")
end
end
private
def color(green, _yellow, red)