Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

left-sidebar: Show starred message counts by default.

m-e-l-u-h-a-n201dd7507f58
diff --git a/zerver/migrations/0323_show_starred_message_counts.py b/zerver/migrations/0323_show_starred_message_counts.py
new file mode 100644
index 00000000000..b5788cad6a4
--- /dev/null
+++ b/zerver/migrations/0323_show_starred_message_counts.py
@@ -0,0 +1,32 @@
+# Generated by Django 3.1.8 on 2021-05-01 12:34
+
+from django.db import migrations, models
+from django.db.backends.postgresql.schema import DatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+# Set starred_message_count for already existing users to True.
+def set_starred_message_count_to_true(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
+ UserProfile = apps.get_model("zerver", "UserProfile")
+ UserProfile.objects.filter(starred_message_counts=False).update(starred_message_counts=True)
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("zerver", "0322_realm_create_audit_log_backfill"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="userprofile",
+ name="starred_message_counts",
+ field=models.BooleanField(default=True),
+ ),
+ migrations.RunPython(
+ set_starred_message_count_to_true,
+ reverse_code=migrations.RunPython.noop,
+ elidable=True,
+ ),
+ ]
diff --git a/zerver/models.py b/zerver/models.py
index e096ce40143..bc67b5f9d2d 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -1284,7 +1284,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
high_contrast_mode: bool = models.BooleanField(default=False)
translate_emoticons: bool = models.BooleanField(default=False)
twenty_four_hour_time: bool = models.BooleanField(default=False)
- starred_message_counts: bool = models.BooleanField(default=False)
+ starred_message_counts: bool = models.BooleanField(default=True)
COLOR_SCHEME_AUTOMATIC = 1
COLOR_SCHEME_NIGHT = 2
COLOR_SCHEME_LIGHT = 3