models: Rename `receives_online_notifications` function.

Prep for later when we will have a similar setting for
online email notifications.
This commit is contained in:
Abhijeet Prasad Bodas 2021-05-27 17:51:32 +05:30 committed by Tim Abbott
parent e11648f22e
commit 518deb7b9e
3 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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