mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
FIX: Spoiler logic should live inside of spoiler plugin
This commit removes logic about spoilers because it should live inside of the discourse-spoiler-alert plugin. This PR: https://github.com/discourse/discourse-spoiler-alert/pull/38 also completely removes spoilers from excerpts in order to keep them from leaking in topic previews and notifications.
This commit is contained in:
parent
db4ae50928
commit
9207c370d9
|
@ -123,11 +123,6 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
@current_length = 0
|
||||
@start_excerpt = true
|
||||
end
|
||||
# Preserve spoilers
|
||||
if attributes.include?(["class", "spoiler"])
|
||||
include_tag("span", attributes)
|
||||
@in_spoiler = true
|
||||
end
|
||||
|
||||
when "details"
|
||||
@detail_contents = +"" if @in_details_depth == 0
|
||||
|
|
|
@ -589,11 +589,6 @@ describe PrettyText do
|
|||
expect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>", 100, markdown_images: true)).to eq("![car](http://cnn.com/a.gif)")
|
||||
end
|
||||
|
||||
it "should keep spoilers" do
|
||||
expect(PrettyText.excerpt("<div class='spoiler'><img src='http://cnn.com/a.gif'></div>", 100)).to match_html "<span class='spoiler'>[image]</span>"
|
||||
expect(PrettyText.excerpt("<span class='spoiler'>spoiler</div>", 100)).to match_html "<span class='spoiler'>spoiler</span>"
|
||||
end
|
||||
|
||||
it "should keep details if too long" do
|
||||
expect(PrettyText.excerpt("<details><summary>expand</summary><p>hello</p></details>", 6)).to match_html "<details class='disabled'><summary>expand</summary></details>"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user