fix: route correctly from desktop

This commit is contained in:
sokumon 2026-02-17 02:12:28 +05:30
parent 91a41c921a
commit 6001c89faa
3 changed files with 16 additions and 9 deletions

View file

@ -68,15 +68,15 @@ function get_route(desktop_icon) {
} else if (first_link.link_type == "Workspace") {
let workspaces = frappe.workspaces[frappe.router.slug(first_link.link_to)];
if (workspaces) {
if (workspaces.public) {
route = "/desk/" + frappe.router.slug(first_link.link_to);
} else {
route = "/desk/private/" + frappe.router.slug(workspaces.title);
}
}
if (first_link.route) {
route = first_link.route;
let args = {
type: "workspace",
name: first_link.link_to,
public: workspaces.public ? 1 : 0,
route_options: {
sidebar: desktop_icon.label,
},
};
route = frappe.utils.generate_route(args);
}
} else if (first_link.link_type === "URL") {
route = first_link.url;

View file

@ -135,6 +135,7 @@ frappe.ui.Sidebar = class Sidebar {
frappe.router.on("change", function (router) {
if (frappe.route_options.sidebar) {
frappe.app.sidebar.setup(frappe.route_options.sidebar);
frappe.route_options = null;
} else {
frappe.app.sidebar.set_workspace_sidebar(router);
}

View file

@ -1583,6 +1583,12 @@ Object.assign(frappe.utils, {
route = item.name;
} else if (type === "dashboard") {
route = `dashboard-view/${item.name}`;
} else if (type == "workspace") {
if (item.public) {
route = frappe.router.slug(item.name);
} else {
route = "private/" + frappe.router.slug(item.name);
}
}
} else {
route = item.route;