Skip to content

THREESCALE-12410: remove nil signup type - #4369

Open
jlledom wants to merge 3 commits into
masterfrom
THREESCALE-12410-remove-nil-signup-type
Open

THREESCALE-12410: remove nil signup type#4369
jlledom wants to merge 3 commits into
masterfrom
THREESCALE-12410-remove-nil-signup-type

Conversation

@jlledom

@jlledom jlledom commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

In the effort to simplify the signup types handling, the initial idea was to remove all signup types and find a way to determine the kind of user via other ways on each point the signup type is referenced.

I abandoned that idea for the moment, I think the result wouldn't necessarily simplify the code. Instead I've been removing/merging signup types to leave only those that makes sense, IMO.

This PR removes the nil signup type and merges it with the :new_signup type. All users that signed up via invitation will get the :new_signup type from now on.

The two types are pretty equivalent, the only place where an invited user diverges from what a self-signed-up does is during the signup process, on the user observer class.

The user observer adds an after commit callback that sends the signup notification:

Thank you for signing up for access to the {{ provider.name }} API, your account has been created.

Invited users must not receive this notification which makes no sense for them. This PR adds a guard to not send this notification for users having a not nil association to Invitation.

The PR also updates some tests. That should be it, everything else should behave the same as before.

For existing users in DB with signup type nil, no migration path is needed, because they already behave exactly as :new_signup users once the signup is completed.

After this PR, there will be only three signup types left:

  1. :new_signup: Users that signed up themselves, directly or via invitation.
  2. :minimal: Users created by db seed scripts.
  3. :created_by_provider: Users created by the provider, via API or UI.

There's an excpetion: the POST /admin/api/signup API endpoint also creates users as :minimal, but I didn't fix it to not break clients integrations.

This is a summary of the differences between them:

Signup Type Password Required Signup Email User Auto-Activated Account Auto-Approved
:new_signup yes yes* no no
:minimal no no yes** yes**
:created_by_provider no no no no

* Unless invited
** Only when approval_required? is false on the account plan AND the user has a password.

Which issue(s) this PR fixes

https://redhat.atlassian.net/browse/THREESCALE-12410

Verification steps

  1. Signup to the dev portal -> Should receive the signup type
  2. Invite a user for the dev -> Should not receive the signup email, but the invitation one
  3. Invite a user for the admin portal -> Should not receive the signup email, but the invitation one

jlledom added 2 commits August 7, 2026 10:14
Invited users previously received a nil signup_type because
Invitation#make_user never set one. This was an implicit convention
that relied on nil and :new_signup behaving identically everywhere
except the observer email gate.

This commit makes the type explicit by setting :new_signup in
make_user, and guards the observer email with !user.invitation so
invited users are not double-emailed (they already receive an
invitation email and are activated directly by the controller).

Part of THREESCALE-12410: simplifying signup types.

Assisted-by: Claude Code
Now that invited users are explicitly set to :new_signup, nil is no
longer a valid signup type in normal usage. Remove it from the
by_user? coverage test to keep the test accurate.

Assisted-by: Claude Code
@jlledom jlledom self-assigned this Aug 7, 2026
@qltysh

qltysh Bot commented Aug 7, 2026

Copy link
Copy Markdown

All good ✅

Comment thread app/observers/user_observer.rb Outdated
@jlledom jlledom changed the title Threescale 12410 remove nil signup type THREESCALE-12410: remove nil signup type Aug 7, 2026
RuboCop flagged the nested conditional as a style violation.
Convert to an early return for consistency with the existing
guard on line 7.

Assisted-by: Claude Code
@jlledom
jlledom marked this pull request as ready for review August 7, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant