Fix tag mb_chars comparison of profile directory (#9448)

This commit is contained in:
Takeshi Umeda 2018-12-07 12:18:37 +09:00 committed by Eugen Rochko
parent 73be8f38c1
commit c1c0f7c516
1 changed files with 3 additions and 3 deletions

View File

@ -181,8 +181,8 @@ class Account < ApplicationRecord
end end
def tags_as_strings=(tag_names) def tags_as_strings=(tag_names)
tag_names.map! { |name| name.mb_chars.downcase } tag_names.map! { |name| name.mb_chars.downcase.to_s }
tag_names.uniq!(&:to_s) tag_names.uniq!
# Existing hashtags # Existing hashtags
hashtags_map = Tag.where(name: tag_names).each_with_object({}) { |tag, h| h[tag.name] = tag } hashtags_map = Tag.where(name: tag_names).each_with_object({}) { |tag, h| h[tag.name] = tag }
@ -190,7 +190,7 @@ class Account < ApplicationRecord
# Initialize not yet existing hashtags # Initialize not yet existing hashtags
tag_names.each do |name| tag_names.each do |name|
next if hashtags_map.key?(name) next if hashtags_map.key?(name)
hashtags_map[name.downcase] = Tag.new(name: name) hashtags_map[name] = Tag.new(name: name)
end end
# Remove hashtags that are to be deleted # Remove hashtags that are to be deleted