use Sources::Site to look up artists by profile page
This commit is contained in:
@@ -309,11 +309,25 @@ class Artist < ActiveRecord::Base
|
||||
|
||||
if matches.any?
|
||||
where("id in (?)", matches)
|
||||
elsif matches = search_for_profile(string)
|
||||
where("id in (?)", matches)
|
||||
else
|
||||
where("false")
|
||||
end
|
||||
end
|
||||
|
||||
def search_for_profile(url)
|
||||
source = Sources::Site.new(url)
|
||||
if source.strategy
|
||||
source.get
|
||||
find_all_by_url(source.profile_url)
|
||||
else
|
||||
nil
|
||||
end
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def other_names_match(string)
|
||||
if string =~ /\*/ && CurrentUser.user.is_builder?
|
||||
where("other_names ILIKE ? ESCAPE E'\\\\'", string.to_escaped_for_sql_like)
|
||||
|
||||
Reference in New Issue
Block a user