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

Initialize transient fields with empty HashMap instead of null #9030

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

janvanmansum
Copy link
Contributor

What this PR does / why we need it:
It resolves a bug in the ShowMuteOptions feature.

Which issue(s) this PR closes:

Closes #9029

Special notes for your reviewer:
It seems edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser#postLoad is not executed in the scenario described in the issue (user was just created by a first federated login).

Suggestions on how to test this:

  1. Log in with an IdP that you haven't used with the Dataverse instance before.
  2. Create an account
  3. Navigate to "Account Settings"

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No

Is there a release notes update needed for this change?:
No

Additional documentation:
N/a

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0008%) to 19.881% when pulling d8c3f6a on DANS-KNAW:9029 into 9686ab8 on IQSS:develop.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

@ErykKul
Copy link
Collaborator

ErykKul commented Oct 7, 2022

Hi. Both fixes have exactly the same effect: assigning empty hash sets i.s.o. null to these fields. However, #8969 is more defensive, as it ensures that newly created users are initialized exactly the same way as the users loaded from the DB. If anything changed in the future, both ways of initialization of the users (the only ones that I am aware of) reuse the same code to ensure a consistent state of the AuthenticateUser object. This decreases the chance of breaking the code in the future.

@janvanmansum
Copy link
Contributor Author

The only advantage of #9030 I could point out is that postLoad does not have to become public. Either solution is fine with me though.

@mreekie
Copy link

mreekie commented Oct 12, 2022

This one will be resolved by #8969 and can be closed

@pdurbin pdurbin moved this from This Sprint 🏃‍♀️ to Review 🔎 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Oct 13, 2022
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Review 🔎 to QA ✅ Oct 28, 2022
@sekmiller sekmiller removed their assignment Oct 28, 2022
@scolapasta scolapasta merged commit 29fe94b into IQSS:develop Oct 31, 2022
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA ✅ to Done 🚀 Oct 31, 2022
@pdurbin pdurbin added this to the 5.12.1 milestone Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
7 participants