mirror of https://github.com/zulip/zulip.git
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.
This commit is contained in:
parent
1cdc7306c6
commit
eef9dd963b
|
@ -9,12 +9,12 @@ from zerver.models import UserProfile
|
||||||
|
|
||||||
def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]:
|
def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]:
|
||||||
def change_mode_setting(
|
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:
|
) -> str:
|
||||||
msg = (
|
msg = (
|
||||||
"Changed to {command} mode! To revert "
|
"Changed to {setting_name}! To revert "
|
||||||
"{command} mode, type `/{switch_command}`.".format(
|
"{setting_name}, type `/{switch_command}`.".format(
|
||||||
command=command,
|
setting_name=setting_name,
|
||||||
switch_command=switch_command,
|
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="You are still in dark theme.")
|
||||||
return dict(
|
return dict(
|
||||||
msg=change_mode_setting(
|
msg=change_mode_setting(
|
||||||
command="dark",
|
setting_name="dark theme",
|
||||||
switch_command="light",
|
switch_command="light",
|
||||||
setting="color_scheme",
|
setting="color_scheme",
|
||||||
setting_value=UserProfile.COLOR_SCHEME_NIGHT,
|
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="You are still in light theme.")
|
||||||
return dict(
|
return dict(
|
||||||
msg=change_mode_setting(
|
msg=change_mode_setting(
|
||||||
command="light",
|
setting_name="light theme",
|
||||||
switch_command="dark",
|
switch_command="dark",
|
||||||
setting="color_scheme",
|
setting="color_scheme",
|
||||||
setting_value=UserProfile.COLOR_SCHEME_LIGHT,
|
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="You are still in fluid width mode.")
|
||||||
return dict(
|
return dict(
|
||||||
msg=change_mode_setting(
|
msg=change_mode_setting(
|
||||||
command=command,
|
setting_name="fluid-width mode",
|
||||||
switch_command="fixed-width",
|
switch_command="fixed-width",
|
||||||
setting="fluid_layout_width",
|
setting="fluid_layout_width",
|
||||||
setting_value=True,
|
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="You are still in fixed width mode.")
|
||||||
return dict(
|
return dict(
|
||||||
msg=change_mode_setting(
|
msg=change_mode_setting(
|
||||||
command=command,
|
setting_name="fixed-width mode",
|
||||||
switch_command="fluid-width",
|
switch_command="fluid-width",
|
||||||
setting="fluid_layout_width",
|
setting="fluid_layout_width",
|
||||||
setting_value=False,
|
setting_value=False,
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ZcommandTest(ZulipTestCase):
|
||||||
payload = dict(command="/night")
|
payload = dict(command="/night")
|
||||||
result = self.client_post("/json/zcommand", payload)
|
result = self.client_post("/json/zcommand", payload)
|
||||||
self.assert_json_success(result)
|
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)
|
result = self.client_post("/json/zcommand", payload)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
@ -45,7 +45,7 @@ class ZcommandTest(ZulipTestCase):
|
||||||
payload = dict(command="/day")
|
payload = dict(command="/day")
|
||||||
result = self.client_post("/json/zcommand", payload)
|
result = self.client_post("/json/zcommand", payload)
|
||||||
self.assert_json_success(result)
|
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)
|
result = self.client_post("/json/zcommand", payload)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
Loading…
Reference in New Issue