posts: change "»" links next to sources in sidebar.

* On the posts show page, make the "»" link next to the source visible
  to all users, not just builders.
* Make "»" link to the raw unnormalized source, instead of a `source:` search.
* Remove the special case for displaying old pixiv sources as `pixiv/moniker`.
This commit is contained in:
evazion
2019-09-22 02:58:09 -05:00
parent 5f43401b7b
commit 8f6fd95e2d
3 changed files with 8 additions and 25 deletions

View File

@@ -80,9 +80,10 @@ module ApplicationHelper
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
end
def external_link_to(url, truncate: nil, strip_scheme: false, link_options: {})
def external_link_to(url, truncate: nil, strip: false, link_options: {})
text = url
text = text.gsub(%r!\Ahttps?://!i, "") if strip_scheme
text = text.gsub(%r!\Ahttps?://!i, "") if strip == :scheme
text = text.gsub(%r!\Ahttps?://(?:www\.)?!i, "") if strip == :subdomain
text = text.truncate(truncate) if truncate
if url =~ %r!\Ahttps?://!i