From fa8f94d273ccf667a79c21d9ce2398500780f53d Mon Sep 17 00:00:00 2001 From: vagrant Date: Mon, 8 Feb 2016 15:24:12 +0000 Subject: [PATCH] proposed fix for comment bug (adds erroneous nofollow property, currently breaking links) --- lib/cfm.rb | 3 +++ spec/helpers/protips_helper_spec.rb | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/cfm.rb b/lib/cfm.rb index ca386798..6ca133ca 100644 --- a/lib/cfm.rb +++ b/lib/cfm.rb @@ -26,6 +26,9 @@ def render(text) def add_nofollow( html) #redcarpet isn't adding nofollow like it is suppose to. + if html.match(/rel=["']nofollow["']/) + return html + end html.scan(/(\.*?\<\/a\>)/).flatten.each do |link| if link.match(/\(.*?)\<\/a\>/) else diff --git a/spec/helpers/protips_helper_spec.rb b/spec/helpers/protips_helper_spec.rb index 1bf85191..97a1620e 100644 --- a/spec/helpers/protips_helper_spec.rb +++ b/spec/helpers/protips_helper_spec.rb @@ -40,6 +40,16 @@ expect(helper.users_background_image).to be_nil end end + + describe "comments" do + context "has comments" do + it "renders comment links correctly" do + expect(formatted_comment("http://www.google.com")).to eq "

http://www.google.com

\n" + end + end + end + + end end