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?
|
if matches.any?
|
||||||
where("id in (?)", matches)
|
where("id in (?)", matches)
|
||||||
|
elsif matches = search_for_profile(string)
|
||||||
|
where("id in (?)", matches)
|
||||||
else
|
else
|
||||||
where("false")
|
where("false")
|
||||||
end
|
end
|
||||||
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)
|
def other_names_match(string)
|
||||||
if string =~ /\*/ && CurrentUser.user.is_builder?
|
if string =~ /\*/ && CurrentUser.user.is_builder?
|
||||||
where("other_names ILIKE ? ESCAPE E'\\\\'", string.to_escaped_for_sql_like)
|
where("other_names ILIKE ? ESCAPE E'\\\\'", string.to_escaped_for_sql_like)
|
||||||
|
|||||||
Reference in New Issue
Block a user