Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fusion usager qui plante quand on choisit un usager sans annotation #5143

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

francois-ferrandis
Copy link
Contributor

@francois-ferrandis francois-ferrandis commented Mar 4, 2025

Issue Sentry :
https://sentry.incubateur.net/organizations/betagouv/issues/153726

Contexte

Dans #5121 nous avons oublié de tester un cas dans la fusion usager : quand l'un des usagers à fusionner a une remarque et l'autre non, et qu'on choisit de garder la remarque "vide" :

image

Solution

Tester tous les cas possibles, corriger le bug.

j'ai hésité entre

    if annotation_to_merge
      @user_target.annotate!(annotation_to_merge.content, territory: current_territory)
      annotation_to_merge.destroy!
    else
      @user_target.annotations.find_by(territory: current_territory).destroy!
    end

et

    @user_target.annotate!(annotation_to_merge&.content, territory: current_territory)
    annotation_to_merge&.destroy!

et j'ai fini par trouver le second plus compréhensible, car il montre mieux qu'on "copie" l'absence d'annotation d'un usager vers l'autre.

@francois-ferrandis francois-ferrandis self-assigned this Mar 4, 2025
@francois-ferrandis francois-ferrandis changed the title Bugfix: fusion usager qui plante quand on choisit un usager sans annotation [Bugfix] Fusion usager qui plante quand on choisit un usager sans annotation Mar 4, 2025
Copy link
Contributor

@victormours victormours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 excellent

@francois-ferrandis francois-ferrandis merged commit 5d228f6 into production Mar 4, 2025
15 checks passed
@francois-ferrandis francois-ferrandis deleted the frf/bugfix-merge-user-annotations branch March 4, 2025 14:33
Copy link

Sentry Issue: LAPINS-27Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants