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.

event_types: Add use_for_user_matching to custom profile schema.

Evy Kassirerbc6789e8538e
diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.py
index a2855eceafb..b050db61ffc 100644
--- a/zerver/lib/event_types.py
+++ b/zerver/lib/event_types.py
@@ -116,6 +116,7 @@ class DetailedCustomProfileCore(BaseModel):
class DetailedCustomProfile(DetailedCustomProfileCore):
# TODO: fix types to avoid optional fields
display_in_profile_summary: bool | None = None
+ use_for_user_matching: bool | None = None
class CustomProfileFieldsEvent(BaseEvent):
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 771afe36371..0b60b2614b7 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -1737,6 +1737,19 @@ class NormalActionsTest(BaseAction):
)
check_custom_profile_fields("events[0]", events[0])
+ with self.verify_action() as events:
+ try_add_realm_custom_profile_field(
+ realm=realm,
+ name="Matrix username",
+ field_type=CustomProfileField.SHORT_TEXT,
+ use_for_user_matching=True,
+ )
+ check_custom_profile_fields("events[0]", events[0])
+ [matching_field] = (
+ field for field in events[0]["fields"] if field["name"] == "Matrix username"
+ )
+ self.assertTrue(matching_field["use_for_user_matching"])
+
field = realm.customprofilefield_set.get(realm=realm, name="Biography")
name = field.name
hint = "Biography of the user"