mirror of https://github.com/zulip/zulip.git
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:
parent
e11648f22e
commit
518deb7b9e
|
@ -31,7 +31,7 @@ from zerver.models import (
|
||||||
get_display_recipient,
|
get_display_recipient,
|
||||||
get_user_profile_by_id,
|
get_user_profile_by_id,
|
||||||
receives_offline_push_notifications,
|
receives_offline_push_notifications,
|
||||||
receives_online_notifications,
|
receives_online_push_notifications,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
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)
|
user_profile = get_user_profile_by_id(user_profile_id)
|
||||||
if not (
|
if not (
|
||||||
receives_offline_push_notifications(user_profile)
|
receives_offline_push_notifications(user_profile)
|
||||||
or receives_online_notifications(user_profile)
|
or receives_online_push_notifications(user_profile)
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -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
|
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
|
return user_profile.enable_online_push_notifications and not user_profile.is_bot
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ from zerver.models import (
|
||||||
get_stream,
|
get_stream,
|
||||||
receives_offline_email_notifications,
|
receives_offline_email_notifications,
|
||||||
receives_offline_push_notifications,
|
receives_offline_push_notifications,
|
||||||
receives_online_notifications,
|
receives_online_push_notifications,
|
||||||
receives_stream_notifications,
|
receives_stream_notifications,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2197,19 +2197,19 @@ class TestReceivesNotificationsFunctions(ZulipTestCase):
|
||||||
self.user.is_bot = True
|
self.user.is_bot = True
|
||||||
|
|
||||||
self.user.enable_online_push_notifications = 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.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:
|
def test_receivers_online_notifications_when_user_is_not_a_bot(self) -> None:
|
||||||
self.user.is_bot = False
|
self.user.is_bot = False
|
||||||
|
|
||||||
self.user.enable_online_push_notifications = True
|
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.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:
|
def test_receivers_offline_notifications_when_user_is_a_bot(self) -> None:
|
||||||
self.user.is_bot = True
|
self.user.is_bot = True
|
||||||
|
|
Loading…
Reference in New Issue