diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js index 5422804a94..925fdae84b 100644 --- a/frappe/public/js/frappe/list/list_sidebar.js +++ b/frappe/public/js/frappe/list/list_sidebar.js @@ -50,7 +50,7 @@ frappe.views.ListSidebar = Class.extend({ this.current_view = 'List'; var route = frappe.get_route(); - if(route.length > 2 && in_list(['Gantt', 'Image', 'Kanban', 'Calendar', 'Inbox'], route[2])) { + if(route.length > 2 && frappe.views.view_modes.includes(route[2])) { this.current_view = route[2]; if(this.current_view === 'Kanban') { diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index 657daa1033..39486fadbb 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -116,6 +116,8 @@ frappe.views.set_list_as_dirty = function (doctype) { } } +frappe.views.view_modes = ['List', 'Gantt', 'Kanban', 'Calendar', 'Image', 'Inbox']; + frappe.views.ListView = frappe.ui.BaseList.extend({ init: function (opts) { $.extend(this, opts); @@ -453,7 +455,8 @@ frappe.views.ListView = frappe.ui.BaseList.extend({ } // save last view - if (user_settings_common.last_view !== this.current_view) { + if (user_settings_common.last_view !== this.current_view + && frappe.views.view_modes.includes(this.current_view)) { user_settings_common.last_view = this.current_view; different = true; } @@ -489,7 +492,7 @@ frappe.views.ListView = frappe.ui.BaseList.extend({ if (!this.list_renderer.settings.use_route) { var route = frappe.get_route(); - if (route[2] && !in_list(['List', 'Image', 'Gantt', 'Kanban', 'Calendar', 'Inbox'], route[2])) { + if (route[2] && !frappe.views.view_modes.includes(route[2])) { $.each(frappe.utils.get_args_dict_from_url(route[2]), function (key, val) { me.set_filter(key, val, true); });