Refactor source normalization
* Move the source normalization logic out of the post model and into individual sources' strategies. * Rewrite normalization tests to be handled into each source's test, and expand them significantly. Previously we were only testing a very small subset of domains and variants. * Fix up normalization for several sites. * Normalize fav.me urls into normal deviantart urls.
This commit is contained in:
@@ -177,6 +177,12 @@ module Sources
|
||||
profile_url.presence || url
|
||||
end
|
||||
|
||||
# Given a post/image url, this is the normalized url that will be displayed in a post's page in its stead.
|
||||
# This function should never make any network call, even indirectly. Return nil to never normalize.
|
||||
def normalize_for_source
|
||||
nil
|
||||
end
|
||||
|
||||
def artists
|
||||
ArtistFinder.find_artists(normalize_for_artist_finder.to_s)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user