Merge pull request #4673 from BrokenEagle/fix-new-twitter-artist
Add the Twitter name to the list of other names for new artists
This commit is contained in:
@@ -50,7 +50,7 @@ module Sources::Strategies
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.artist_name_from_url(url)
|
def self.tag_name_from_url(url)
|
||||||
if url =~ PROFILE && !$~[:username].in?(RESERVED_USERNAMES)
|
if url =~ PROFILE && !$~[:username].in?(RESERVED_USERNAMES)
|
||||||
$~[:username]
|
$~[:username]
|
||||||
else
|
else
|
||||||
@@ -100,13 +100,13 @@ module Sources::Strategies
|
|||||||
end
|
end
|
||||||
|
|
||||||
def page_url
|
def page_url
|
||||||
return nil if status_id.blank? || artist_name.blank?
|
return nil if status_id.blank? || tag_name.blank?
|
||||||
"https://twitter.com/#{artist_name}/status/#{status_id}"
|
"https://twitter.com/#{tag_name}/status/#{status_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def profile_url
|
def profile_url
|
||||||
return nil if artist_name.blank?
|
return nil if tag_name.blank?
|
||||||
"https://twitter.com/#{artist_name}"
|
"https://twitter.com/#{tag_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def intent_url
|
def intent_url
|
||||||
@@ -119,9 +119,9 @@ module Sources::Strategies
|
|||||||
[profile_url, intent_url].compact
|
[profile_url, intent_url].compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_name
|
def tag_name
|
||||||
if artist_name_from_url.present?
|
if tag_name_from_url.present?
|
||||||
artist_name_from_url
|
tag_name_from_url
|
||||||
elsif api_response.present?
|
elsif api_response.present?
|
||||||
api_response.dig(:user, :screen_name)
|
api_response.dig(:user, :screen_name)
|
||||||
else
|
else
|
||||||
@@ -129,6 +129,14 @@ module Sources::Strategies
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def artist_name
|
||||||
|
if api_response.present?
|
||||||
|
api_response.dig(:user, :name)
|
||||||
|
else
|
||||||
|
tag_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def artist_commentary_title
|
def artist_commentary_title
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
@@ -208,8 +216,8 @@ module Sources::Strategies
|
|||||||
[url, referer_url].map {|x| self.class.status_id_from_url(x)}.compact.first
|
[url, referer_url].map {|x| self.class.status_id_from_url(x)}.compact.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_name_from_url
|
def tag_name_from_url
|
||||||
[url, referer_url].map {|x| self.class.artist_name_from_url(x)}.compact.first
|
[url, referer_url].map {|x| self.class.tag_name_from_url(x)}.compact.first
|
||||||
end
|
end
|
||||||
|
|
||||||
memoize :api_response
|
memoize :api_response
|
||||||
|
|||||||
Reference in New Issue
Block a user