discourse/plugins/poll
Krzysztof Kotlarek 942b9126a1
FIX: no error when double save post with poll (#13111)
Some plugins hook into Post after save to set custom fields and save again.

For example: https://github.com/discourse/discourse-category-experts/blob/main/lib/category_experts/post_handler.rb#L27

Problem is that in case like that `raw_changed?` is false but all callback are triggered. `extracted_polls` is class atribute therefore that should be reset with each attempt.

That was causing an error:
```
#<ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint 
"index_polls_on_post_id_and_name" DETAIL:  Key (post_id, name)=(8967, poll) already exists.
```
2021-05-27 08:39:51 +10:00
..
app DEV: Remove with_deleted workarounds for old Rails version (#11550) 2020-12-22 10:38:59 +11:00
assets FIX: Make poll options tabbable (#13159) 2021-05-26 20:45:10 +03:00
config Update translations (#13136) 2021-05-25 15:29:11 +02:00
db FEATURE: Add the title attribute to polls (#10759) 2020-10-02 09:21:24 +02:00
jobs/regular DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
lib FEATURE: Add the title attribute to polls (#10759) 2020-10-02 09:21:24 +02:00
spec FIX: no error when double save post with poll (#13111) 2021-05-27 08:39:51 +10:00
test/javascripts UX: Improve poll builder UI (#12549) 2021-04-12 19:48:01 +03:00
plugin.rb FIX: no error when double save post with poll (#13111) 2021-05-27 08:39:51 +10:00