Skip to content

Commit

Permalink
create_user: Remove assert about needing prereg_user if realm_creation.
Browse files Browse the repository at this point in the history
Closes zulip#22274.

This assertion was added in 4b903c5
where it may have made sense, because indeed when doing realm creation
there was always a PreregistrationUser (created because realms were
created via going to a generated realm creation link). With the addition
of the create_realm command that's no longer the case.

It would be unnatural to create a PreregistrationUser in the
realm_creation command, because there is no confirmation link for it to
be tied to - and it just doesn't make sense conceptually.

The intended, correct behavior added in
4b903c5 is still maintained - the code
lower down correctly handles the
(prereg_user is None and realm_creation) case.
  • Loading branch information
mateuszmandera authored and timabbott committed Jul 18, 2022
1 parent 7ae3708 commit 6b451ce
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions zerver/actions/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ def process_new_human_user(

# Revoke all preregistration users except prereg_user, and link prereg_user to
# the created user
if prereg_user is None:
assert not realm_creation, "realm_creation should only happen with a PreregistrationUser"

if prereg_user is not None:
prereg_user.status = confirmation_settings.STATUS_ACTIVE
Expand Down

0 comments on commit 6b451ce

Please sign in to comment.