From 073f63cfa7c047ecca310cfaca858639d6a0c35f Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Tue, 16 Mar 2021 02:43:02 +0100 Subject: [PATCH] Pixiv: don't add auto-generated usernames to the other names field --- app/logical/sources/strategies/pixiv.rb | 4 +++- test/unit/sources/pixiv_test.rb | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/logical/sources/strategies/pixiv.rb b/app/logical/sources/strategies/pixiv.rb index ad961ba11..3f89ec70f 100644 --- a/app/logical/sources/strategies/pixiv.rb +++ b/app/logical/sources/strategies/pixiv.rb @@ -162,7 +162,9 @@ module Sources end def other_names - [artist_name, moniker].compact.uniq + other_names = [artist_name] + other_names << moniker unless moniker&.starts_with?("user_") + other_names.compact.uniq end def artist_commentary_title diff --git a/test/unit/sources/pixiv_test.rb b/test/unit/sources/pixiv_test.rb index 8a58a9cc9..e10f2c5e5 100644 --- a/test/unit/sources/pixiv_test.rb +++ b/test/unit/sources/pixiv_test.rb @@ -303,6 +303,11 @@ module Sources assert_includes(source.profile_urls, "https://www.pixiv.net/users/696859") assert_includes(source.profile_urls, "https://www.pixiv.net/stacc/uroobnad") end + + should "not add pixiv-generated 'user_' usernames to the other names field" do + source = get_source("https://www.pixiv.net/en/artworks/88487025") + assert_equal(["éé"], source.other_names) + end end context "parsing illust ids" do