forked from e621ng/e621ng
artists: filter out duplicates from other names (#4028).
This commit is contained in:
parent
0dd44e64a4
commit
286bf2f285
@ -242,7 +242,8 @@ class Artist < ApplicationRecord
|
||||
end
|
||||
|
||||
def normalize_other_names
|
||||
self.other_names = other_names.map { |x| Artist.normalize_name(x) }
|
||||
self.other_names = other_names.map { |x| Artist.normalize_name(x) }.uniq
|
||||
self.other_names -= [name]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -407,7 +407,7 @@ class ArtistTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "normalize its other names" do
|
||||
artist = FactoryBot.create(:artist, :name => "a1", :other_names => "aaa bbb ccc_ddd")
|
||||
artist = FactoryBot.create(:artist, name: "a1", other_names: "a1 aaa aaa AAA bbb ccc_ddd")
|
||||
assert_equal("aaa bbb ccc_ddd", artist.other_names_string)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user