From cbe46c816eadc96f562a84403855a26a25cb7c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kayla=20=E3=81=AF=E3=81=AA?= Date: Tue, 10 Mar 2026 12:26:33 -0600 Subject: [PATCH] feat: add workspace sharing buttons to tasks (#22729) Attempt to re-merge https://github.com/coder/coder/pull/21491 now that the supporting backend work is done Closes https://github.com/coder/coder/issues/22278 --- coderd/workspaces.go | 11 ---- .../tasks/TasksSidebar/TasksSidebar.tsx | 6 +- .../WorkspaceSharingForm.tsx | 14 +---- site/src/pages/TaskPage/TaskPage.tsx | 8 ++- site/src/pages/TaskPage/TaskTopbar.tsx | 18 +++++- .../src/pages/TasksPage/TasksPage.stories.tsx | 2 +- site/src/pages/TasksPage/TasksPage.tsx | 59 ++++++++++++------- site/src/pages/TasksPage/TasksTable.tsx | 4 +- .../WorkspaceActions/ShareButton.tsx | 5 +- .../WorkspaceSharingPageView.tsx | 1 - 10 files changed, 72 insertions(+), 56 deletions(-) diff --git a/coderd/workspaces.go b/coderd/workspaces.go index f2114e1f92..4c1359f9de 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -2354,17 +2354,6 @@ func (api *API) patchWorkspaceACL(rw http.ResponseWriter, r *http.Request) { return } - // Don't allow adding new groups or users to a workspace associated with a - // task. Sharing a task workspace without sharing the task itself is a broken - // half measure that we don't want to support right now. To be fixed! - if workspace.TaskID.Valid { - httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ - Message: "Task workspaces cannot be shared.", - Detail: "This workspace is managed by a task. Task sharing has not yet been implemented.", - }) - return - } - apiKey := httpmw.APIKey(r) if _, ok := req.UserRoles[apiKey.UserID.String()]; ok { httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ diff --git a/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx b/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx index aa920cd60d..0fff35aa06 100644 --- a/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx +++ b/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx @@ -103,10 +103,8 @@ export const TasksSidebar: FC = () => {