Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
inbox_popover: Add option to make it the default view.
Aman Agrawal7f124500fa48
diff --git a/web/src/left_sidebar_navigation_area_popovers.js b/web/src/left_sidebar_navigation_area_popovers.jsindex e92a015374a..20995e71841 100644--- a/web/src/left_sidebar_navigation_area_popovers.js+++ b/web/src/left_sidebar_navigation_area_popovers.js@@ -10,12 +10,29 @@ import * as drafts from "./drafts";import * as popover_menus from "./popover_menus";import * as popovers from "./popovers";import * as scheduled_messages from "./scheduled_messages";+import * as settings_config from "./settings_config";import * as starred_messages from "./starred_messages";import * as starred_messages_ui from "./starred_messages_ui";import {parse_html, update_unread_count_in_dom} from "./ui_util";import * as unread_ops from "./unread_ops";import {user_settings} from "./user_settings";+function common_click_handlers() {+ $("body").on("click", ".set-default-view", (e) => {+ e.preventDefault();+ e.preventDefault();++ const default_view = $(e.currentTarget).attr("data-view-code");+ const data = {default_view};+ channel.patch({+ url: "/json/settings",+ data,+ });++ popovers.hide_all();+ });+}+export function initialize() {// Starred messages popoverpopover_menus.register_popover_menu(".starred-messages-sidebar-menu-icon", {@@ -97,7 +114,15 @@ export function initialize() {},onShow(instance) {popovers.hide_all();- instance.setContent(parse_html(render_left_sidebar_inbox_popover()));+ const view_code = settings_config.default_view_values.inbox.code;+ instance.setContent(+ parse_html(+ render_left_sidebar_inbox_popover({+ is_default_view: user_settings.default_view === view_code,+ view_code,+ }),+ ),+ );},onHidden(instance) {instance.destroy();@@ -135,4 +160,6 @@ export function initialize() {popover_menus.popover_instances.top_left_sidebar = undefined;},});++ common_click_handlers();}diff --git a/web/templates/popovers/left_sidebar_inbox_popover.hbs b/web/templates/popovers/left_sidebar_inbox_popover.hbsindex 0a34f5eb290..e458506dc23 100644--- a/web/templates/popovers/left_sidebar_inbox_popover.hbs+++ b/web/templates/popovers/left_sidebar_inbox_popover.hbs@@ -1,4 +1,3 @@-{{! Contents of the "all messages sidebar" popup }}<ul class="nav nav-list"><li>{{! tabindex="0" Makes anchor tag focusable. Needed for keyboard support. }}@@ -7,4 +6,12 @@{{t "Mark all messages as read" }}</a></li>+ {{#unless is_default_view}}+ <li>+ <a tabindex="0" class="set-default-view" data-view-code="{{view_code}}">+ <i class="fa fa-home" aria-hidden="true"></i>+ {{t "Make inbox my home view" }}+ </a>+ </li>+ {{/unless}}</ul>