Commit a6f11610 authored by evazion's avatar evazion

artists/summary: remove list of top source domains.

Remove the list of most-used source domains from artist summaries. This
took up a lot of space and usually wasn't very useful. It was also slow.
We had to calculate this on every artist tag search so we could display
it in the Artist tab, even though usually the user didn't open the tab.
parent 3ef4d9c7
......@@ -170,10 +170,6 @@ class Artist < ApplicationRecord
end
end
included do
memoize :domains
end
def sorted_urls
urls.sort {|a, b| a.priority <=> b.priority}
end
......@@ -200,31 +196,6 @@ class Artist < ApplicationRecord
def clear_url_string_changed
self.url_string_changed = false
end
def map_domain(x)
case x
when "pximg.net"
"pixiv.net"
when "deviantart.net"
"deviantart.com"
else
x
end
end
def domains
Cache.get("artist-domains-#{id}", 1.day) do
domains = Post.raw_tag_match(name).pluck(:source).map do |x|
map_domain(Addressable::URI.parse(x).domain)
rescue Addressable::URI::InvalidURIError
nil
end
domains.compact.inject(Hash.new(0)) {|h, x| h[x] += 1; h}.sort {|a, b| b[1] <=> a[1]}
end
end
end
module NameMethods
......
......@@ -24,14 +24,6 @@
<% end %>
</li>
<% end %>
<% if artist.domains.any? %>
<li><strong>Domains</strong></li>
<ul class="list-bulleted">
<% artist.domains.each do |url, count| %>
<li><%= url %>: <%= count %></li>
<% end %>
</ul>
<% end %>
<% if artist.urls.present? %>
<li><strong>URLs</strong></li>
<ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment