Refactor: Replace deprecated 'realm_uri' with 'realm_url' for consistency across the codebase.

This commit is contained in:
thiagocamerato757 2024-10-19 10:12:29 -03:00
parent 723346b05c
commit f1b51486c5
2 changed files with 2 additions and 23 deletions

View File

@ -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": {

View File

@ -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",