fix: delete private workspace from my workspaces as well
This commit is contained in:
parent
f49d7cf53c
commit
86d8a3d9b9
3 changed files with 10 additions and 2 deletions
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue