Skip to content

Move account creation to UserStore#4695

Merged
pcapriotti merged 7 commits intodevelopfrom
create-user
Aug 6, 2025
Merged

Move account creation to UserStore#4695
pcapriotti merged 7 commits intodevelopfrom
create-user

Conversation

@pcapriotti
Copy link
Contributor

@pcapriotti pcapriotti commented Jul 31, 2025

https://wearezeta.atlassian.net/browse/WPB-18186

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jul 31, 2025
@pcapriotti pcapriotti marked this pull request as ready for review August 5, 2025 11:44
@pcapriotti pcapriotti requested review from a team as code owners August 5, 2025 11:44
@pcapriotti
Copy link
Contributor Author

@akshaymankar and I looked at the question of why the invariant on the identity field (mentioned here) doesn't actually seem to be preserved.

The issue is that a user is always created in a non-activated state, then, if the email activation code was provided in the request, it is activated afterwards. The user record always has email_unvalidated set to null, and email identity set to the actual email, regardless of the activation state, and the returned user object reflects that. This is close to ok for user created with an activation code, but definitely wrong for non-activated users, since it does not match what the user looks like when queried separately.

The plan is to leave this PR as is, since it is a pure refactoring that doesn't change the current behaviour. In a separate PR, we plan to change the API as follows:

  • get rid of the non-activated case of user creation (clients can request an email activation code separately, then register)
  • always set email_unvalidated
    Since email_unvalidated is a field in the returned JSON object, and was set to Nothing before, we need to restrict this change to the current version of the API in order to maintain compatibility.

@pcapriotti pcapriotti merged commit 6c290e8 into develop Aug 6, 2025
8 checks passed
@pcapriotti pcapriotti deleted the create-user branch August 6, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants