@@ -18,6 +19,25 @@ const GeneralSettingsSection = ({ renderSectionHeader }: GeneralSettingsSectionP
+
+
{
+ const checked = e.target.checked === true
+ await updateAutoApproveSettings({
+ ...autoApprovalSettings,
+ version: (autoApprovalSettings.version ?? 1) + 1,
+ enableNotifications: checked,
+ })
+ }}>
+ Enable notifications
+
+
+
+ Receive system notifications when Cline requires approval to proceed or when a task is completed.
+
+
+
diff --git a/webview-ui/src/hooks/useAutoApproveActions.ts b/webview-ui/src/hooks/useAutoApproveActions.ts
index 7f58079a30..bbd792042f 100644
--- a/webview-ui/src/hooks/useAutoApproveActions.ts
+++ b/webview-ui/src/hooks/useAutoApproveActions.ts
@@ -11,12 +11,8 @@ export function useAutoApproveActions() {
const isChecked = useCallback(
(action: ActionMetadata): boolean => {
switch (action.id) {
- case "enableAll":
- return Object.values(autoApprovalSettings.actions).every(Boolean)
case "enableNotifications":
return autoApprovalSettings.enableNotifications
- case "enableAutoApprove":
- return autoApprovalSettings.enabled
default:
return autoApprovalSettings.actions[action.id] ?? false
}
@@ -24,52 +20,12 @@ export function useAutoApproveActions() {
[autoApprovalSettings],
)
- // Check if action is favorited
- const isFavorited = useCallback(
- (action: ActionMetadata): boolean => {
- const favorites = autoApprovalSettings.favorites || []
- return favorites.includes(action.id)
- },
- [autoApprovalSettings.favorites],
- )
-
- // Toggle favorite status
- const toggleFavorite = useCallback(
- async (actionId: string) => {
- const currentFavorites = autoApprovalSettings.favorites || []
- let newFavorites: string[]
-
- if (currentFavorites.includes(actionId)) {
- newFavorites = currentFavorites.filter((id) => id !== actionId)
- } else {
- newFavorites = [...currentFavorites, actionId]
- }
-
- await updateAutoApproveSettings({
- ...autoApprovalSettings,
- version: (autoApprovalSettings.version ?? 1) + 1,
- favorites: newFavorites,
- })
- },
- [autoApprovalSettings],
- )
-
// Update action state
const updateAction = useCallback(
async (action: ActionMetadata, value: boolean) => {
const actionId = action.id
const subActionId = action.subAction?.id
- if (actionId === "enableAutoApprove") {
- await updateAutoApproveEnabled(value)
- return
- }
-
- if (actionId === "enableAll" || subActionId === "enableAll") {
- await toggleAll(action, value)
- return
- }
-
if (actionId === "enableNotifications" || subActionId === "enableNotifications") {
await updateNotifications(action, value)
return
@@ -81,7 +37,6 @@ export function useAutoApproveActions() {
}
if (value === false && subActionId) {
- // @ts-expect-error: TODO: See how we can fix this
newActions[subActionId] = false
}
@@ -89,57 +44,10 @@ export function useAutoApproveActions() {
newActions[action.parentActionId as keyof AutoApprovalSettings["actions"]] = true
}
- // Check if this will result in any enabled actions
- const willHaveEnabledActions = Object.values(newActions).some(Boolean)
-
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
actions: newActions,
- enabled: willHaveEnabledActions,
- })
- },
- [autoApprovalSettings],
- )
-
- // Update max requests
- const updateMaxRequests = useCallback(
- async (maxRequests: number) => {
- await updateAutoApproveSettings({
- ...autoApprovalSettings,
- version: (autoApprovalSettings.version ?? 1) + 1,
- maxRequests,
- })
- },
- [autoApprovalSettings],
- )
-
- // Update auto-approve enabled state
- const updateAutoApproveEnabled = useCallback(
- async (checked: boolean) => {
- await updateAutoApproveSettings({
- ...autoApprovalSettings,
- version: (autoApprovalSettings.version ?? 1) + 1,
- enabled: checked,
- })
- },
- [autoApprovalSettings],
- )
-
- // Toggle all actions
- const toggleAll = useCallback(
- async (_action: ActionMetadata, checked: boolean) => {
- const actions = { ...autoApprovalSettings.actions }
-
- for (const action of Object.keys(actions)) {
- actions[action as keyof AutoApprovalSettings["actions"]] = checked
- }
-
- await updateAutoApproveSettings({
- ...autoApprovalSettings,
- version: (autoApprovalSettings.version ?? 1) + 1,
- actions,
- enabled: checked,
})
},
[autoApprovalSettings],
@@ -161,12 +69,7 @@ export function useAutoApproveActions() {
return {
isChecked,
- isFavorited,
- toggleFavorite,
updateAction,
- updateMaxRequests,
- updateAutoApproveEnabled,
- toggleAll,
updateNotifications,
}
}