From f1b51486c52fa0d58551d78cef91939debe66bf0 Mon Sep 17 00:00:00 2001 From: thiagocamerato757 Date: Sat, 19 Oct 2024 10:12:29 -0300 Subject: [PATCH] Refactor: Replace deprecated 'realm_uri' with 'realm_url' for consistency across the codebase. --- zerver/lib/push_notifications.py | 4 ++-- zerver/tests/test_push_notifications.py | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py index a98198c6be..f5f0f014db 100644 --- a/zerver/lib/push_notifications.py +++ b/zerver/lib/push_notifications.py @@ -951,7 +951,7 @@ def get_base_payload(user_profile: UserProfile) -> dict[str, Any]: # These will let the app support logging into multiple realms and servers. data["server"] = settings.EXTERNAL_HOST data["realm_id"] = user_profile.realm.id - data["realm_uri"] = user_profile.realm.url + data["realm_url"] = user_profile.realm.url data["realm_url"] = user_profile.realm.url data["realm_name"] = user_profile.realm.name data["user_id"] = user_profile.id @@ -1453,7 +1453,7 @@ def send_test_push_notification_directly_to_devices( android_payload = copy.deepcopy(payload) # TODO/compatibility: Backwards-compatibility name for realm_url. - realm_url = base_payload.get("realm_url", base_payload["realm_uri"]) + realm_url = base_payload.get("realm_url", base_payload["realm_url"]) realm_name = base_payload["realm_name"] apns_data = { "alert": { diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index ccbf4be4c4..810dc46e3d 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -219,7 +219,6 @@ class SendTestPushNotificationEndpointTest(BouncerTestCase): "server": "testserver", "realm_id": user.realm_id, "realm_name": "Zulip Dev", - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": user.id, "event": "test", @@ -254,7 +253,6 @@ class SendTestPushNotificationEndpointTest(BouncerTestCase): "server": "testserver", "realm_id": user.realm_id, "realm_name": "Zulip Dev", - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": user.id, "event": "test", @@ -337,7 +335,6 @@ class SendTestPushNotificationEndpointTest(BouncerTestCase): "server": "testserver", "realm_id": user.realm_id, "realm_name": "Zulip Dev", - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": user.id, "event": "test", @@ -801,7 +798,6 @@ class PushBouncerNotificationTest(BouncerTestCase): "sender_id": hamlet.id, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "user_id": self.example_user("othello").id, } @@ -817,7 +813,6 @@ class PushBouncerNotificationTest(BouncerTestCase): "content_truncated": False, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "sender_id": hamlet.id, "sender_email": hamlet.email, @@ -3504,7 +3499,6 @@ class HandlePushNotificationTest(PushNotificationTest): "server": "testserver", "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": self.user_profile.id, "event": "remove", @@ -3516,7 +3510,6 @@ class HandlePushNotificationTest(PushNotificationTest): "server": "testserver", "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": self.user_profile.id, "event": "remove", @@ -3585,7 +3578,6 @@ class HandlePushNotificationTest(PushNotificationTest): "server": "testserver", "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": self.user_profile.id, "event": "remove", @@ -3604,7 +3596,6 @@ class HandlePushNotificationTest(PushNotificationTest): "server": "testserver", "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": "http://zulip.testserver", "realm_url": "http://zulip.testserver", "user_id": self.user_profile.id, "event": "remove", @@ -4135,7 +4126,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "time": datetime_to_timestamp(message.date_sent), @@ -4180,7 +4170,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "time": datetime_to_timestamp(message.date_sent), @@ -4214,7 +4203,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": self.sender.id, "time": datetime_to_timestamp(message.date_sent), @@ -4254,7 +4242,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "time": datetime_to_timestamp(message.date_sent), @@ -4293,7 +4280,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "mentioned_user_group_id": user_group.id, @@ -4333,7 +4319,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "time": datetime_to_timestamp(message.date_sent), @@ -4396,7 +4381,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": self.sender.realm.id, "realm_name": self.sender.realm.name, - "realm_uri": self.sender.realm.url, "realm_url": self.sender.realm.url, "user_id": user_profile.id, "time": datetime_to_timestamp(message.date_sent), @@ -4447,7 +4431,6 @@ class TestGetAPNsPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "user_id": polonius.id, "time": datetime_to_timestamp(message.date_sent), @@ -4487,7 +4470,6 @@ class TestGetGCMPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "sender_id": hamlet.id, "sender_email": hamlet.email, @@ -4547,7 +4529,6 @@ class TestGetGCMPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "sender_id": hamlet.id, "sender_email": hamlet.email, @@ -4581,7 +4562,6 @@ class TestGetGCMPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "sender_id": hamlet.id, "sender_email": hamlet.email, @@ -4632,7 +4612,6 @@ class TestGetGCMPayload(PushNotificationTest): "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, - "realm_uri": hamlet.realm.url, "realm_url": hamlet.realm.url, "sender_id": hamlet.id, "sender_email": f"user{hamlet.id}@zulip.testserver",