mirror of https://github.com/zulip/zulip.git
api: Remove "full_name" and "account_email" from response of '/settings'.
We remove the "full_name" and "account_email" fields from the response of 'PATCH /settings' endpoint. These fields were part of the response to make sure that we tell that the parameters not present in response were ignored. We can remove these fields as 'ignored_parameters_unsupported' now specifies which parameters were ignored and not supported by the endpoint.
This commit is contained in:
parent
05aff3f271
commit
d5a0c1ede5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue