diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md index ccaa5cb525..065fcdfa38 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` and diff --git a/version.py b/version.py index 474c5e8dac..796d3b38d0 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. Bump diff --git a/zerver/tests/test_email_change.py b/zerver/tests/test_email_change.py index c7293b40c0..f45239e1da 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 error result = self.client_patch(url, {"email": "hamlet@zulip.com"}) - 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": "hamlet-new@zulip.com"} @@ -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": "cordelia@zulip.com"} @@ -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.py index d9615300cf..68c1390821 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 is diff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.py index e0612e022f..4357afac01 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_key class 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.py index 36c944dfd0..d362f756d7 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( pass else: # 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