From 54365ecc7aefede64f73fa36acd651336ffa095f Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 17 Jun 2015 17:23:16 -0400 Subject: Remove overridden `link_to` helper The purpose for this override is now handled by `ExternalLinkFilter`. --- app/helpers/application_helper.rb | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 10d7aa11209..5627aba00fb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -214,39 +214,6 @@ module ApplicationHelper Gitlab::MarkupHelper.asciidoc?(filename) end - # Overrides ActionView::Helpers::UrlHelper#link_to to add `rel="nofollow"` to - # external links - def link_to(name = nil, options = nil, html_options = {}) - if options.kind_of?(String) - if !options.start_with?('#', '/') - html_options = add_nofollow(options, html_options) - end - end - - super - end - - # Add `"rel=nofollow"` to external links - # - # link - String link to check - # html_options - Hash of `html_options` passed to `link_to` - # - # Returns `html_options`, adding `rel: nofollow` for external links - def add_nofollow(link, html_options = {}) - begin - uri = URI(link) - - if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host - rel = html_options.fetch(:rel, '') - html_options[:rel] = (rel + ' nofollow').strip - end - rescue URI::Error - # noop - end - - html_options - end - def promo_host 'about.gitlab.com' end -- cgit v1.2.3