From ba826ff6fa264682bea5e315fc121e0200c5a20b Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Fri, 26 Feb 2021 19:45:01 +0100 Subject: [PATCH] Sources: get correct mastodon page url --- app/logical/sources/strategies/mastodon.rb | 4 ++-- test/unit/sources/mastodon_test.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/logical/sources/strategies/mastodon.rb b/app/logical/sources/strategies/mastodon.rb index 3fef4810e..5d353fd7a 100644 --- a/app/logical/sources/strategies/mastodon.rb +++ b/app/logical/sources/strategies/mastodon.rb @@ -85,7 +85,7 @@ module Sources::Strategies end def artist_name_from_url - url[NAMED_PROFILE, :artist_name] + urls.map { |url| url[NAMED_PROFILE, :artist_name] }.compact.first end def other_names @@ -93,7 +93,7 @@ module Sources::Strategies end def account_id - url[ID_PROFILE, :account_id] || api_response.account_id + urls.map { |url| url[ID_PROFILE, :account_id] }.compact.first || api_response.account_id end def status_id_from_url diff --git a/test/unit/sources/mastodon_test.rb b/test/unit/sources/mastodon_test.rb index 59d31d0f7..95a3f26ad 100644 --- a/test/unit/sources/mastodon_test.rb +++ b/test/unit/sources/mastodon_test.rb @@ -95,6 +95,10 @@ module Sources should "fetch the source data" do assert_equal("evazion", @site.artist_name) end + + should "correctly get the page url" do + assert_equal(@ref, @site.page_url) + end end context "A baraag url" do