settings: Rename default_view and escape_navigates_to_default_view.

This commit renames default_view and escape_navigates_to_default_view
settings to web_home_view and web_escape_navigates_to_home_view in
database and API to match with our recent renaming of user facing
strings related to this.

We also rename the variables, functions, comments in code and class
names and IDs for elements related to this.
This commit is contained in:
Sahil Batra 2023-10-23 12:32:57 +05:30 committed by Tim Abbott
parent 67dbaaff91
commit c9fccf476a
38 changed files with 235 additions and 171 deletions

View File

@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 8.0
**Feature level 219**
* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults)
[`POST /register`](/api/register-queue), [`GET /events`](/api/get-events),
[`PATCH /settings`](/api/update-settings): Renamed `default_view` and
`escape_navigates_to_default_view` settings to `web_home_view` and
`web_escape_navigates_to_home_view` respectively.
**Feature level 218**
* [`POST /messages`](/api/send-message): Added an optional

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.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 = 218
API_FEATURE_LEVEL = 219
# 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. Bump

View File

@ -184,7 +184,7 @@ export function build_page() {
web_stream_unreads_count_display_policy_values:
settings_config.web_stream_unreads_count_display_policy_values,
color_scheme_values: settings_config.color_scheme_values,
default_view_values: settings_config.default_view_values,
web_home_view_values: settings_config.web_home_view_values,
settings_object: realm_user_settings_defaults,
display_settings: settings_config.get_all_display_settings(),
settings_label: settings_config.realm_user_settings_defaults_labels,

View File

@ -82,7 +82,7 @@ export function update(new_hash: string): void {
export function exit_overlay(): void {
if (hash_parser.is_overlay_hash(window.location.hash) && !state.changing_hash) {
ui_util.blur_active_element();
const new_hash = state.hash_before_overlay || `#${user_settings.default_view}`;
const new_hash = state.hash_before_overlay || `#${user_settings.web_home_view}`;
update(new_hash);
}
}
@ -100,7 +100,7 @@ export function update_hash_internally_if_required(hash: string): void {
}
export function return_to_web_public_hash(): void {
window.location.hash = state.spectator_old_hash ?? `#${user_settings.default_view}`;
window.location.hash = state.spectator_old_hash ?? `#${user_settings.web_home_view}`;
}
export function get_full_url(hash: string): string {
@ -146,7 +146,7 @@ export function set_hash(hash: string): void {
// TODO: Delete this case if we don't see any error reports in a while.
if (hash === "" || hash === "#") {
// Setting empty hash here would scroll to the top.
hash = user_settings.default_view;
hash = user_settings.web_home_view;
}
blueslip.error("browser does not support pushState");

View File

@ -787,7 +787,7 @@ export function initialize() {
e.preventDefault();
e.stopPropagation();
hashchange.set_hash_to_default_view();
hashchange.set_hash_to_home_view();
});
// MAIN CLICK HANDLER

View File

@ -61,13 +61,13 @@ function show_all_message_view() {
setTimeout(message_viewport.maybe_scroll_to_selected, 0);
}
export function set_hash_to_default_view() {
let default_view_hash = `#${user_settings.default_view}`;
if (default_view_hash === "#recent_topics") {
default_view_hash = "#recent";
export function set_hash_to_home_view() {
let home_view_hash = `#${user_settings.web_home_view}`;
if (home_view_hash === "#recent_topics") {
home_view_hash = "#recent";
}
if (window.location.hash !== default_view_hash) {
if (window.location.hash !== home_view_hash) {
// We want to set URL with no hash here. It is not possible
// to do so with `window.location.hash` since it will set an empty
// hash. So, we use `pushState` which simply updates the current URL
@ -83,14 +83,14 @@ function hide_non_message_list_views() {
maybe_hide_recent_view();
}
function show_default_view() {
function show_home_view() {
hide_non_message_list_views();
// This function should only be called from the hashchange
// handlers, as it does not set the hash to "".
//
// We only allow the primary recommended options for default views
// We only allow the primary recommended options for home views
// rendered without a hash.
switch (user_settings.default_view) {
switch (user_settings.web_home_view) {
case "recent_topics": {
recent_view_ui.show();
break;
@ -110,7 +110,7 @@ function show_default_view() {
// 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;
window.location.hash = user_settings.web_home_view;
}
}
}
@ -141,11 +141,11 @@ function do_hashchange_normal(from_reload) {
}
if (operators === undefined) {
// If the narrow URL didn't parse,
// send them to default_view.
// send them to web_home_view.
// We cannot clear hash here since
// it will block user from going back
// in browser history.
show_default_view();
show_home_view();
return false;
}
const narrow_opts = {
@ -171,7 +171,7 @@ function do_hashchange_normal(from_reload) {
}
case "":
case "#":
show_default_view();
show_home_view();
break;
case "#recent_topics":
// The URL for Recent Conversations was changed from
@ -208,7 +208,7 @@ function do_hashchange_normal(from_reload) {
blueslip.error("overlay logic skipped for: " + hash);
break;
default:
show_default_view();
show_home_view();
}
return false;
}
@ -216,8 +216,8 @@ function do_hashchange_normal(from_reload) {
function do_hashchange_overlay(old_hash) {
if (old_hash === undefined) {
// The user opened the app with an overlay hash; we need to
// show the user's default view behind it.
show_default_view();
// show the user's home view behind it.
show_home_view();
}
const base = hash_parser.get_current_hash_category();
const old_base = hash_parser.get_hash_category(old_hash);
@ -225,7 +225,7 @@ function do_hashchange_overlay(old_hash) {
if (base === "groups" && (!page_params.development_environment || page_params.is_guest)) {
// The #groups settings page is unfinished, and disabled in production.
show_default_view();
show_home_view();
return;
}

View File

@ -350,10 +350,10 @@ export function process_escape_key(e) {
return true;
}
/* The Ctrl+[ hotkey navigates to the default view
/* The Ctrl+[ hotkey navigates to the home view
* unconditionally; Esc's behavior depends on a setting. */
if (user_settings.escape_navigates_to_default_view || e.which === 219) {
hashchange.set_hash_to_default_view();
if (user_settings.web_escape_navigates_to_home_view || e.which === 219) {
hashchange.set_hash_to_home_view();
return true;
}

View File

@ -294,9 +294,9 @@ export function set_up_toggler() {
$(".informational-overlays .overlay-tabs").append($elem);
$("#go-to-default-view-hotkey-help").toggleClass(
$("#go-to-home-view-hotkey-help").toggleClass(
"notdisplayed",
!user_settings.escape_navigates_to_default_view,
!user_settings.web_escape_navigates_to_home_view,
);
common.adjust_mac_kbd_tags(".hotkeys_table .hotkey kbd");
common.adjust_mac_kbd_tags("#markdown-instructions kbd");

View File

@ -142,17 +142,17 @@ export function highlight_inbox_view() {
}, 0);
}
export function handle_home_view_changed(new_default_view) {
export function handle_home_view_changed(new_home_view) {
const $recent_view_sidebar_menu_icon = $(".recent-view-sidebar-menu-icon");
const $all_messages_sidebar_menu_icon = $(".all-messages-sidebar-menu-icon");
if (new_default_view === settings_config.default_view_values.all_messages.code) {
if (new_home_view === settings_config.web_home_view_values.all_messages.code) {
$recent_view_sidebar_menu_icon.removeClass("hide");
$all_messages_sidebar_menu_icon.addClass("hide");
} else if (new_default_view === settings_config.default_view_values.recent_topics.code) {
} else if (new_home_view === settings_config.web_home_view_values.recent_topics.code) {
$recent_view_sidebar_menu_icon.addClass("hide");
$all_messages_sidebar_menu_icon.removeClass("hide");
} else {
// Inbox is default view.
// Inbox is home view.
$recent_view_sidebar_menu_icon.removeClass("hide");
$all_messages_sidebar_menu_icon.removeClass("hide");
}

View File

@ -20,12 +20,12 @@ import * as unread_ops from "./unread_ops";
import {user_settings} from "./user_settings";
function common_click_handlers() {
$("body").on("click", ".set-default-view", (e) => {
$("body").on("click", ".set-home-view", (e) => {
e.preventDefault();
e.preventDefault();
const default_view = $(e.currentTarget).attr("data-view-code");
const data = {default_view};
const web_home_view = $(e.currentTarget).attr("data-view-code");
const data = {web_home_view};
channel.patch({
url: "/json/settings",
data,
@ -116,11 +116,11 @@ export function initialize() {
},
onShow(instance) {
popovers.hide_all();
const view_code = settings_config.default_view_values.inbox.code;
const view_code = settings_config.web_home_view_values.inbox.code;
instance.setContent(
parse_html(
render_left_sidebar_inbox_popover({
is_default_view: user_settings.default_view === view_code,
is_home_view: user_settings.web_home_view === view_code,
view_code,
}),
),
@ -138,11 +138,11 @@ export function initialize() {
onShow(instance) {
popover_menus.popover_instances.left_sidebar_all_messages_popover = instance;
popovers.hide_all();
const view_code = settings_config.default_view_values.all_messages.code;
const view_code = settings_config.web_home_view_values.all_messages.code;
instance.setContent(
parse_html(
render_left_sidebar_all_messages_popover({
is_default_view: user_settings.default_view === view_code,
is_home_view: user_settings.web_home_view === view_code,
view_code,
}),
),
@ -160,11 +160,11 @@ export function initialize() {
onShow(instance) {
popover_menus.popover_instances.left_sidebar_recent_view_popover = instance;
popovers.hide_all();
const view_code = settings_config.default_view_values.recent_topics.code;
const view_code = settings_config.web_home_view_values.recent_topics.code;
instance.setContent(
parse_html(
render_left_sidebar_recent_view_popover({
is_default_view: user_settings.default_view === view_code,
is_home_view: user_settings.web_home_view === view_code,
view_code,
}),
),

View File

@ -1,7 +1,7 @@
export type RealmDefaultSettings = {
color_scheme: number;
default_language: string;
default_view: string;
web_home_view: string;
desktop_icon_count_display: number;
demote_inactive_streams: number;
dense_mode: boolean;
@ -27,7 +27,7 @@ export type RealmDefaultSettings = {
enable_followed_topic_email_notifications: boolean;
enable_followed_topic_wildcard_mentions_notify: boolean;
enter_sends: boolean;
escape_navigates_to_default_view: boolean;
web_escape_navigates_to_home_view: boolean;
fluid_layout_width: boolean;
high_contrast_mode: boolean;
message_content_in_email_notifications: boolean;

View File

@ -688,12 +688,12 @@ export function dispatch_normal_event(event) {
const user_display_settings = [
"color_scheme",
"default_language",
"default_view",
"web_home_view",
"demote_inactive_streams",
"dense_mode",
"web_mark_read_on_scroll_policy",
"emojiset",
"escape_navigates_to_default_view",
"web_escape_navigates_to_home_view",
"fluid_layout_width",
"high_contrast_mode",
"timezone",
@ -708,7 +708,7 @@ export function dispatch_normal_event(event) {
"send_read_receipts",
];
const original_default_view = user_settings.default_view;
const original_home_view = user_settings.web_home_view;
if (user_display_settings.includes(event.property)) {
user_settings[event.property] = event.value;
}
@ -721,21 +721,19 @@ export function dispatch_normal_event(event) {
// present in the backend/Jinja2 templates.
settings_display.set_default_language_name(event.language_name);
}
if (event.property === "default_view") {
if (event.property === "web_home_view") {
left_sidebar_navigation_area.handle_home_view_changed(event.value);
// If current hash is empty (default view), and the
// user changes the default view while in settings,
// If current hash is empty (home view), and the
// user changes the home view while in settings,
// then going back to an empty hash on closing the
// overlay will not match the view currently displayed
// under settings, so we set the hash to the previous
// value of the default view.
// value of the home view.
if (!browser_history.state.hash_before_overlay && overlays.settings_open()) {
browser_history.state.hash_before_overlay =
"#" +
(original_default_view === "recent_topics"
? "recent"
: original_default_view);
(original_home_view === "recent_topics" ? "recent" : original_home_view);
}
}
if (event.property === "twenty_four_hour_time") {
@ -809,8 +807,8 @@ export function dispatch_normal_event(event) {
if (event.property === "display_emoji_reaction_users") {
message_live_update.rerender_messages_view();
}
if (event.property === "escape_navigates_to_default_view") {
$("#go-to-default-view-hotkey-help").toggleClass("notdisplayed", !event.value);
if (event.property === "web_escape_navigates_to_home_view") {
$("#go-to-home-view-hotkey-help").toggleClass("notdisplayed", !event.value);
}
if (event.property === "enter_sends") {
user_settings.enter_sends = event.value;

View File

@ -123,7 +123,7 @@ export function build_page() {
web_stream_unreads_count_display_policy_values:
settings_config.web_stream_unreads_count_display_policy_values,
color_scheme_values: settings_config.color_scheme_values,
default_view_values: settings_config.default_view_values,
web_home_view_values: settings_config.web_home_view_values,
twenty_four_hour_time_values: settings_config.twenty_four_hour_time_values,
general_settings: settings_config.all_notifications(user_settings).general_settings,
notification_settings: settings_config.all_notifications(user_settings).settings,

View File

@ -87,7 +87,7 @@ export const web_stream_unreads_count_display_policy_values = {
},
};
export const default_view_values = {
export const web_home_view_values = {
inbox: {
code: "inbox",
description: $t({defaultMessage: "Inbox"}),
@ -553,7 +553,7 @@ export const display_settings_labels = {
"Display names of reacting users when few users have reacted to a message",
}),
),
escape_navigates_to_default_view: $t({defaultMessage: "Escape key navigates to home view"}),
web_escape_navigates_to_home_view: $t({defaultMessage: "Escape key navigates to home view"}),
default_language_settings_label: $t({defaultMessage: "Language"}),
};

View File

@ -166,7 +166,7 @@ export function set_up(settings_panel) {
.find(".setting_demote_inactive_streams")
.val(settings_object.demote_inactive_streams);
$container.find(".setting_color_scheme").val(settings_object.color_scheme);
$container.find(".setting_default_view").val(settings_object.default_view);
$container.find(".setting_web_home_view").val(settings_object.web_home_view);
$container
.find(".setting_twenty_four_hour_time")
.val(JSON.stringify(settings_object.twenty_four_hour_time));

View File

@ -149,7 +149,7 @@ export function initialize() {
appendTo: () => document.body,
onShow(instance) {
const $container = instance.popper.querySelector(".views-tooltip-container");
if ($($container).data("view-code") === user_settings.default_view) {
if ($($container).data("view-code") === user_settings.web_home_view) {
$($container).find(".views-tooltip-home-view-note").removeClass("hide");
}
},

View File

@ -164,10 +164,10 @@ function initialize_left_sidebar() {
const rendered_sidebar = render_left_sidebar({
is_guest: page_params.is_guest,
development_environment: page_params.development_environment,
is_all_messages_default_view:
user_settings.default_view === settings_config.default_view_values.all_messages.code,
is_recent_view_default_view:
user_settings.default_view === settings_config.default_view_values.recent_topics.code,
is_all_messages_home_view:
user_settings.web_home_view === settings_config.web_home_view_values.all_messages.code,
is_recent_view_home_view:
user_settings.web_home_view === settings_config.web_home_view_values.recent_topics.code,
});
$("#left-sidebar-container").html(rendered_sidebar);

View File

@ -26,7 +26,7 @@ export type UserSettings = (StreamNotificationSettings &
FollowedTopicNotificationSettings) & {
color_scheme: number;
default_language: string;
default_view: string;
web_home_view: string;
desktop_icon_count_display: number;
demote_inactive_streams: number;
dense_mode: boolean;
@ -39,7 +39,7 @@ export type UserSettings = (StreamNotificationSettings &
enable_marketing_emails: boolean;
enable_online_push_notifications: boolean;
enter_sends: boolean;
escape_navigates_to_default_view: boolean;
web_escape_navigates_to_home_view: boolean;
fluid_layout_width: boolean;
high_contrast_mode: boolean;
message_content_in_email_notifications: boolean;

View File

@ -54,7 +54,7 @@
</tr>
<tr>
<td class="definition">{{t 'Go to home view' }}</td>
<td><span class="hotkey"><kbd>Ctrl</kbd> + <kbd>[</kbd><span id="go-to-default-view-hotkey-help"> or <kbd>Esc</kbd></span></span></td>
<td><span class="hotkey"><kbd>Ctrl</kbd> + <kbd>[</kbd><span id="go-to-home-view-hotkey-help"> or <kbd>Esc</kbd></span></span></td>
</tr>
</table>
</div>

View File

@ -68,7 +68,7 @@
{{~!-- squash whitespace --~}}
<span class="left-sidebar-navigation-label">{{t 'Recent conversations' }}</span>
</a>
<span class="arrow sidebar-menu-icon recent-view-sidebar-menu-icon hidden-for-spectators {{#if is_recent_view_default_view}}hide{{/if}}">
<span class="arrow sidebar-menu-icon recent-view-sidebar-menu-icon hidden-for-spectators {{#if is_recent_view_home_view}}hide{{/if}}">
<i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i>
</span>
</li>
@ -80,7 +80,7 @@
{{~!-- squash whitespace --~}}
<span class="left-sidebar-navigation-label">{{t 'All messages' }}</span>
</a>
<span class="arrow sidebar-menu-icon all-messages-sidebar-menu-icon hidden-for-spectators {{#if is_all_messages_default_view}}hide{{/if}}">
<span class="arrow sidebar-menu-icon all-messages-sidebar-menu-icon hidden-for-spectators {{#if is_all_messages_home_view}}hide{{/if}}">
<i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i>
</span>
</li>

View File

@ -1,6 +1,6 @@
<ul class="nav nav-list">
<li>
<a tabindex="0" class="set-default-view" data-view-code="{{view_code}}">
<a tabindex="0" class="set-home-view" data-view-code="{{view_code}}">
<i class="fa fa-home" aria-hidden="true"></i>
{{#tr}}
Make <b>all messages</b> my home view

View File

@ -6,9 +6,9 @@
{{t "Mark all messages as read" }}
</a>
</li>
{{#unless is_default_view}}
{{#unless is_home_view}}
<li>
<a tabindex="0" class="set-default-view" data-view-code="{{view_code}}">
<a tabindex="0" class="set-home-view" data-view-code="{{view_code}}">
<i class="fa fa-home" aria-hidden="true"></i>
{{#tr}}
Make <b>inbox</b> my home view

View File

@ -1,6 +1,6 @@
<ul class="nav nav-list">
<li>
<a tabindex="0" class="set-default-view" data-view-code="{{view_code}}">
<a tabindex="0" class="set-home-view" data-view-code="{{view_code}}">
<i class="fa fa-home" aria-hidden="true"></i>
{{#tr}}
Make <b>recent conversation</b> my home view

View File

@ -125,18 +125,18 @@
</div>
<div class="input-group thinner setting-next-is-related">
<label for="default_view" class="dropdown-title">{{t "Home view" }}
<label for="web_home_view" class="dropdown-title">{{t "Home view" }}
{{> ../help_link_widget link="/help/configure-home-view" }}
</label>
<select name="default_view" class="setting_default_view prop-element settings_select bootstrap-focus-style" id="{{prefix}}default_view" data-setting-widget-type="string">
{{> dropdown_options_widget option_values=default_view_values}}
<select name="web_home_view" class="setting_web_home_view prop-element settings_select bootstrap-focus-style" id="{{prefix}}web_home_view" data-setting-widget-type="string">
{{> dropdown_options_widget option_values=web_home_view_values}}
</select>
</div>
{{> settings_checkbox
setting_name="escape_navigates_to_default_view"
is_checked=settings_object.escape_navigates_to_default_view
label=settings_label.escape_navigates_to_default_view
setting_name="web_escape_navigates_to_home_view"
is_checked=settings_object.web_escape_navigates_to_home_view
label=settings_label.web_escape_navigates_to_home_view
prefix=prefix}}
<div class="input-group">

View File

@ -14,7 +14,7 @@ const browser_history = zrequire("browser_history");
function test(label, f) {
run_test(label, (...args) => {
user_settings.default_view = "recent";
user_settings.web_home_view = "recent";
window.location.hash = "#bogus";
browser_history.clear_for_testing();
f(...args);

View File

@ -867,14 +867,14 @@ run_test("user_settings", ({override}) => {
dispatch(event);
assert_same(user_settings.default_language, "fr");
event = event_fixtures.user_settings__escape_navigates_to_default_view;
user_settings.escape_navigates_to_default_view = false;
event = event_fixtures.user_settings__web_escape_navigates_to_home_view;
user_settings.web_escape_navigates_to_home_view = false;
let toggled = [];
$("#go-to-default-view-hotkey-help").toggleClass = (cls) => {
$("#go-to-home-view-hotkey-help").toggleClass = (cls) => {
toggled.push(cls);
};
dispatch(event);
assert_same(user_settings.escape_navigates_to_default_view, true);
assert_same(user_settings.web_escape_navigates_to_home_view, true);
assert_same(toggled, ["notdisplayed"]);
let called = false;
@ -945,24 +945,24 @@ run_test("user_settings", ({override}) => {
}
{
event = event_fixtures.user_settings__default_view_recent_topics;
user_settings.default_view = "all_messages";
event = event_fixtures.user_settings__web_home_view_recent_topics;
user_settings.web_home_view = "all_messages";
dispatch(event);
assert.equal(user_settings.default_view, "recent_topics");
assert.equal(user_settings.web_home_view, "recent_topics");
}
{
event = event_fixtures.user_settings__default_view_all_messages;
user_settings.default_view = "recent_topics";
event = event_fixtures.user_settings__web_home_view_all_messages;
user_settings.web_home_view = "recent_topics";
dispatch(event);
assert.equal(user_settings.default_view, "all_messages");
assert.equal(user_settings.web_home_view, "all_messages");
}
{
event = event_fixtures.user_settings__default_view_inbox;
user_settings.default_view = "all_messages";
event = event_fixtures.user_settings__web_home_view_inbox;
user_settings.web_home_view = "all_messages";
dispatch(event);
assert.equal(user_settings.default_view, "inbox");
assert.equal(user_settings.web_home_view, "inbox");
}
{

View File

@ -166,7 +166,7 @@ function test_helper({override, override_rewire, change_tab}) {
run_test("hash_interactions", ({override, override_rewire}) => {
$window_stub = $.create("window-stub");
user_settings.default_view = "recent_topics";
user_settings.web_home_view = "recent_topics";
const helper = test_helper({override, override_rewire, change_tab: true});
@ -182,7 +182,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
browser_history.clear_for_testing();
hashchange.initialize();
// If it's an unknown hash it should show the default view.
// If it's an unknown hash it should show the home view.
assert.equal(recent_view_ui_shown, true);
assert.equal(hide_all_called, true);
helper.assert_events([
@ -273,7 +273,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
helper.clear_events();
$window_stub.trigger("hashchange");
helper.assert_events([]);
// If it's reload hash it shouldn't show the default view.
// If it's reload hash it shouldn't show the home view.
assert.equal(recent_view_ui_shown, false);
window.location.hash = "#keyboard-shortcuts/whatever";

View File

@ -913,27 +913,6 @@ exports.fixtures = {
language_name: "French",
},
user_settings__default_view_all_messages: {
type: "user_settings",
op: "update",
property: "default_view",
value: "all_messages",
},
user_settings__default_view_inbox: {
type: "user_settings",
op: "update",
property: "default_view",
value: "inbox",
},
user_settings__default_view_recent_topics: {
type: "user_settings",
op: "update",
property: "default_view",
value: "recent_topics",
},
user_settings__demote_inactive_streams: {
type: "user_settings",
op: "update",
@ -983,13 +962,6 @@ exports.fixtures = {
value: true,
},
user_settings__escape_navigates_to_default_view: {
type: "user_settings",
op: "update",
property: "escape_navigates_to_default_view",
value: true,
},
user_settings__fluid_layout_width: {
type: "user_settings",
op: "update",
@ -1053,6 +1025,34 @@ exports.fixtures = {
value: 2,
},
user_settings__web_escape_navigates_to_home_view: {
type: "user_settings",
op: "update",
property: "web_escape_navigates_to_home_view",
value: true,
},
user_settings__web_home_view_all_messages: {
type: "user_settings",
op: "update",
property: "web_home_view",
value: "all_messages",
},
user_settings__web_home_view_inbox: {
type: "user_settings",
op: "update",
property: "web_home_view",
value: "inbox",
},
user_settings__web_home_view_recent_topics: {
type: "user_settings",
op: "update",
property: "web_home_view",
value: "recent_topics",
},
user_settings__web_mark_read_on_scroll_policy: {
type: "user_settings",
op: "update",

View File

@ -0,0 +1,32 @@
# Generated by Django 4.2.6 on 2023-10-25 14:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0482_automatically_follow_unmute_topics_policy_defaults"),
]
operations = [
migrations.RenameField(
model_name="realmuserdefault",
old_name="escape_navigates_to_default_view",
new_name="web_escape_navigates_to_home_view",
),
migrations.RenameField(
model_name="realmuserdefault",
old_name="default_view",
new_name="web_home_view",
),
migrations.RenameField(
model_name="userprofile",
old_name="escape_navigates_to_default_view",
new_name="web_escape_navigates_to_home_view",
),
migrations.RenameField(
model_name="userprofile",
old_name="default_view",
new_name="web_home_view",
),
]

View File

@ -1534,8 +1534,8 @@ class UserBaseSettings(models.Model):
default_language = models.CharField(default="en", max_length=MAX_LANGUAGE_ID_LENGTH)
# This setting controls which view is rendered first when Zulip loads.
# Values for it are URL suffix after `#`.
default_view = models.TextField(default="recent_topics")
escape_navigates_to_default_view = models.BooleanField(default=True)
web_home_view = models.TextField(default="recent_topics")
web_escape_navigates_to_home_view = models.BooleanField(default=True)
dense_mode = models.BooleanField(default=True)
fluid_layout_width = models.BooleanField(default=False)
high_contrast_mode = models.BooleanField(default=False)
@ -1732,7 +1732,7 @@ class UserBaseSettings(models.Model):
# Instead, see `modern_settings` below.
color_scheme=int,
default_language=str,
default_view=str,
web_home_view=str,
demote_inactive_streams=int,
dense_mode=bool,
emojiset=str,
@ -1775,7 +1775,7 @@ class UserBaseSettings(models.Model):
# Add new general settings here.
display_emoji_reaction_users=bool,
email_address_visibility=int,
escape_navigates_to_default_view=bool,
web_escape_navigates_to_home_view=bool,
send_private_typing_notifications=bool,
send_read_receipts=bool,
send_stream_typing_notifications=bool,

View File

@ -10032,25 +10032,29 @@ paths:
schema:
type: boolean
example: false
- name: default_view
- name: web_home_view
in: query
description: |
The [default view](/help/configure-home-view) used when opening a new
The [home view](/help/configure-home-view) used when opening a new
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**: New in Zulip 8.0 (feature level 219). Previously, this was
called `default_view`, which was new in Zulip 4.0 (feature level 42).
schema:
type: string
example: all_messages
- name: escape_navigates_to_default_view
- name: web_escape_navigates_to_home_view
in: query
description: |
Whether the escape key navigates to the
[configured default view](/help/configure-home-view).
[configured home view](/help/configure-home-view).
**Changes**: New in Zulip 5.0 (feature level 107).
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this was called
`escape_navigates_to_default_view`, which was new in Zulip 5.0 (feature level 107).
schema:
type: boolean
example: true
@ -12369,22 +12373,27 @@ paths:
The value needs to be a standard language code that the Zulip server has
translation data for; for example, `"en"` for English or `"de"` for German.
default_view:
web_home_view:
type: string
description: |
The [default view](/help/configure-home-view) used when opening a new
The [home view](/help/configure-home-view) used when opening a new
Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.
- "recent_topics" - Recent conversations view
- "inbox" - Inbox view
- "all_messages" - All messages view
escape_navigates_to_default_view:
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this was
called `default_view`, which was new in Zulip 4.0 (feature level 42).
web_escape_navigates_to_home_view:
type: boolean
description: |
Whether the escape key navigates to the
[configured default view](/help/configure-home-view).
[configured home view](/help/configure-home-view).
**Changes**: New in Zulip 5.0 (feature level 107).
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this
was called `escape_navigates_to_default_view`, which was new in Zulip
5.0 (feature level 107).
left_side_userlist:
type: boolean
description: |
@ -13217,7 +13226,7 @@ paths:
client capability and access the `user_settings` object instead.
[capabilities]: /api/register-queue#parameter-client_capabilities
default_view:
web_home_view:
deprecated: true
type: string
description: |
@ -13225,7 +13234,7 @@ paths:
and only for clients that did not include `user_settings_object` in
their [`client_capabilities`][capabilities] when registering the event queue.
The [default view](/help/configure-home-view) in Zulip, represented
The [home view](/help/configure-home-view) in Zulip, represented
as the URL suffix after `#` to be rendered when Zulip loads.
Currently supported values are `all_messages` and `recent_topics`.
@ -13233,9 +13242,12 @@ paths:
See [PATCH /settings](/api/update-settings) for details on
the meaning of this setting.
**Changes**: Deprecated in Zulip 5.0 (feature level 89). Clients
connecting to newer servers should declare the `user_settings_object`
client capability and access the `user_settings` object instead.
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this was
called `default_view`, which was new in Zulip 4.0 (feature level 42).
**Deprecated** in Zulip 5.0 (feature level 89). Clients connecting to newer
servers should declare the `user_settings_object` client capability and
access the `user_settings` object instead.
[capabilities]: /api/register-queue#parameter-client_capabilities
high_contrast_mode:
@ -14562,22 +14574,27 @@ paths:
The value needs to be a standard language code that the Zulip server has
translation data for; for example, `"en"` for English or `"de"` for German.
default_view:
web_home_view:
type: string
description: |
The [default view](/help/configure-home-view) used when opening a new
The [home view](/help/configure-home-view) used when opening a new
Zulip web app window or hitting the `Esc` keyboard shortcut repeatedly.
- "recent_topics" - Recent conversations view
- "inbox" - Inbox view
- "all_messages" - All messages view
escape_navigates_to_default_view:
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this was
called `default_view`, which was new in Zulip 4.0 (feature level 42).
web_escape_navigates_to_home_view:
type: boolean
description: |
Whether the escape key navigates to the
[configured default view](/help/configure-home-view).
[configured home view](/help/configure-home-view).
**Changes**: New in Zulip 5.0 (feature level 107).
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this
was called `escape_navigates_to_default_view`, which was new in Zulip
5.0 (feature level 107).
left_side_userlist:
type: boolean
description: |
@ -15627,30 +15644,35 @@ paths:
schema:
type: string
example: en
- name: default_view
- name: web_home_view
in: query
description: |
The [default view](/help/configure-home-view) used when opening a new
The [home view](/help/configure-home-view) used when opening a new
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 by
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this was
called `default_view`, which was new in Zulip 4.0 (feature level 42).
Before Zulip 5.0 (feature level 80), this setting was managed by
the `PATCH /settings/display` endpoint.
Unnecessary JSON-encoding of this parameter was removed in Zulip 4.0 (feature level 64).
schema:
type: string
example: all_messages
- name: escape_navigates_to_default_view
- name: web_escape_navigates_to_home_view
in: query
description: |
Whether the escape key navigates to the
[configured default view](/help/configure-home-view).
[configured home view](/help/configure-home-view).
**Changes**: New in Zulip 5.0 (feature level 107).
**Changes**: New in Zulip 8.0 (feature level 219). Previously, this
was called `escape_navigates_to_default_view`, which was new in Zulip
5.0 (feature level 107).
schema:
type: boolean
example: true

View File

@ -746,7 +746,7 @@ class TestRealmAuditLog(ZulipTestCase):
value: Union[bool, int, str]
test_values = dict(
default_language="de",
default_view="all_messages",
web_home_view="all_messages",
emojiset="twitter",
notification_sound="ding",
)

View File

@ -3132,7 +3132,7 @@ class NormalActionsTest(BaseAction):
events = self.verify_action(
lambda: do_change_user_setting(
self.user_profile,
"default_view",
"web_home_view",
"all_messages",
acting_user=self.user_profile,
),
@ -3334,7 +3334,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", "inbox", "all_messages"],
web_home_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,
@ -3417,7 +3417,7 @@ class UserDisplayActionTest(BaseAction):
test_changes: Dict[str, Any] = dict(
emojiset=["twitter"],
default_language=["es", "de", "en"],
default_view=["all_messages", "inbox", "recent_topics"],
web_home_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],

View File

@ -1336,7 +1336,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", "inbox", "all_messages"],
web_home_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,

View File

@ -349,7 +349,7 @@ class ChangeSettingsTest(ZulipTestCase):
def do_test_change_user_setting(self, setting_name: str) -> None:
test_changes: Dict[str, Any] = dict(
default_language="de",
default_view="all_messages",
web_home_view="all_messages",
emojiset="google",
timezone="America/Denver",
demote_inactive_streams=2,
@ -400,7 +400,7 @@ class ChangeSettingsTest(ZulipTestCase):
def test_invalid_setting_value(self) -> None:
invalid_values_dict = dict(
default_language="invalid_de",
default_view="invalid_view",
web_home_view="invalid_view",
emojiset="apple",
timezone="invalid_US/Mountain",
demote_inactive_streams=10,

View File

@ -1212,7 +1212,7 @@ class UserProfileTest(ZulipTestCase):
hamlet = self.example_user("hamlet")
do_change_user_setting(cordelia, "default_language", "de", acting_user=None)
do_change_user_setting(cordelia, "default_view", "all_messages", acting_user=None)
do_change_user_setting(cordelia, "web_home_view", "all_messages", acting_user=None)
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(
@ -1284,7 +1284,7 @@ class UserProfileTest(ZulipTestCase):
realm = get_realm("zulip")
realm_user_default = RealmUserDefault.objects.get(realm=realm)
realm_user_default.default_view = "recent_topics"
realm_user_default.web_home_view = "recent_topics"
realm_user_default.emojiset = "twitter"
realm_user_default.color_scheme = UserProfile.COLOR_SCHEME_LIGHT
realm_user_default.enable_offline_email_notifications = False
@ -1299,7 +1299,7 @@ class UserProfileTest(ZulipTestCase):
with self.capture_send_event_calls(expected_num_events=0):
copy_default_settings(realm_user_default, cordelia)
self.assertEqual(cordelia.default_view, "recent_topics")
self.assertEqual(cordelia.web_home_view, "recent_topics")
self.assertEqual(cordelia.emojiset, "twitter")
self.assertEqual(cordelia.color_scheme, UserProfile.COLOR_SCHEME_LIGHT)
self.assertEqual(cordelia.enable_offline_email_notifications, False)

View File

@ -465,7 +465,7 @@ def realm_reactivation(request: HttpRequest, confirmation_key: str) -> HttpRespo
emojiset_choices = {emojiset["key"] for emojiset in RealmUserDefault.emojiset_choices()}
default_view_options = ["recent_topics", "inbox", "all_messages"]
web_home_view_options = ["recent_topics", "inbox", "all_messages"]
@require_realm_admin
@ -490,10 +490,12 @@ def update_realm_user_settings_defaults(
),
translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None),
display_emoji_reaction_users: Optional[bool] = REQ(json_validator=check_bool, default=None),
default_view: Optional[str] = REQ(
str_validator=check_string_in(default_view_options), default=None
web_home_view: Optional[str] = REQ(
str_validator=check_string_in(web_home_view_options), default=None
),
web_escape_navigates_to_home_view: Optional[bool] = REQ(
json_validator=check_bool, default=None
),
escape_navigates_to_default_view: Optional[bool] = REQ(json_validator=check_bool, default=None),
left_side_userlist: Optional[bool] = REQ(json_validator=check_bool, default=None),
emojiset: Optional[str] = REQ(str_validator=check_string_in(emojiset_choices), default=None),
demote_inactive_streams: Optional[int] = REQ(

View File

@ -127,7 +127,7 @@ def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpRes
emojiset_choices = {emojiset["key"] for emojiset in UserProfile.emojiset_choices()}
default_view_options = ["recent_topics", "inbox", "all_messages"]
web_home_view_options = ["recent_topics", "inbox", "all_messages"]
def check_settings_values(
@ -188,10 +188,12 @@ def json_change_settings(
translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None),
display_emoji_reaction_users: Optional[bool] = REQ(json_validator=check_bool, default=None),
default_language: Optional[str] = REQ(default=None),
default_view: Optional[str] = REQ(
str_validator=check_string_in(default_view_options), default=None
web_home_view: Optional[str] = REQ(
str_validator=check_string_in(web_home_view_options), default=None
),
web_escape_navigates_to_home_view: Optional[bool] = REQ(
json_validator=check_bool, default=None
),
escape_navigates_to_default_view: Optional[bool] = REQ(json_validator=check_bool, default=None),
left_side_userlist: Optional[bool] = REQ(json_validator=check_bool, default=None),
emojiset: Optional[str] = REQ(str_validator=check_string_in(emojiset_choices), default=None),
demote_inactive_streams: Optional[int] = REQ(