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.

settings: Reorder custom profile field types.

ColeBurch60225591dcc9
diff --git a/zerver/migrations/0417_alter_customprofilefield_field_type.py b/zerver/migrations/0417_alter_customprofilefield_field_type.py
index beb262ac8e2..048a443c802 100644
--- a/zerver/migrations/0417_alter_customprofilefield_field_type.py
+++ b/zerver/migrations/0417_alter_customprofilefield_field_type.py
@@ -14,13 +14,13 @@ class Migration(migrations.Migration):
name="field_type",
field=models.PositiveSmallIntegerField(
choices=[
- (1, "Text (short)"),
- (2, "Text (long)"),
(4, "Date"),
- (5, "Link"),
(7, "External account"),
- (8, "Pronouns"),
+ (5, "Link"),
(3, "List of options"),
+ (8, "Pronouns"),
+ (2, "Text (long)"),
+ (1, "Text (short)"),
(6, "Users"),
],
default=1,
diff --git a/zerver/models/custom_profile_fields.py b/zerver/models/custom_profile_fields.py
index b7083eec0a2..a3d22e978a1 100644
--- a/zerver/models/custom_profile_fields.py
+++ b/zerver/models/custom_profile_fields.py
@@ -120,7 +120,9 @@ class CustomProfileField(models.Model):
(PRONOUNS, gettext_lazy("Pronouns"), check_short_string, str, "PRONOUNS"),
]
- ALL_FIELD_TYPES = [*FIELD_TYPE_DATA, *SELECT_FIELD_TYPE_DATA, *USER_FIELD_TYPE_DATA]
+ ALL_FIELD_TYPES = sorted(
+ [*FIELD_TYPE_DATA, *SELECT_FIELD_TYPE_DATA, *USER_FIELD_TYPE_DATA], key=lambda x: x[1]
+ )
FIELD_VALIDATORS: Dict[int, Validator[ProfileDataElementValue]] = {
item[0]: item[2] for item in FIELD_TYPE_DATA