Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

models: Rename `receives_online_notifications` function.

Abhijeet Prasad Bodas518deb7b9e8d
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index a65ecb6afdf..350d84b5ab8 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -31,7 +31,7 @@ from zerver.models import (
get_display_recipient,
get_user_profile_by_id,
receives_offline_push_notifications,
- receives_online_notifications,
+ receives_online_push_notifications,
)
if TYPE_CHECKING:
@@ -852,7 +852,7 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Any
user_profile = get_user_profile_by_id(user_profile_id)
if not (
receives_offline_push_notifications(user_profile)
- or receives_online_notifications(user_profile)
+ or receives_online_push_notifications(user_profile)
):
return
diff --git a/zerver/models.py b/zerver/models.py
index 3e387da0cf5..338954b3b25 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -1661,7 +1661,7 @@ def receives_offline_email_notifications(user_profile: UserProfile) -> bool:
return user_profile.enable_offline_email_notifications and not user_profile.is_bot
-def receives_online_notifications(user_profile: UserProfile) -> bool:
+def receives_online_push_notifications(user_profile: UserProfile) -> bool:
return user_profile.enable_online_push_notifications and not user_profile.is_bot
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py
index d75c9bf0ada..2e45148a78b 100644
--- a/zerver/tests/test_push_notifications.py
+++ b/zerver/tests/test_push_notifications.py
@@ -72,7 +72,7 @@ from zerver.models import (
get_stream,
receives_offline_email_notifications,
receives_offline_push_notifications,
- receives_online_notifications,
+ receives_online_push_notifications,
receives_stream_notifications,
)
@@ -2197,19 +2197,19 @@ class TestReceivesNotificationsFunctions(ZulipTestCase):
self.user.is_bot = True
self.user.enable_online_push_notifications = True
- self.assertFalse(receives_online_notifications(self.user))
+ self.assertFalse(receives_online_push_notifications(self.user))
self.user.enable_online_push_notifications = False
- self.assertFalse(receives_online_notifications(self.user))
+ self.assertFalse(receives_online_push_notifications(self.user))
def test_receivers_online_notifications_when_user_is_not_a_bot(self) -> None:
self.user.is_bot = False
self.user.enable_online_push_notifications = True
- self.assertTrue(receives_online_notifications(self.user))
+ self.assertTrue(receives_online_push_notifications(self.user))
self.user.enable_online_push_notifications = False
- self.assertFalse(receives_online_notifications(self.user))
+ self.assertFalse(receives_online_push_notifications(self.user))
def test_receivers_offline_notifications_when_user_is_a_bot(self) -> None:
self.user.is_bot = True