Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api: Remove "full_name" and "account_email" from response of '/settings'.
sahil839d5a0c1ede57d
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.mdindex ccaa5cb5259..065fcdfa386 100644--- a/templates/zerver/api/changelog.md+++ b/templates/zerver/api/changelog.md@@ -17,6 +17,9 @@ below features are supported.which is a list of parameters that were ignored by the endpoint,to the response object.+* `PATCH /settings`: Removed `full_name` and `account_email` fields+ from the response object.+**Feature level 77*** [`GET /events`](/api/get-events): Removed `recipient_id` anddiff --git a/version.py b/version.pyindex 474c5e8dac2..796d3b38d0d 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"# Changes should be accompanied by documentation explaining what the# new level means in templates/zerver/api/changelog.md, as well as# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 77+API_FEATURE_LEVEL = 78# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/tests/test_email_change.py b/zerver/tests/test_email_change.pyindex c7293b40c0b..f45239e1da6 100644--- a/zerver/tests/test_email_change.py+++ b/zerver/tests/test_email_change.py@@ -103,8 +103,8 @@ class EmailChangeTestCase(ZulipTestCase):url = "/json/settings"self.assert_length(mail.outbox, 0)result = self.client_patch(url, data)+ self.assert_json_success(result)self.assert_length(mail.outbox, 1)- self.assert_in_success_response(["Check your email for a confirmation link."], result)email_message = mail.outbox[0]self.assertEqual(email_message.subject,@@ -127,7 +127,7 @@ class EmailChangeTestCase(ZulipTestCase):# Now confirm trying to change your email back doesn't throw an immediate errorresult = self.client_patch(url, {"email": "[email protected]"})- self.assert_in_success_response(["Check your email for a confirmation link."], result)+ self.assert_json_success(result)def test_unauthorized_email_change(self) -> None:data = {"email": "[email protected]"}@@ -149,7 +149,7 @@ class EmailChangeTestCase(ZulipTestCase):self.login("iago")url = "/json/settings"result = self.client_patch(url, data)- self.assert_in_success_response(["Check your email for a confirmation link."], result)+ self.assert_json_success(result)def test_email_change_already_taken(self) -> None:data = {"email": "[email protected]"}@@ -170,7 +170,7 @@ class EmailChangeTestCase(ZulipTestCase):self.assert_length(mail.outbox, 0)result = self.client_patch(url, data)self.assert_length(mail.outbox, 1)- self.assert_in_success_response(["Check your email for a confirmation link."], result)+ self.assert_json_success(result)email_message = mail.outbox[0]self.assertEqual(email_message.subject,diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex d9615300cff..68c13908219 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -171,7 +171,7 @@ class RealmTest(ZulipTestCase):self.login("iago")url = "/json/settings"result = self.client_patch(url, data)- self.assert_in_success_response(['"full_name":"New Iago"'], result)+ self.assert_json_success(result)def test_do_deactivate_realm_clears_user_realm_cache(self) -> None:"""The main complicated thing about deactivating realm names isdiff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.pyindex e0612e022fa..4357afac019 100644--- a/zerver/tests/test_settings.py+++ b/zerver/tests/test_settings.py@@ -15,9 +15,6 @@ from zerver.models import UserProfile, get_user_profile_by_api_keyclass ChangeSettingsTest(ZulipTestCase):- def check_well_formed_change_settings_response(self, result: Dict[str, Any]) -> None:- self.assertIn("full_name", result)-# DEPRECATED, to be deleted after all uses of check_for_toggle_param# are converted into check_for_toggle_param_patch.def check_for_toggle_param(self, pattern: str, param: str) -> None:@@ -68,8 +65,6 @@ class ChangeSettingsTest(ZulipTestCase):),)self.assert_json_success(json_result)- result = orjson.loads(json_result.content)- self.check_well_formed_change_settings_response(result)user.refresh_from_db()self.assertEqual(user.full_name, "Foo Bar")diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.pyindex 36c944dfd06..d362f756d7a 100644--- a/zerver/views/user_settings.py+++ b/zerver/views/user_settings.py@@ -162,7 +162,6 @@ def json_change_settings(raise JsonableError(e.message)do_start_email_change_process(user_profile, new_email)- result["account_email"] = _("Check your email for a confirmation link. ")if user_profile.full_name != full_name and full_name.strip() != "":if name_changes_disabled(user_profile.realm) and not user_profile.is_realm_admin:@@ -171,7 +170,7 @@ def json_change_settings(passelse:# Note that check_change_full_name strips the passed name automatically- result["full_name"] = check_change_full_name(user_profile, full_name, user_profile)+ check_change_full_name(user_profile, full_name, user_profile)# TODO: Do this more generally.from zerver.lib.request import get_request_notes