mirror of
https://github.com/penpot/penpot.git
synced 2025-04-05 19:41:27 -05:00
🐛 Fix team doesn't disappear after deletion (#5832)
This commit is contained in:
parent
8fe1271690
commit
6b26adb187
5 changed files with 91 additions and 1 deletions
1
frontend/playwright/data/dashboard/delete-team.json
Normal file
1
frontend/playwright/data/dashboard/delete-team.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -0,0 +1,48 @@
|
|||
[
|
||||
{
|
||||
"~:features": {
|
||||
"~#set": [
|
||||
"layout/grid",
|
||||
"styles/v2",
|
||||
"fdata/pointer-map",
|
||||
"fdata/objects-map",
|
||||
"components/v2",
|
||||
"fdata/shape-data-type"
|
||||
]
|
||||
},
|
||||
"~:permissions": {
|
||||
"~:type": "~:membership",
|
||||
"~:is-owner": true,
|
||||
"~:is-admin": true,
|
||||
"~:can-edit": true
|
||||
},
|
||||
"~:name": "Default",
|
||||
"~:modified-at": "~m1713533116375",
|
||||
"~:id": "~uc7ce0794-0992-8105-8004-38e630f40f6d",
|
||||
"~:created-at": "~m1713533116375",
|
||||
"~:is-default": true
|
||||
},
|
||||
{
|
||||
"~:features": {
|
||||
"~#set": [
|
||||
"layout/grid",
|
||||
"styles/v2",
|
||||
"fdata/pointer-map",
|
||||
"fdata/objects-map",
|
||||
"components/v2",
|
||||
"fdata/shape-data-type"
|
||||
]
|
||||
},
|
||||
"~:permissions": {
|
||||
"~:type": "~:membership",
|
||||
"~:is-owner": true,
|
||||
"~:is-admin": true,
|
||||
"~:can-edit": true
|
||||
},
|
||||
"~:name": "Second team",
|
||||
"~:modified-at": "~m1701164272671",
|
||||
"~:id": "~udd33ff88-f4e5-8033-8003-8096cc07bdf3",
|
||||
"~:created-at": "~m1701164272671",
|
||||
"~:is-default": false
|
||||
}
|
||||
]
|
|
@ -155,6 +155,9 @@ export class DashboardPage extends BaseWebSocketPage {
|
|||
await this.mockRPC("search-files", "dashboard/search-files.json", {
|
||||
method: "POST",
|
||||
});
|
||||
await this.mockRPC("delete-team", "dashboard/delete-team.json", {
|
||||
method: "POST",
|
||||
});
|
||||
await this.mockRPC("search-files", "dashboard/search-files.json");
|
||||
await this.mockRPC("get-teams", "logged-in-user/get-teams-complete.json");
|
||||
}
|
||||
|
|
|
@ -158,3 +158,31 @@ test("Bug 9927, Don't show the banner to invite team members if the user has dis
|
|||
await expect(page.getByText("Second team")).toBeVisible();
|
||||
await expect(page.getByText("Team Up")).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("Bug 10141, The team does not disappear from the team list after deletion", async ({
|
||||
page,
|
||||
}) => {
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
await dashboardPage.setupDashboardFull();
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
"logged-in-user/get-teams-complete-owner.json",
|
||||
);
|
||||
await dashboardPage.goToDashboard();
|
||||
await dashboardPage.teamDropdown.click();
|
||||
await expect(page.getByText("Second Team")).toBeVisible();
|
||||
await page.getByText("Second Team").click();
|
||||
await page.getByRole("button", { name: "team-management" }).click();
|
||||
await page.getByTestId("delete-team").click();
|
||||
|
||||
await DashboardPage.mockRPC(
|
||||
page,
|
||||
"get-teams",
|
||||
"logged-in-user/get-teams-default.json",
|
||||
);
|
||||
|
||||
await page.getByRole("button", { name: "Delete team" }).click();
|
||||
await dashboardPage.teamDropdown.click();
|
||||
await expect(page.getByText("Second Team")).not.toBeVisible();
|
||||
});
|
||||
|
|
|
@ -474,6 +474,13 @@
|
|||
(rx/tap on-success)
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(defn- team-deleted
|
||||
[id]
|
||||
(ptk/reify ::team-deleted
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update state :teams dissoc id))))
|
||||
|
||||
(defn delete-team
|
||||
[{:keys [id] :as params}]
|
||||
(ptk/reify ::delete-team
|
||||
|
@ -485,7 +492,10 @@
|
|||
(meta params)]
|
||||
|
||||
(->> (rp/cmd! :delete-team {:id id})
|
||||
(rx/mapcat on-success)
|
||||
(rx/mapcat (fn [result]
|
||||
(rx/concat
|
||||
(rx/of (team-deleted id))
|
||||
(on-success result))))
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(defn delete-webhook
|
||||
|
|
Loading…
Add table
Reference in a new issue