discourse/plugins/poll/spec
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
..
controllers DEV: Correct typos and spelling mistakes (#12812) 2021-05-21 11:43:47 +10:00
db/post_migrate DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
integration DEV: Use `response.parsed_body` in specs (#9615) 2020-05-07 17:04:12 +02:00
jobs/regular DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
lib FIX: Generate unique HTML heading names (#12705) 2021-04-16 10:54:19 +03:00
models FIX: no error when double save post with poll (#13111) 2021-05-27 08:39:51 +10:00
requests DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
serializers FIX: hides votes from regular users when poll is staff only (#11342) 2020-11-24 22:19:06 +01:00