mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
fix: hide the favorite button for workspaces you don't own (#28000)
This commit is contained in:
@@ -211,6 +211,15 @@ export const CancelHiddenForUser: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const FavoriteHiddenForNonOwner: Story = {
|
||||
args: {
|
||||
workspace: Mocks.MockWorkspace,
|
||||
},
|
||||
parameters: {
|
||||
user: Mocks.MockUserMember,
|
||||
},
|
||||
};
|
||||
|
||||
export const OpenDownloadLogs: Story = {
|
||||
args: {
|
||||
workspace: Mocks.MockWorkspace,
|
||||
|
||||
@@ -178,11 +178,14 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
|
||||
|
||||
{canCancel && <CancelButton handleAction={handleCancel} />}
|
||||
|
||||
<FavoriteButton
|
||||
workspaceID={workspace.id}
|
||||
isFavorite={workspace.favorite}
|
||||
onToggle={handleToggleFavorite}
|
||||
/>
|
||||
{/* Only the owner can favorite a workspace. */}
|
||||
{user.id === workspace.owner_id && (
|
||||
<FavoriteButton
|
||||
workspaceID={workspace.id}
|
||||
isFavorite={workspace.favorite}
|
||||
onToggle={handleToggleFavorite}
|
||||
/>
|
||||
)}
|
||||
|
||||
{permissions.shareWorkspace && (
|
||||
<ShareButton
|
||||
|
||||
Reference in New Issue
Block a user