Skip to content

Commit

Permalink
Improve Emoji import (fix mastodon#15429) (mastodon#15430)
Browse files Browse the repository at this point in the history
* Improve Emoji import

Skip macOS '._' shadow files in tar archive to speed up import

* Fix codeclimate format issue with whitespace

* Update lib/mastodon/emoji_cli.rb

suggestions from Gargron to improve comment

Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>

* Update emoji_cli.rb

Remove extraneous comment (macOS-specific comment now with correct line)

Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
  • Loading branch information
2 people authored and ClearlyClaire committed Jan 28, 2022
1 parent add7b9f commit fc4b985
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/mastodon/emoji_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ def import(path)
tar.each do |entry|
next unless entry.file? && entry.full_name.end_with?('.png')

shortcode = [options[:prefix], File.basename(entry.full_name, '.*'), options[:suffix]].compact.join
filename = File.basename(entry.full_name, '.*')

# Skip macOS shadow files
next if filename.start_with?('._')

shortcode = [options[:prefix], filename, options[:suffix]].compact.join
custom_emoji = CustomEmoji.local.find_by(shortcode: shortcode)

if custom_emoji && !options[:overwrite]
Expand Down

0 comments on commit fc4b985

Please sign in to comment.