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.

zcommand: Replace "mode" with "theme" in the returned message.

Sahil Batraeef9dd963b27
diff --git a/zerver/lib/zcommand.py b/zerver/lib/zcommand.py
index 2ae038e4e08..a80f44b3562 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 d41aa6befbd..b8eede044f4 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)