users: Change type of enable_marketing_emails parameter in create_user.

This commit changes the type of enable_marketing_emails parameter of
create_user to Optional[bool].
The value of this parameter will be None in certain cases when user
registers through SSO and 'TERMS_OF_SERVICE=False' when there will
be no registration form and thus no value of enable_marketing_emails.
This commit is contained in:
Sahil Batra 2021-09-03 22:06:16 +05:30 committed by Tim Abbott
parent 03a0cfda64
commit 97f41b5abd
1 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ def create_user(
default_all_public_streams: Optional[bool] = None,
source_profile: Optional[UserProfile] = None,
force_id: Optional[int] = None,
enable_marketing_emails: bool = True,
enable_marketing_emails: Optional[bool] = None,
) -> UserProfile:
user_profile = create_user_profile(
realm,
@ -160,7 +160,7 @@ def create_user(
else:
user_profile.save()
if bot_type is None:
if bot_type is None and enable_marketing_emails is not None:
user_profile.enable_marketing_emails = enable_marketing_emails
user_profile.save(update_fields=["enable_marketing_emails"])