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: Rename night->dark and day->light in the color scheme backend.

Sayam Samal073b116c55b6
diff --git a/zerver/lib/zcommand.py b/zerver/lib/zcommand.py
index a92b40a301f..7af12cd0c7c 100644
--- a/zerver/lib/zcommand.py
+++ b/zerver/lib/zcommand.py
@@ -26,18 +26,18 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]
if command == "ping":
return {}
- elif command == "night":
- if user_profile.color_scheme == UserProfile.COLOR_SCHEME_NIGHT:
+ elif command == "dark":
+ if user_profile.color_scheme == UserProfile.COLOR_SCHEME_DARK:
return dict(msg="You are still in dark theme.")
return dict(
msg=change_mode_setting(
setting_name="dark theme",
switch_command="light",
setting="color_scheme",
- setting_value=UserProfile.COLOR_SCHEME_NIGHT,
+ setting_value=UserProfile.COLOR_SCHEME_DARK,
)
)
- elif command == "day":
+ elif command == "light":
if user_profile.color_scheme == UserProfile.COLOR_SCHEME_LIGHT:
return dict(msg="You are still in light theme.")
return dict(
diff --git a/zerver/models/users.py b/zerver/models/users.py
index d9a3fc53795..703d94c37e6 100644
--- a/zerver/models/users.py
+++ b/zerver/models/users.py
@@ -73,9 +73,9 @@ class UserBaseSettings(models.Model):
twenty_four_hour_time = models.BooleanField(default=False)
starred_message_counts = models.BooleanField(default=True)
COLOR_SCHEME_AUTOMATIC = 1
- COLOR_SCHEME_NIGHT = 2
+ COLOR_SCHEME_DARK = 2
COLOR_SCHEME_LIGHT = 3
- COLOR_SCHEME_CHOICES = [COLOR_SCHEME_AUTOMATIC, COLOR_SCHEME_NIGHT, COLOR_SCHEME_LIGHT]
+ COLOR_SCHEME_CHOICES = [COLOR_SCHEME_AUTOMATIC, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT]
color_scheme = models.PositiveSmallIntegerField(default=COLOR_SCHEME_AUTOMATIC)
# Information density is established through
diff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.py
index fbb04862341..5a4870349eb 100644
--- a/zerver/tests/test_settings.py
+++ b/zerver/tests/test_settings.py
@@ -474,11 +474,11 @@ class ChangeSettingsTest(ZulipTestCase):
self.login("hamlet")
result = self.client_patch(
- "/json/settings/display", dict(color_scheme=UserProfile.COLOR_SCHEME_NIGHT)
+ "/json/settings/display", dict(color_scheme=UserProfile.COLOR_SCHEME_DARK)
)
self.assert_json_success(result)
hamlet = self.example_user("hamlet")
- self.assertEqual(hamlet.color_scheme, UserProfile.COLOR_SCHEME_NIGHT)
+ self.assertEqual(hamlet.color_scheme, UserProfile.COLOR_SCHEME_DARK)
def test_changing_setting_using_notification_setting_endpoint(self) -> None:
"""
diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py
index 3c7c42aa5e2..75bf35ded08 100644
--- a/zerver/tests/test_users.py
+++ b/zerver/tests/test_users.py
@@ -1298,7 +1298,7 @@ class UserProfileTest(ZulipTestCase):
do_change_user_setting(cordelia, "emojiset", "twitter", acting_user=None)
do_change_user_setting(cordelia, "timezone", "America/Phoenix", acting_user=None)
do_change_user_setting(
- cordelia, "color_scheme", UserProfile.COLOR_SCHEME_NIGHT, acting_user=None
+ cordelia, "color_scheme", UserProfile.COLOR_SCHEME_DARK, acting_user=None
)
do_change_user_setting(
cordelia, "enable_offline_email_notifications", False, acting_user=None
@@ -1342,8 +1342,8 @@ class UserProfileTest(ZulipTestCase):
self.assertEqual(cordelia.timezone, "America/Phoenix")
self.assertEqual(hamlet.timezone, "")
- self.assertEqual(iago.color_scheme, UserProfile.COLOR_SCHEME_NIGHT)
- self.assertEqual(cordelia.color_scheme, UserProfile.COLOR_SCHEME_NIGHT)
+ self.assertEqual(iago.color_scheme, UserProfile.COLOR_SCHEME_DARK)
+ self.assertEqual(cordelia.color_scheme, UserProfile.COLOR_SCHEME_DARK)
self.assertEqual(hamlet.color_scheme, UserProfile.COLOR_SCHEME_AUTOMATIC)
self.assertEqual(iago.enable_offline_email_notifications, False)
diff --git a/zerver/tests/test_zcommand.py b/zerver/tests/test_zcommand.py
index 1501b96935d..020c35561c5 100644
--- a/zerver/tests/test_zcommand.py
+++ b/zerver/tests/test_zcommand.py
@@ -27,7 +27,7 @@ class ZcommandTest(ZulipTestCase):
user.color_scheme = UserProfile.COLOR_SCHEME_LIGHT
user.save()
- payload = dict(command="/night")
+ payload = dict(command="/dark")
result = self.client_post("/json/zcommand", payload)
response_dict = self.assert_json_success(result)
self.assertIn("Changed to dark theme", response_dict["msg"])
@@ -39,10 +39,10 @@ class ZcommandTest(ZulipTestCase):
def test_day_zcommand(self) -> None:
self.login("hamlet")
user = self.example_user("hamlet")
- user.color_scheme = UserProfile.COLOR_SCHEME_NIGHT
+ user.color_scheme = UserProfile.COLOR_SCHEME_DARK
user.save()
- payload = dict(command="/day")
+ payload = dict(command="/light")
result = self.client_post("/json/zcommand", payload)
response_dict = self.assert_json_success(result)
self.assertIn("Changed to light theme", response_dict["msg"])