discourse/plugins/poll/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
..
poll DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
poll.rb FIX: Extract polls correctly when post contains multiple quotes (#36802) 2025-12-19 15:44:41 +01:00
polls_updater.rb
polls_validator.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
post_extension.rb
post_validator.rb
ranked_choice.rb
user_extension.rb