mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:22:36 +08:00
fcaefc9f2f
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
|
||
---|---|---|
.. | ||
controllers | ||
fabricators | ||
integration | ||
jobs/regular | ||
lib | ||
models | ||
requests | ||
serializers |