From 1ce7c11705b6b1c0883ba96194e6384780fc1d7b Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Wed, 29 May 2024 18:08:50 +0530 Subject: [PATCH] user_profile: Remove 'onboarding_steps' field. Removes the 'onboarding_steps' field on 'UserProfile' model which is no longer used. It was introduced back in 2013 (b5e22bf), and is no longer used. Fixes part of #30043. --- zerver/lib/create_user.py | 2 -- zerver/lib/onboarding_steps.py | 7 +++---- .../0524_remove_userprofile_onboarding_steps.py | 16 ++++++++++++++++ zerver/models/users.py | 6 ------ 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 zerver/migrations/0524_remove_userprofile_onboarding_steps.py diff --git a/zerver/lib/create_user.py b/zerver/lib/create_user.py index e92c50a216..dccece254d 100644 --- a/zerver/lib/create_user.py +++ b/zerver/lib/create_user.py @@ -2,7 +2,6 @@ from datetime import datetime from email.headerregistry import Address from typing import Optional, Union -import orjson from django.contrib.auth.models import UserManager from django.utils.timezone import now as timezone_now @@ -125,7 +124,6 @@ def create_user_profile( tos_version=tos_version, timezone=timezone, tutorial_status=tutorial_status, - onboarding_steps=orjson.dumps([]).decode(), default_language=default_language, delivery_email=email, email_address_visibility=email_address_visibility, diff --git a/zerver/lib/onboarding_steps.py b/zerver/lib/onboarding_steps.py index df749a209b..8c3300d074 100644 --- a/zerver/lib/onboarding_steps.py +++ b/zerver/lib/onboarding_steps.py @@ -69,8 +69,7 @@ def copy_onboarding_steps(source_profile: UserProfile, target_profile: UserProfi timestamp=onboarding_step.timestamp, ) - # TODO: The 'tutorial_status' and 'onboarding_steps' fields - # of 'UserProfile' model are no longer used. Remove them. + # TODO: The 'tutorial_status' field of 'UserProfile' model + # is no longer used. Remove it. target_profile.tutorial_status = source_profile.tutorial_status - target_profile.onboarding_steps = source_profile.onboarding_steps - target_profile.save(update_fields=["tutorial_status", "onboarding_steps"]) + target_profile.save(update_fields=["tutorial_status"]) diff --git a/zerver/migrations/0524_remove_userprofile_onboarding_steps.py b/zerver/migrations/0524_remove_userprofile_onboarding_steps.py new file mode 100644 index 0000000000..a8ef434040 --- /dev/null +++ b/zerver/migrations/0524_remove_userprofile_onboarding_steps.py @@ -0,0 +1,16 @@ +# Generated by Django 5.0.6 on 2024-05-29 12:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("zerver", "0523_alter_multiuseinvite_subscribe_to_default_streams_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="userprofile", + name="onboarding_steps", + ), + ] diff --git a/zerver/models/users.py b/zerver/models/users.py index e68d52d973..e27ff36571 100644 --- a/zerver/models/users.py +++ b/zerver/models/users.py @@ -576,12 +576,6 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings): default=TUTORIAL_WAITING, choices=TUTORIAL_STATES, max_length=1 ) - # Contains serialized JSON of the form: - # [("step 1", true), ("step 2", false)] - # where the second element of each tuple is if the step has been - # completed. - onboarding_steps = models.TextField(default="[]") - zoom_token = models.JSONField(default=None, null=True) objects = UserManager()