Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
REVERT: FIX: handle clicks counters in quotes
Not quite a full revert of 7696b92 that isn't
actually required.
  • Loading branch information
ZogStriP committed Jun 4, 2019
1 parent fcb7422 commit 9756e35
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
7 changes: 1 addition & 6 deletions lib/cooked_post_processor.rb
Expand Up @@ -97,12 +97,7 @@ def remove_full_quote_on_direct_reply

return if previous.blank?

# remove click counters
previous_doc = Nokogiri::HTML::fragment(previous)
previous_doc.css("span.clicks").remove

previous_text = previous_doc.text.strip

previous_text = Nokogiri::HTML::fragment(previous).text.strip
quoted_text = @doc.css("aside.quote:first-child blockquote").first&.text&.strip || ""

return if previous_text.gsub(/(\s){2,}/, '\1') != quoted_text.gsub(/(\s){2,}/, '\1')
Expand Down
17 changes: 0 additions & 17 deletions spec/components/cooked_post_processor_spec.rb
Expand Up @@ -1368,23 +1368,6 @@
expect(reply.raw).to eq("and this is the third reply")
end

it "works with click counters" do
post = Fabricate(:post,
topic: topic,
raw: "[Discourse](https://www.discourse.org) is amazing!",
cooked: %{<p><a href="https://www.discourse.org">Discourse <span class="badge badge-notification clicks" title="1 click">1</span></a> is amazing!</p>}
)

reply = Fabricate(:post,
topic: topic,
raw: "[quote]\n[Discourse](https://www.discourse.org) is amazing!\n[/quote]\nIt sure is :+1:"
)

CookedPostProcessor.new(reply).remove_full_quote_on_direct_reply

expect(reply.raw).to eq("It sure is :+1:")
end

end

end

0 comments on commit 9756e35

Please sign in to comment.