mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: Get only the correct collapse title in emails (#10228)
Previously, this would get every details block title from the entire post, for every details block.
This commit is contained in:
parent
8ddd45d524
commit
919c87a9ce
2 changed files with 24 additions and 1 deletions
|
@ -41,6 +41,29 @@ describe PrettyText do
|
|||
expect(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' do
|
||||
md = PrettyText.cook(<<~EOF)
|
||||
<script>alert('hello')</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue