A platform for community discussion. Free, open, simple.
FIX: Get only the correct collapse title in emails (#10228)
Kane York919c87a9ce3c
diff --git a/plugins/discourse-details/plugin.rb b/plugins/discourse-details/plugin.rbindex 63c11d86472..4d8a9b7180a 100644--- a/plugins/discourse-details/plugin.rb+++ b/plugins/discourse-details/plugin.rb@@ -33,7 +33,7 @@ after_initialize doon(:reduce_cooked) do |fragment, post|fragment.css("details").each do |el|- text = fragment.css("summary").text+ text = el.css("summary").textlink = fragment.document.create_element("a")link["href"] = post.url if postlink.content = I18n.t("details.excerpt_details")diff --git a/plugins/discourse-details/spec/components/pretty_text_spec.rb b/plugins/discourse-details/spec/components/pretty_text_spec.rbindex dd0cf14a722..c208b762913 100644--- a/plugins/discourse-details/spec/components/pretty_text_spec.rb+++ b/plugins/discourse-details/spec/components/pretty_text_spec.rb@@ -41,6 +41,29 @@ describe PrettyText doexpect(md).to eq(html)end+ it 'properly handles multiple spoiler blocks in a post' do+ md = PrettyText.cook(<<~EOF)+ [details="First"]+ body secret stuff very long+ [/details]+ [details="Second"]+ body secret stuff very long+ [/details]++ Hey there.++ [details="Third"]+ body secret stuff very long+ [/details]+ EOF++ md = PrettyText.format_for_email(md, post)+ expect(md).not_to include('secret stuff')+ expect(md.scan(/First/).size).to eq(1)+ expect(md.scan(/Third/).size).to eq(1)+ expect(md.scan(I18n.t('details.excerpt_details')).size).to eq(3)+ end+it 'escapes summary text' domd = PrettyText.cook(<<~EOF)<script>alert('hello')</script>