nat
(Natalie T)
Junho 14, 2023, 11:16am
10
Este é um bug divertido.
Devido à falha na mesclagem de votos, quando mesclamos Lancelot (id 383) → Galahad (id 120), Lancelot na verdade ainda existiria, mas sem um e-mail principal - /admin/users/383/lancelot retornaria um erro http 500 devido a uma verificação de anonimização.
De qualquer forma, temos uma correção a caminho. Estamos favorecendo a manutenção do voto de Galahad (o usuário de destino) neste caso de duplicatas.
main ← user-merger-email-empty
opened 10:09AM - 14 Jun 23 UTC
This is somewhat of an uncommon case where if a plugin fails to merge a user, th… e merge would fail but the `user_email` of the `source_user` would have been transferred to the `target_user`. This leaves the `source_user` without an email, and this bug would occur when admins try to access `/admin/users/<id>/<username>`.
This allows the admin to continue dealing with the user.
https://meta.discourse.org/t/error-merging-users-with-duplicate-poll-votes/154711
A consideration here would be to use a transaction (probably very costly), or reorder the order of events in `UserMerger.merge!`
main ← de-duplicate-poll-vote-user-merge
opened 11:14AM - 14 Jun 23 UTC
Currently when merging users, polls may error out if the source and target users… have both voted on the same poll before. 😢
There is currently 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
<img width="450" alt="Screenshot 2023-06-14 at 7 12 06 PM" src="https://github.com/discourse/discourse/assets/1555215/19d9ed06-2206-45f5-826f-e1c565f01bab">
Related: https://github.com/discourse/discourse/pull/22105
4 curtidas