From eef9dd963b2720ba1ad93dc29fa4a6e9c2f08de9 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Mon, 22 Nov 2021 23:56:13 +0530 Subject: [PATCH] zcommand: Replace "mode" with "theme" in the returned message. This commit replaces "dark mode" and "light mode" with "dark theme" and "light theme" in the message returned and shown in a little popup in the UI, when color scheme settings are changed through slash commands. --- zerver/lib/zcommand.py | 16 ++++++++-------- zerver/tests/test_zcommand.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zerver/lib/zcommand.py b/zerver/lib/zcommand.py index 2ae038e4e0..a80f44b356 100644 --- a/zerver/lib/zcommand.py +++ b/zerver/lib/zcommand.py @@ -9,12 +9,12 @@ from zerver.models import UserProfile def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]: def change_mode_setting( - command: str, switch_command: str, setting: str, setting_value: int + setting_name: str, switch_command: str, setting: str, setting_value: int ) -> str: msg = ( - "Changed to {command} mode! To revert " - "{command} mode, type `/{switch_command}`.".format( - command=command, + "Changed to {setting_name}! To revert " + "{setting_name}, type `/{switch_command}`.".format( + setting_name=setting_name, switch_command=switch_command, ) ) @@ -37,7 +37,7 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any] return dict(msg="You are still in dark theme.") return dict( msg=change_mode_setting( - command="dark", + setting_name="dark theme", switch_command="light", setting="color_scheme", setting_value=UserProfile.COLOR_SCHEME_NIGHT, @@ -48,7 +48,7 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any] return dict(msg="You are still in light theme.") return dict( msg=change_mode_setting( - command="light", + setting_name="light theme", switch_command="dark", setting="color_scheme", setting_value=UserProfile.COLOR_SCHEME_LIGHT, @@ -59,7 +59,7 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any] return dict(msg="You are still in fluid width mode.") return dict( msg=change_mode_setting( - command=command, + setting_name="fluid-width mode", switch_command="fixed-width", setting="fluid_layout_width", setting_value=True, @@ -70,7 +70,7 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any] return dict(msg="You are still in fixed width mode.") return dict( msg=change_mode_setting( - command=command, + setting_name="fixed-width mode", switch_command="fluid-width", setting="fluid_layout_width", setting_value=False, diff --git a/zerver/tests/test_zcommand.py b/zerver/tests/test_zcommand.py index d41aa6befb..b8eede044f 100644 --- a/zerver/tests/test_zcommand.py +++ b/zerver/tests/test_zcommand.py @@ -30,7 +30,7 @@ class ZcommandTest(ZulipTestCase): payload = dict(command="/night") result = self.client_post("/json/zcommand", payload) self.assert_json_success(result) - self.assertIn("Changed to dark mode", result.json()["msg"]) + self.assertIn("Changed to dark theme", result.json()["msg"]) result = self.client_post("/json/zcommand", payload) self.assert_json_success(result) @@ -45,7 +45,7 @@ class ZcommandTest(ZulipTestCase): payload = dict(command="/day") result = self.client_post("/json/zcommand", payload) self.assert_json_success(result) - self.assertIn("Changed to light mode", result.json()["msg"]) + self.assertIn("Changed to light theme", result.json()["msg"]) result = self.client_post("/json/zcommand", payload) self.assert_json_success(result)