discourse/plugins/poll
Natalie Tay fcaefc9f2f
FIX: De-duplicate poll vote on user merge (#22107)
When merging users, polls may error out if the source and target users have both voted on the same poll before. 😢 

There is no constraint on the `poll_votes` table either to support this. Ideally a composite primary key can be used `(poll_id, user_id)`, but alas there is no support yet, which is probably why it wasn't created in the first place.

This fix ensures that merging is successful by only keeping the target poll votes if duplicates exist.

This fix also runs a migration on older poll votes where failed merges would have caused a single user to have voted twice on a single poll. e.g. this weird edge case
2023-06-15 11:18:51 +08:00
..
app DEV: Apply syntax_tree formatting to `plugins/*` 2023-01-07 11:11:37 +00:00
assets UX: Vertical alignment issues on mobile (#21118) 2023-04-17 22:51:13 +05:30
config Update translations (#21583) 2023-05-16 19:40:01 +02:00
db FIX: De-duplicate poll vote on user merge (#22107) 2023-06-15 11:18:51 +08:00
jobs/regular DEV: Apply syntax_tree formatting to `plugins/*` 2023-01-07 11:11:37 +00:00
lib FIX: Ensure poll extraction is not attempted if post body is absent (#19718) 2023-01-13 01:47:44 +00:00
spec FIX: De-duplicate poll vote on user merge (#22107) 2023-06-15 11:18:51 +08:00
test/javascripts DEV: Load plugin CSS in tests (#18668) 2022-10-19 18:10:06 +01:00
plugin.rb FIX: De-duplicate poll vote on user merge (#22107) 2023-06-15 11:18:51 +08:00