settings: Send presence update event toggling presence_enabled.

Fixes #21180.
This commit is contained in:
Adam Sah
2022-08-24 15:42:44 -04:00
committed by Tim Abbott
parent c98f9bcb8e
commit 637867dad1
4 changed files with 109 additions and 16 deletions

View File

@@ -1733,7 +1733,11 @@ class NormalActionsTest(BaseAction):
def test_change_notification_settings(self) -> None:
for notification_setting, v in self.user_profile.notification_setting_types.items():
if notification_setting in ["notification_sound", "desktop_icon_count_display"]:
if notification_setting in [
"notification_sound",
"desktop_icon_count_display",
"presence_enabled",
]:
# These settings are tested in their own tests.
continue
@@ -1769,6 +1773,26 @@ class NormalActionsTest(BaseAction):
check_user_settings_update("events[0]", events[0])
check_update_global_notifications("events[1]", events[1], setting_value)
def test_change_presence_enabled(self) -> None:
presence_enabled_setting = "presence_enabled"
for val in [True, False]:
events = self.verify_action(
lambda: do_change_user_setting(
self.user_profile, presence_enabled_setting, val, acting_user=self.user_profile
),
num_events=3,
)
check_user_settings_update("events[0]", events[0])
check_update_global_notifications("events[1]", events[1], val)
check_presence(
"events[2]",
events[2],
has_email=True,
presence_key="website",
status="active" if val else "idle",
)
def test_change_notification_sound(self) -> None:
notification_setting = "notification_sound"