diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 12cd1a2eb..d1ed21abf 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -42,12 +42,12 @@ module PostsHelper verifier.generate("#{value},#{session[:session_id]}") end - def post_source_tag(post) + def post_source_tag(source, normalized_source = source) # Only allow http:// and https:// links. Disallow javascript: links. - if post.source =~ %r!\Ahttps?://!i - external_link_to(post.normalized_source, strip: :subdomain) + " ".html_safe + link_to("»", post.source, rel: "external noreferrer nofollow") + if source =~ %r!\Ahttps?://!i + external_link_to(normalized_source, strip: :subdomain) + " ".html_safe + link_to("»", source, rel: "external noreferrer nofollow") else - post.source + source end end diff --git a/app/views/modqueue/_post.html.erb b/app/views/modqueue/_post.html.erb index ed3c5321d..dfa6d9865 100644 --- a/app/views/modqueue/_post.html.erb +++ b/app/views/modqueue/_post.html.erb @@ -40,7 +40,7 @@
Source - <%= post_source_tag(post) %> + <%= post_source_tag(post.source, post.normalized_source) %>
diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb index ffcf92c6d..f8ff320de 100644 --- a/app/views/post_versions/_listing.html.erb +++ b/app/views/post_versions/_listing.html.erb @@ -24,7 +24,7 @@
Tags: <%= TagSetPresenter.new(post_version.tag_array).inline_tag_list_html %>
- <%= post_version_field(post_version, :source) %> + <%= post_source_tag(post_version.source) %>
<% end %> <% t.column "Edits", td: {class: "col-expand"}, width: "40%" do |post_version| %> diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index a9407ed19..d96af09c4 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -22,7 +22,7 @@ (<%= post.image_width %>x<%= post.image_height %>) <% end %> -
  • Source: <%= post_source_tag(post) %>
  • +
  • Source: <%= post_source_tag(post.source, post.normalized_source) %>
  • Rating: <%= post.pretty_rating %>
  • Score: <%= post.score %> <% if policy(PostVote).create? %>