Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
inbox: Add inbox as default view.
Aman Agrawal7e11f95716ac
diff --git a/web/src/hashchange.js b/web/src/hashchange.jsindex 6a84f59c4d3..289dd4f4cfd 100644--- a/web/src/hashchange.js+++ b/web/src/hashchange.js@@ -149,20 +149,30 @@ function show_default_view() {// This function should only be called from the hashchange// handlers, as it does not set the hash to "".//- // We only allow all_messages and recent_topics- // to be rendered without a hash.- if (user_settings.default_view === "recent_topics") {- recent_view_ui.show();- } else if (user_settings.default_view === "all_messages") {- show_all_message_view();- } else {- // NOTE: Setting a hash which is not rendered on- // empty hash (like a stream narrow) will- // introduce a bug that user will not be able to- // go back in browser history. See- // https://chat.zulip.org/#narrow/stream/9-issues/topic/Browser.20back.20button.20on.20RT- // for detailed description of the issue.- window.location.hash = user_settings.default_view;+ // We only allow the primary recommended options for default views+ // rendered without a hash.+ switch (user_settings.default_view) {+ case "recent_topics": {+ recent_view_ui.show();+ break;+ }+ case "all_messages": {+ show_all_message_view();+ break;+ }+ case "inbox": {+ inbox_ui.show();+ break;+ }+ default: {+ // NOTE: Setting a hash which is not rendered on+ // empty hash (like a stream narrow) will+ // introduce a bug that user will not be able to+ // go back in browser history. See+ // https://chat.zulip.org/#narrow/stream/9-issues/topic/Browser.20back.20button.20on.20RT+ // for detailed description of the issue.+ window.location.hash = user_settings.default_view;+ }}}diff --git a/web/src/settings_config.ts b/web/src/settings_config.tsindex 7240b98c919..0158e1a8cae 100644--- a/web/src/settings_config.ts+++ b/web/src/settings_config.ts@@ -95,6 +95,10 @@ export const default_view_values = {code: "all_messages",description: $t({defaultMessage: "All messages"}),},+ inbox: {+ code: "inbox",+ description: $t({defaultMessage: "Inbox"}),+ },};export const color_scheme_values = {diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 93bed42cd39..c0932a67775 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -9814,6 +9814,7 @@ paths:Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.- "recent_topics" - Recent conversations view+ - "inbox" - Inbox view- "all_messages" - All messages viewschema:type: string@@ -12099,6 +12100,7 @@ paths:Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.- "recent_topics" - Recent conversations view+ - "inbox" - Inbox view- "all_messages" - All messages viewescape_navigates_to_default_view:type: boolean@@ -14224,6 +14226,7 @@ paths:Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.- "recent_topics" - Recent conversations view+ - "inbox" - Inbox view- "all_messages" - All messages viewescape_navigates_to_default_view:type: boolean@@ -15266,6 +15269,7 @@ paths:Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.- "recent_topics" - Recent conversations view+ - "inbox" - Inbox view- "all_messages" - All messages view**Changes**: Before Zulip 5.0 (feature level 80), this setting was managed bydiff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex a275c8c6d47..a9e2f3553da 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -3090,7 +3090,7 @@ class RealmPropertyActionTest(BaseAction):bool_tests: List[bool] = [True, False, True]test_values: Dict[str, Any] = dict(color_scheme=UserProfile.COLOR_SCHEME_CHOICES,- default_view=["recent_topics", "all_messages"],+ default_view=["recent_topics", "inbox", "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,@@ -3171,7 +3171,7 @@ class UserDisplayActionTest(BaseAction):test_changes: Dict[str, Any] = dict(emojiset=["twitter"],default_language=["es", "de", "en"],- default_view=["all_messages", "recent_topics"],+ default_view=["all_messages", "inbox", "recent_topics"],demote_inactive_streams=[2, 3, 1],web_mark_read_on_scroll_policy=[2, 3, 1],user_list_style=[1, 2, 3],diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex 1b9fc896941..46e84afba9b 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -1299,7 +1299,7 @@ class RealmAPITest(ZulipTestCase):bool_tests: List[bool] = [False, True]test_values: Dict[str, Any] = dict(color_scheme=UserProfile.COLOR_SCHEME_CHOICES,- default_view=["recent_topics", "all_messages"],+ default_view=["recent_topics", "inbox", "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,diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex cb2a584b8c2..ab020f0659c 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -424,7 +424,7 @@ def realm_reactivation(request: HttpRequest, confirmation_key: str) -> HttpRespoemojiset_choices = {emojiset["key"] for emojiset in RealmUserDefault.emojiset_choices()}-default_view_options = ["recent_topics", "all_messages"]+default_view_options = ["recent_topics", "inbox", "all_messages"]@require_realm_admindiff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.pyindex 0bf390a73a7..f262ec548da 100644--- a/zerver/views/user_settings.py+++ b/zerver/views/user_settings.py@@ -127,7 +127,7 @@ def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResemojiset_choices = {emojiset["key"] for emojiset in UserProfile.emojiset_choices()}-default_view_options = ["recent_topics", "all_messages"]+default_view_options = ["recent_topics", "inbox", "all_messages"]def check_settings_values(