nat
(Natalie T)
14 Giugno 2023, 11:16am
10
Questo è un bug divertente.
A causa della mancata corretta unione dei voti dei sondaggi, quando uniamo Lancelot (id 383) → Galahad (id 120), Lancelot esisterebbe ancora, ma non avrebbe un’email primaria - /admin/users/383/lancelot restituirebbe un errore http 500 a causa di un controllo di anonimizzazione.
Comunque abbiamo una soluzione in arrivo. In questo caso di duplicati, preferiamo mantenere il voto di Galahad (l’utente di destinazione).
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 Mi Piace