Skip to content

Commit

Permalink
feat: Prompt when deleting workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwimmer128 committed Nov 30, 2024
1 parent 4895f2f commit 6dd9334
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions browser/base/content/browser-workspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,23 @@ export const gWorkspaces = {
async deleteWorkspace(workspaceId) {
let windowId = await this.getCurrentWindowId();
let currentWorkspaceId = await this.getCurrentWorkspaceId();
await WorkspacesService.deleteWorkspace(workspaceId, windowId);
this.removeWorkspaceTabs(workspaceId);
if (workspaceId == currentWorkspaceId) {
await this.changeWorkspace(
await WorkspacesWindowIdUtils.getDefaultWorkspaceId(windowId),
0
);
const workspace = await this.getWorkspaceById(workspaceId);
const result = Services.prompt.confirm(
window,
this.l10n.formatValueSync("delete-workspace-prompt-title"),
this.l10n.formatValueSync("delete-workspace-prompt-text", { name: workspace.name }),
);
if (result) {
await WorkspacesService.deleteWorkspace(workspaceId, windowId);
this.removeWorkspaceTabs(workspaceId);
if (workspaceId == currentWorkspaceId) {
await this.changeWorkspace(
await WorkspacesWindowIdUtils.getDefaultWorkspaceId(windowId),
0
);
}
this.rebuildWorkspacesToolbar();
}
this.rebuildWorkspacesToolbar();
},

async renameWorkspace(workspaceId, newName) {
Expand Down

0 comments on commit 6dd9334

Please sign in to comment.