Skip to content

Commit e99c2fc

Browse files
committed
Only show share button if enabled
1 parent 8a06e9e commit e99c2fc

File tree

6 files changed

+21
-1
lines changed

6 files changed

+21
-1
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ export class ClineProvider
13061306
historyPreviewCollapsed,
13071307
cloudUserInfo,
13081308
cloudIsAuthenticated,
1309+
sharingEnabled,
13091310
organizationAllowList,
13101311
maxConcurrentFileReads,
13111312
condensingApiConfigId,
@@ -1405,6 +1406,7 @@ export class ClineProvider
14051406
historyPreviewCollapsed: historyPreviewCollapsed ?? false,
14061407
cloudUserInfo,
14071408
cloudIsAuthenticated: cloudIsAuthenticated ?? false,
1409+
sharingEnabled: sharingEnabled ?? false,
14081410
organizationAllowList,
14091411
condensingApiConfigId,
14101412
customCondensingPrompt,
@@ -1470,6 +1472,16 @@ export class ClineProvider
14701472
)
14711473
}
14721474

1475+
let sharingEnabled: boolean = false
1476+
1477+
try {
1478+
sharingEnabled = await CloudService.instance.canShareTask()
1479+
} catch (error) {
1480+
console.error(
1481+
`[getState] failed to get sharing enabled state: ${error instanceof Error ? error.message : String(error)}`,
1482+
)
1483+
}
1484+
14731485
// Return the same structure as before
14741486
return {
14751487
apiConfiguration: providerSettings,
@@ -1546,6 +1558,7 @@ export class ClineProvider
15461558
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
15471559
cloudUserInfo,
15481560
cloudIsAuthenticated,
1561+
sharingEnabled,
15491562
organizationAllowList,
15501563
// Explicitly add condensing settings
15511564
condensingApiConfigId: stateValues.condensingApiConfigId,

src/core/webview/__tests__/ClineProvider.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ describe("ClineProvider", () => {
428428
autoCondenseContext: true,
429429
autoCondenseContextPercent: 100,
430430
cloudIsAuthenticated: false,
431+
sharingEnabled: false,
431432
}
432433

433434
const message: ExtensionMessage = {

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export type ExtensionState = Pick<
220220

221221
cloudUserInfo: CloudUserInfo | null
222222
cloudIsAuthenticated: boolean
223+
sharingEnabled: boolean
223224
organizationAllowList: OrganizationAllowList
224225

225226
autoCondenseContext: boolean

webview-ui/src/components/chat/TaskActions.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next"
55
import type { HistoryItem } from "@roo-code/types"
66

77
import { vscode } from "@/utils/vscode"
8+
import { useExtensionState } from "@/context/ExtensionStateContext"
89

910
import { DeleteTaskDialog } from "../history/DeleteTaskDialog"
1011
import { IconButton } from "./IconButton"
@@ -17,10 +18,11 @@ interface TaskActionsProps {
1718
export const TaskActions = ({ item, buttonsDisabled }: TaskActionsProps) => {
1819
const [deleteTaskId, setDeleteTaskId] = useState<string | null>(null)
1920
const { t } = useTranslation()
21+
const { sharingEnabled } = useExtensionState()
2022

2123
return (
2224
<div className="flex flex-row gap-1">
23-
{item?.id && (
25+
{item?.id && sharingEnabled && (
2426
<IconButton
2527
iconClass="codicon-link"
2628
title={t("chat:task.share")}

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface ExtensionStateContextType extends ExtensionState {
3636
openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
3737
organizationAllowList: OrganizationAllowList
3838
cloudIsAuthenticated: boolean
39+
sharingEnabled: boolean
3940
maxConcurrentFileReads?: number
4041
condensingApiConfigId?: string
4142
setCondensingApiConfigId: (value: string) => void
@@ -201,6 +202,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
201202
historyPreviewCollapsed: false, // Initialize the new state (default to expanded)
202203
cloudUserInfo: null,
203204
cloudIsAuthenticated: false,
205+
sharingEnabled: false,
204206
organizationAllowList: ORGANIZATION_ALLOW_ALL,
205207
autoCondenseContext: true,
206208
autoCondenseContextPercent: 100,

webview-ui/src/context/__tests__/ExtensionStateContext.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ describe("mergeExtensionState", () => {
208208
autoCondenseContext: true,
209209
autoCondenseContextPercent: 100,
210210
cloudIsAuthenticated: false,
211+
sharingEnabled: false,
211212
}
212213

213214
const prevState: ExtensionState = {

0 commit comments

Comments
 (0)