Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
custom_profile_fields: Change data of default external account type.
Yogesh Sirsatc355934179f6
diff --git a/zerver/lib/external_accounts.py b/zerver/lib/external_accounts.pyindex a92f9e75774..b0cf75cb2e7 100644--- a/zerver/lib/external_accounts.py+++ b/zerver/lib/external_accounts.py@@ -23,14 +23,14 @@ DEFAULT_EXTERNAL_ACCOUNTS = {"twitter": {"text": "Twitter","url_pattern": "https://twitter.com/%(username)s",- "name": "Twitter",- "hint": "Enter your Twitter username",+ "name": "Twitter username",+ "hint": "",},"github": {"text": "GitHub","url_pattern": "https://github.com/%(username)s",- "name": "GitHub",- "hint": "Enter your GitHub username",+ "name": "GitHub username",+ "hint": "",},}diff --git a/zerver/tests/test_custom_profile_data.py b/zerver/tests/test_custom_profile_data.pyindex b70dbbd73fe..00db2fbd846 100644--- a/zerver/tests/test_custom_profile_data.py+++ b/zerver/tests/test_custom_profile_data.py@@ -188,8 +188,8 @@ class CreateCustomProfileFieldTest(CustomProfileFieldTestCase):# for default custom external account fields.with self.assertRaises(CustomProfileField.DoesNotExist):field = CustomProfileField.objects.get(name=invalid_field_name, realm=realm)- # The field is created with 'Twitter' name as per values in default fields dict- field = CustomProfileField.objects.get(name="Twitter")+ # The field is created with 'Twitter username' name as per values in default fields dict+ field = CustomProfileField.objects.get(name="Twitter username")self.assertEqual(field.name, DEFAULT_EXTERNAL_ACCOUNTS["twitter"]["name"])self.assertEqual(field.hint, DEFAULT_EXTERNAL_ACCOUNTS["twitter"]["hint"])@@ -203,10 +203,10 @@ class CreateCustomProfileFieldTest(CustomProfileFieldTestCase):self.assert_json_success(result)# Default external account field data cannot be updated- field = CustomProfileField.objects.get(name="Twitter", realm=realm)+ field = CustomProfileField.objects.get(name="Twitter username", realm=realm)result = self.client_patch(f"/json/realm/profile_fields/{field.id}",- info={"name": "Twitter username", "field_type": CustomProfileField.EXTERNAL_ACCOUNT},+ info={"name": "Twitter", "field_type": CustomProfileField.EXTERNAL_ACCOUNT},)self.assert_json_error(result, "Default custom field cannot be updated.")@@ -217,7 +217,7 @@ class CreateCustomProfileFieldTest(CustomProfileFieldTestCase):self.login("iago")realm = get_realm("zulip")data: Dict[str, Union[str, int, Dict[str, str]]] = {}- data["name"] = "Twitter"+ data["name"] = "Twitter username"data["field_type"] = CustomProfileField.EXTERNAL_ACCOUNTdata["field_data"] = "invalid"@@ -261,9 +261,9 @@ class CreateCustomProfileFieldTest(CustomProfileFieldTestCase):result = self.client_post("/json/realm/profile_fields", info=data)self.assert_json_success(result)- twitter_field = CustomProfileField.objects.get(name="Twitter", realm=realm)+ twitter_field = CustomProfileField.objects.get(name="Twitter username", realm=realm)self.assertEqual(twitter_field.field_type, CustomProfileField.EXTERNAL_ACCOUNT)- self.assertEqual(twitter_field.name, "Twitter")+ self.assertEqual(twitter_field.name, "Twitter username")self.assertEqual(orjson.loads(twitter_field.field_data)["subtype"], "twitter")data["name"] = "Reddit"@@ -598,7 +598,7 @@ class UpdateCustomProfileFieldTest(CustomProfileFieldTestCase):("Birthday", "1909-03-05"),("Favorite website", "https://zulip.com"),("Mentor", [self.example_user("cordelia").id]),- ("GitHub", "zulip-mobile"),+ ("GitHub username", "zulip-mobile"),]data: List[ProfileDataElementUpdateDict] = []diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.pyindex 642c5cfd0b9..5dda4447318 100644--- a/zerver/tests/test_users.py+++ b/zerver/tests/test_users.py@@ -613,7 +613,7 @@ class PermissionTest(ZulipTestCase):"Birthday": "1909-03-05","Favorite website": "https://zulip.com","Mentor": [cordelia.id],- "GitHub": "timabbott",+ "GitHub username": "timabbott",}for field_name in fields:@@ -721,7 +721,7 @@ class PermissionTest(ZulipTestCase):"Birthday": None,"Favorite website": "https://zulip.github.io","Mentor": [hamlet.id],- "GitHub": "timabbott",+ "GitHub username": "timabbott",}new_profile_data = []for field_name in fields: