Files
discourse/plugins/poll/spec/lib
Régis Hanol a1a59b7ca6 FIX: Extract polls correctly when post contains multiple quotes (#36802)
Previously, poll extraction used a greedy regex to strip quotes from raw
content before parsing:

    raw = raw.sub(/\[quote.+\/quote\]/m, '')

This matched from the first `[quote` to the LAST `[/quote]`,
accidentally removing everything in between - including the actual poll
- when a post contained multiple quotes. This bug has existed since the
quote-stripping was introduced in April 2022 (461936f2).

Instead of manipulating raw content with regex, we now filter polls at
the Nokogiri level by excluding any inside a blockquote:

    .reject { |p| p.ancestors("blockquote").any? }

This approach is more robust, handles edge cases like nested quotes and
malformed markup, and matches what the frontend JS already does.
2025-12-19 15:44:41 +01:00
..