Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_settings: Add web_mark_read_on_scroll_policy field.
Joeluteafbd0a9b4349
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 0ab9db84dfb..ee96913fac2 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,13 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 7.0+**Feature level 175**++* [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings),+ [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):+ Added new user setting `web_mark_read_on_scroll_policy` . This determines whether to mark+ messages as read or not as the client scrolls through their feed.+**Feature level 174**:* [`POST /typing`](/api/set-typing-status), [`POST /messages`](/api/send-message):diff --git a/version.py b/version.pyindex c6ffa749737..5a5698ede36 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"# Changes should be accompanied by documentation explaining what the# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 174+API_FEATURE_LEVEL = 175# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/migrations/0438_add_web_mark_read_on_scroll_policy_setting.py b/zerver/migrations/0438_add_web_mark_read_on_scroll_policy_setting.pynew file mode 100644index 00000000000..d216d1d698f--- /dev/null+++ b/zerver/migrations/0438_add_web_mark_read_on_scroll_policy_setting.py@@ -0,0 +1,22 @@+# Generated by Django 4.1.7 on 2023-04-05 01:19++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("zerver", "0437_remove_realm_authentication_methods"),+ ]++ operations = [+ migrations.AddField(+ model_name="realmuserdefault",+ name="web_mark_read_on_scroll_policy",+ field=models.SmallIntegerField(default=1),+ ),+ migrations.AddField(+ model_name="userprofile",+ name="web_mark_read_on_scroll_policy",+ field=models.SmallIntegerField(default=1),+ ),+ ]diff --git a/zerver/models.py b/zerver/models.pyindex 1a89e9288ab..f0e25ba51cb 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -1574,6 +1574,21 @@ class UserBaseSettings(models.Model):]demote_inactive_streams = models.PositiveSmallIntegerField(default=DEMOTE_STREAMS_AUTOMATIC)+ # UI setting controlling whether or not the Zulip web app will+ # mark messages as read as it scrolls through the feed.++ MARK_READ_ON_SCROLL_ALWAYS = 1+ MARK_READ_ON_SCROLL_CONVERSATION_ONLY = 2+ MARK_READ_ON_SCROLL_NEVER = 3++ WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES = [+ MARK_READ_ON_SCROLL_ALWAYS,+ MARK_READ_ON_SCROLL_CONVERSATION_ONLY,+ MARK_READ_ON_SCROLL_NEVER,+ ]++ web_mark_read_on_scroll_policy = models.SmallIntegerField(default=MARK_READ_ON_SCROLL_ALWAYS)+# Emoji setsGOOGLE_EMOJISET = "google"GOOGLE_BLOB_EMOJISET = "google-blob"@@ -1731,6 +1746,7 @@ class UserBaseSettings(models.Model):send_private_typing_notifications=bool,send_read_receipts=bool,send_stream_typing_notifications=bool,+ web_mark_read_on_scroll_policy=int,user_list_style=int,)diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 631aa56276b..0ca7c28d48f 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -9089,6 +9089,25 @@ paths:schema:type: booleanexample: true+ - name: web_mark_read_on_scroll_policy+ in: query+ description: |+ Whether or not to mark messages as read when the client scrolls through their+ feed.++ - 1 - Always+ - 2 - Only in conversation views+ - 3 - Never++ **Changes**: New in Zulip 7.0 (feature level 175). Previously, the app behaved+ like the "Always" setting, without any way to configure this.+ schema:+ type: integer+ enum:+ - 1+ - 2+ - 3+ example: 1- name: color_schemein: querydescription: |@@ -11132,6 +11151,18 @@ paths:description: |This setting has no effect at present. It is reserved for use in controllingthe default font size in Zulip.+ web_mark_read_on_scroll_policy:+ type: integer+ description: |+ Whether or not to mark messages as read when the client scrolls through their+ feed.++ - 1 - Always+ - 2 - Only in conversation views+ - 3 - Never++ **Changes**: New in Zulip 7.0 (feature level 175). Previously, the app behaved+ like the "Always" setting, without any way to configure this.starred_message_counts:type: booleandescription: |@@ -13085,6 +13116,18 @@ paths:description: |This setting has no effect at present. It is reserved for use incontrolling the default font size in Zulip.+ web_mark_read_on_scroll_policy:+ type: integer+ description: |+ Whether or not to mark messages as read when the client scrolls through their+ feed.++ - 1 - Always+ - 2 - Only in conversation views+ - 3 - Never++ **Changes**: New in Zulip 7.0 (feature level 175). Previously, the app behaved+ like the "Always" setting, without any way to configure this.starred_message_counts:type: booleandescription: |@@ -14030,6 +14073,25 @@ paths:schema:type: booleanexample: true+ - name: web_mark_read_on_scroll_policy+ in: query+ description: |+ Whether or not to mark messages as read when the client scrolls through their+ feed.++ - 1 - Always+ - 2 - Only in conversation views+ - 3 - Never++ **Changes**: New in Zulip 7.0 (feature level 175). Previously, the app behaved+ like the "Always" setting, without any way to configure this.+ schema:+ type: integer+ enum:+ - 1+ - 2+ - 3+ example: 1- name: starred_message_countsin: querydescription: |diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex b7aef969a8b..9ec81db2290 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -2715,6 +2715,7 @@ class RealmPropertyActionTest(BaseAction):default_view=["recent_topics", "all_messages"],emojiset=[emojiset["key"] for emojiset in RealmUserDefault.emojiset_choices()],demote_inactive_streams=UserProfile.DEMOTE_STREAMS_CHOICES,+ web_mark_read_on_scroll_policy=UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES,user_list_style=UserProfile.USER_LIST_STYLE_CHOICES,desktop_icon_count_display=[1, 2, 3],notification_sound=["zulip", "ding"],@@ -2791,6 +2792,7 @@ class UserDisplayActionTest(BaseAction):default_language=["es", "de", "en"],default_view=["all_messages", "recent_topics"],demote_inactive_streams=[2, 3, 1],+ web_mark_read_on_scroll_policy=[2, 3, 1],user_list_style=[1, 2, 3],color_scheme=[2, 3, 1],email_address_visibility=[5, 4, 1, 2, 3],diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex b06b1b29015..8d4a876ea36 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -1237,6 +1237,7 @@ class RealmAPITest(ZulipTestCase):default_view=["recent_topics", "all_messages"],emojiset=[emojiset["key"] for emojiset in RealmUserDefault.emojiset_choices()],demote_inactive_streams=UserProfile.DEMOTE_STREAMS_CHOICES,+ web_mark_read_on_scroll_policy=UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES,user_list_style=UserProfile.USER_LIST_STYLE_CHOICES,desktop_icon_count_display=[1, 2, 3],notification_sound=["zulip", "ding"],diff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.pyindex addecd6eed8..5bb56b8c350 100644--- a/zerver/tests/test_settings.py+++ b/zerver/tests/test_settings.py@@ -356,6 +356,7 @@ class ChangeSettingsTest(ZulipTestCase):emojiset="google",timezone="America/Denver",demote_inactive_streams=2,+ web_mark_read_on_scroll_policy=2,user_list_style=2,color_scheme=2,email_notifications_batching_period_seconds=100,@@ -371,7 +372,12 @@ class ChangeSettingsTest(ZulipTestCase):if test_value is None:raise AssertionError(f"No test created for {setting_name}")- if setting_name not in ["demote_inactive_streams", "user_list_style", "color_scheme"]:+ if setting_name not in [+ "demote_inactive_streams",+ "user_list_style",+ "color_scheme",+ "web_mark_read_on_scroll_policy",+ ]:data = {setting_name: test_value}else:data = {setting_name: orjson.dumps(test_value).decode()}@@ -397,6 +403,7 @@ class ChangeSettingsTest(ZulipTestCase):emojiset="apple",timezone="invalid_US/Mountain",demote_inactive_streams=10,+ web_mark_read_on_scroll_policy=10,user_list_style=10,color_scheme=10,notification_sound="invalid_sound",diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex 281f85eecc4..d9f7668824f 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -398,6 +398,10 @@ def update_realm_user_settings_defaults(request: HttpRequest,user_profile: UserProfile,dense_mode: Optional[bool] = REQ(json_validator=check_bool, default=None),+ web_mark_read_on_scroll_policy: Optional[int] = REQ(+ json_validator=check_int_in(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES),+ default=None,+ ),starred_message_counts: Optional[bool] = REQ(json_validator=check_bool, default=None),fluid_layout_width: Optional[bool] = REQ(json_validator=check_bool, default=None),high_contrast_mode: Optional[bool] = REQ(json_validator=check_bool, default=None),diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.pyindex 674ba151109..371b33b1936 100644--- a/zerver/views/user_settings.py+++ b/zerver/views/user_settings.py@@ -155,6 +155,10 @@ def json_change_settings(new_password: Optional[str] = REQ(default=None),twenty_four_hour_time: Optional[bool] = REQ(json_validator=check_bool, default=None),dense_mode: Optional[bool] = REQ(json_validator=check_bool, default=None),+ web_mark_read_on_scroll_policy: Optional[int] = REQ(+ json_validator=check_int_in(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES),+ default=None,+ ),starred_message_counts: Optional[bool] = REQ(json_validator=check_bool, default=None),fluid_layout_width: Optional[bool] = REQ(json_validator=check_bool, default=None),high_contrast_mode: Optional[bool] = REQ(json_validator=check_bool, default=None),