Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
pointer: Remove pointer from GET /users/me.
Tim Abbottf8ea5f37693b
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.mdindex f3870e18d29..0eea6e78103 100644--- a/templates/zerver/api/changelog.md+++ b/templates/zerver/api/changelog.md@@ -10,6 +10,11 @@ below features are supported.## Changes in Zulip 2.2+**Feature level 16**++* [`GET /users/me`]: Removed `pointer` from the response, as the+ "pointer" concept is being removed in Zulip.+**Feature level 15*** Added [spoilers](/help/format-your-message-using-markdown#spoilers)diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex c473b73902f..c033db8edaf 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -2006,13 +2006,6 @@ paths:**Deprecated**. We plan to remove this in favor of recommendingusing `GET /messages` with `anchor="newest"`.example: 30- pointer:- type: integer- description: |- The integer ID of the message that the pointer is currently on.-- **Deprecated**. We plan to remove the `pointer` as a concept in Zulip.- example: -1user_id:type: integerdescription: |@@ -2035,7 +2028,6 @@ paths:"date_joined": "2019-10-20T07:50:53.728864+00:00","max_message_id": 30,"msg": "",- "pointer": -1,"result": "success","user_id": 5,"profile_data": {diff --git a/zerver/tests/test_custom_profile_data.py b/zerver/tests/test_custom_profile_data.pyindex 80c87cc893f..bde5afbc1b7 100644--- a/zerver/tests/test_custom_profile_data.py+++ b/zerver/tests/test_custom_profile_data.py@@ -703,7 +703,7 @@ class ListCustomProfileFieldTest(CustomProfileFieldTestCase):def test_get_custom_profile_fields_from_api_for_single_user(self) -> None:self.login('iago')expected_keys = {- "result", "msg", "pointer", "max_message_id", "user_id", "avatar_url",+ "result", "msg", "max_message_id", "user_id", "avatar_url","full_name", "email", "is_bot", "is_admin", "is_owner", "profile_data","avatar_version", "timezone", "delivery_email", "is_active", "is_guest","date_joined"}diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.pyindex ed1fb021615..cb1a406f023 100644--- a/zerver/tests/test_users.py+++ b/zerver/tests/test_users.py@@ -26,7 +26,6 @@ from zerver.lib.stream_topic import StreamTopicTargetfrom zerver.lib.test_classes import ZulipTestCasefrom zerver.lib.test_helpers import (get_subscription,- most_recent_message,queries_captured,reset_emails_in_zulip_realm,simulated_empty_cache,@@ -1512,22 +1511,11 @@ class GetProfileTest(ZulipTestCase):result = self.client_post("/json/users/me/pointer", {"pointer": pointer})self.assert_json_success(result)- def common_get_profile(self, user_id: str) -> Dict[str, Any]:- # Assumes all users are example users in realm 'zulip'+ def common_get_pointer(self, user_id: str) -> Dict[str, Any]:user_profile = self.example_user(user_id)- self.send_stream_message(user_profile, "Verona", "hello")-- result = self.api_get(user_profile, "/api/v1/users/me")-- max_id = most_recent_message(user_profile).id-+ result = self.api_get(user_profile, "/json/users/me/pointer")self.assert_json_success(result)json = result.json()-- self.assertIn("max_message_id", json)- self.assertIn("pointer", json)-- self.assertEqual(json["max_message_id"], max_id)return jsondef test_get_pointer(self) -> None:@@ -1608,8 +1596,8 @@ class GetProfileTest(ZulipTestCase):"""Ensure GET /users/me returns a max message id and returns successfully"""- json = self.common_get_profile("othello")- self.assertEqual(json["pointer"], -1)+ json = self.common_get_pointer("othello")+ self.assertEqual(json['pointer'], -1)def test_profile_with_pointer(self) -> None:"""@@ -1619,15 +1607,13 @@ class GetProfileTest(ZulipTestCase):id1 = self.send_stream_message(self.example_user("othello"), "Verona")id2 = self.send_stream_message(self.example_user("othello"), "Verona")- json = self.common_get_profile("hamlet")-hamlet = self.example_user('hamlet')self.common_update_pointer(hamlet, id2)- json = self.common_get_profile("hamlet")+ json = self.common_get_pointer("hamlet")self.assertEqual(json["pointer"], id2)self.common_update_pointer(hamlet, id1)- json = self.common_get_profile("hamlet")+ json = self.common_get_pointer("hamlet")self.assertEqual(json["pointer"], id2) # pointer does not move backwardsresult = self.client_post("/json/users/me/pointer", {"pointer": 99999999})diff --git a/zerver/views/users.py b/zerver/views/users.pyindex 9c4db54fc54..aa2efe48588 100644--- a/zerver/views/users.py+++ b/zerver/views/users.py@@ -505,7 +505,6 @@ def get_profile_backend(request: HttpRequest, user_profile: UserProfile) -> Httpresult: Dict[str, Any] = raw_user_data[user_profile.id]result['max_message_id'] = -1- result['pointer'] = user_profile.pointermessages = Message.objects.filter(usermessage__user_profile=user_profile).order_by('-id')[:1]if messages: