mirror of
https://github.com/makeplane/plane.git
synced 2026-02-04 05:00:42 -06:00
migration: back migrate all product tour fields to set true (#8575)
This commit is contained in:
@@ -4,6 +4,15 @@ from django.db import migrations, models
|
||||
import plane.db.models.workspace
|
||||
|
||||
|
||||
def set_default_product_tour_to_false():
|
||||
return {
|
||||
"work_items": False,
|
||||
"cycles": False,
|
||||
"modules": False,
|
||||
"intake": False,
|
||||
"pages": False,
|
||||
}
|
||||
|
||||
def get_default_product_tour():
|
||||
return {
|
||||
"work_items": True,
|
||||
@@ -41,7 +50,7 @@ class Migration(migrations.Migration):
|
||||
migrations.AddField(
|
||||
model_name='workspaceuserproperties',
|
||||
name='product_tour',
|
||||
field=models.JSONField(default=plane.db.models.workspace.get_default_product_tour),
|
||||
field=models.JSONField(default=set_default_product_tour_to_false),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='apitoken',
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# Generated by Django 4.2.27 on 2026-01-23 09:27
|
||||
|
||||
from django.db import migrations, models
|
||||
import plane.db.models.user
|
||||
|
||||
def set_getting_started_checklist():
|
||||
return {
|
||||
"project_created": True,
|
||||
"project_joined": True,
|
||||
"work_item_created": True,
|
||||
"team_members_invited": True,
|
||||
"page_created": True,
|
||||
"ai_chat_tried": True,
|
||||
"integration_linked": True,
|
||||
"view_created": True,
|
||||
"sticky_created": True,
|
||||
}
|
||||
|
||||
def set_default_tips():
|
||||
return {"mobile_app_download": True}
|
||||
|
||||
|
||||
def set_default_explored_features():
|
||||
return {"github_integrated": True, "slack_integrated": True, "ai_chat_tried": True}
|
||||
|
||||
|
||||
def set_default_product_tour():
|
||||
return {
|
||||
"work_items": True,
|
||||
"cycles": True,
|
||||
"modules": True,
|
||||
"intake": True,
|
||||
"pages": True,
|
||||
}
|
||||
|
||||
|
||||
def migrate_all_the_product_tour_to_true(apps, _schema_editor):
|
||||
Profile = apps.get_model('db', 'Profile')
|
||||
WorkspaceMember = apps.get_model('db', 'WorkspaceMember')
|
||||
|
||||
default_checklist_values = set_getting_started_checklist()
|
||||
default_tips_values = set_default_tips()
|
||||
default_explored_features = set_default_explored_features()
|
||||
default_product_tour = set_default_product_tour()
|
||||
|
||||
Profile.objects.all().update(is_navigation_tour_completed=True)
|
||||
WorkspaceMember.objects.all().update(getting_started_checklist=default_checklist_values)
|
||||
WorkspaceMember.objects.all().update(tips=default_tips_values)
|
||||
WorkspaceMember.objects.all().update(explored_features=default_explored_features)
|
||||
Profile.objects.all().update(product_tour=default_product_tour)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('db', '0117_rename_description_draftissue_description_json_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='workspaceuserproperties',
|
||||
name='product_tour',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='profile',
|
||||
name='product_tour',
|
||||
field=models.JSONField(default=plane.db.models.user.get_default_product_tour),
|
||||
),
|
||||
migrations.RunPython(migrate_all_the_product_tour_to_true, reverse_code=migrations.RunPython.noop)
|
||||
|
||||
]
|
||||
@@ -35,6 +35,16 @@ def get_mobile_default_onboarding():
|
||||
}
|
||||
|
||||
|
||||
def get_default_product_tour():
|
||||
return {
|
||||
"work_items": False,
|
||||
"cycles": False,
|
||||
"modules": False,
|
||||
"intake": False,
|
||||
"pages": False,
|
||||
}
|
||||
|
||||
|
||||
class BotTypeEnum(models.TextChoices):
|
||||
WORKSPACE_SEED = "WORKSPACE_SEED", "Workspace Seed"
|
||||
|
||||
@@ -245,6 +255,7 @@ class Profile(TimeAuditModel):
|
||||
# marketing
|
||||
has_marketing_email_consent = models.BooleanField(default=False)
|
||||
is_subscribed_to_changelog = models.BooleanField(default=False)
|
||||
product_tour = models.JSONField(default=get_default_product_tour)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Profile"
|
||||
|
||||
@@ -112,16 +112,6 @@ def slug_validator(value):
|
||||
raise ValidationError("Slug is not valid")
|
||||
|
||||
|
||||
def get_default_product_tour():
|
||||
return {
|
||||
"work_items": False,
|
||||
"cycles": False,
|
||||
"modules": False,
|
||||
"intake": False,
|
||||
"pages": False,
|
||||
}
|
||||
|
||||
|
||||
class Workspace(BaseModel):
|
||||
TIMEZONE_CHOICES = tuple(zip(pytz.common_timezones, pytz.common_timezones))
|
||||
|
||||
@@ -338,7 +328,6 @@ class WorkspaceUserProperties(BaseModel):
|
||||
choices=NavigationControlPreference.choices,
|
||||
default=NavigationControlPreference.ACCORDION,
|
||||
)
|
||||
product_tour = models.JSONField(default=get_default_product_tour)
|
||||
|
||||
class Meta:
|
||||
unique_together = ["workspace", "user", "deleted_at"]
|
||||
|
||||
Reference in New Issue
Block a user