fix: delete private workspace from my workspaces as well

This commit is contained in:
sokumon 2025-11-14 09:43:38 +05:30
parent f49d7cf53c
commit 86d8a3d9b9
3 changed files with 10 additions and 2 deletions

View file

@ -40,7 +40,7 @@ describe(
() => {
before(() => {
cy.login();
cy.visit(`/app/note/new`);
cy.visit(`/desk/note/new`);
// close the sidebar cause default is expanded
cy.get(".body-sidebar .collapse-sidebar-link").click();
});

View file

@ -12,7 +12,7 @@ context("Workspace 2.0", () => {
});
it("Create Private Page", () => {
cy.visit("/desk/build");
cy.visit("/desk/website");
cy.intercept({
method: "POST",
url: "api/method/frappe.desk.doctype.workspace.workspace.new_page",

View file

@ -127,6 +127,14 @@ class Workspace(Document):
def on_trash(self):
if self.public and not is_workspace_manager():
frappe.throw(_("You need to be Workspace Manager to delete a public workspace."))
self.delete_from_my_workspaces()
def delete_from_my_workspaces(self):
if not self.public:
my_workspaces = frappe.get_doc("Workspace Sidebar", "My Workspaces")
for w in my_workspaces.items:
if self.name == w.link_to:
frappe.delete_doc("Workspace Sidebar Item", w.name)
def after_delete(self):
if disable_saving_as_public():