From e31b2f223e80303ad52470d3f7d93f1f884feff9 Mon Sep 17 00:00:00 2001 From: Caleb Taylor Date: Tue, 9 Dec 2025 10:04:48 -0500 Subject: [PATCH 1/3] update --- js/app/packages/app/component/SoupContext.tsx | 11 ++++++----- .../packages/app/component/UnifiedEntityActions.tsx | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx index 094bca8dcf4..585b27345fa 100644 --- a/js/app/packages/app/component/SoupContext.tsx +++ b/js/app/packages/app/component/SoupContext.tsx @@ -315,7 +315,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - testEnabled: (entity) => { + checkEnabled: (entity) => { if (entity.type === 'email' || entity.type === 'channel') return true; if (entityHasUnreadNotifications(notificationSource, entity)) return true; @@ -381,7 +381,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - testEnabled: (entity) => { + checkEnabled: (entity) => { // can't delete these bad boys yet. if (entity.type === 'channel' || entity.type === 'email') return false; // only delete what you own. @@ -449,7 +449,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - testEnabled: (entity) => { + checkEnabled: (entity) => { if (entity.type === 'channel') { if (entity.channelType === 'direct_message') return false; @@ -531,7 +531,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - testEnabled: (entity) => { + checkEnabled: (entity) => { if (entity.type === 'channel' || entity.type === 'email') return false; return true; }, @@ -540,6 +540,7 @@ export function createNavigationEntityListShortcut({ registerHotkey({ scopeId: splitHotkeyScope, + hotkeyToken: TOKENS.entity.action.copy, description: () => viewData().selectedEntities.length > 1 ? 'Copy items' : 'Copy item', @@ -586,7 +587,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - testEnabled: (entity) => { + checkEnabled: (entity) => { if (entity.type === 'channel' || entity.type === 'email') return false; return true; }, diff --git a/js/app/packages/app/component/UnifiedEntityActions.tsx b/js/app/packages/app/component/UnifiedEntityActions.tsx index a6dc3a06cae..55bf4a2486f 100644 --- a/js/app/packages/app/component/UnifiedEntityActions.tsx +++ b/js/app/packages/app/component/UnifiedEntityActions.tsx @@ -24,10 +24,10 @@ export type EntityActionConfig = { /** Optional icon component */ icon?: Component; /** - * Optional test to run over an entity to see if the action can be performed + * Optional condition to run over an entity to see if the action can be performed * on that entity. */ - testEnabled?: (entity: EntityData) => boolean; + checkEnabled?: (entity: EntityData) => boolean; /** * Enabled mode for bulk version of action. If 'every' then all entities must pass * for the action to register as enabled. If 'some' then the action can be @@ -109,7 +109,7 @@ export function createEntityActionRegistry(): EntityActionRegistry { type: EntityActionType, entities: EntityData | EntityData[] ): boolean => { - const { testEnabled, enabledMode } = configs.get(type) ?? {}; + const { checkEnabled: testEnabled, enabledMode } = configs.get(type) ?? {}; if (!testEnabled) return true; if (Array.isArray(entities)) { if (enabledMode === 'some') { From 46e95aa625c1459b52cab92f6d21ae0f78d423d8 Mon Sep 17 00:00:00 2001 From: Caleb Taylor Date: Tue, 9 Dec 2025 10:07:48 -0500 Subject: [PATCH 2/3] update --- .../packages/app/component/UnifiedEntityActions.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/app/packages/app/component/UnifiedEntityActions.tsx b/js/app/packages/app/component/UnifiedEntityActions.tsx index 55bf4a2486f..a80f86a908c 100644 --- a/js/app/packages/app/component/UnifiedEntityActions.tsx +++ b/js/app/packages/app/component/UnifiedEntityActions.tsx @@ -31,7 +31,7 @@ export type EntityActionConfig = { /** * Enabled mode for bulk version of action. If 'every' then all entities must pass * for the action to register as enabled. If 'some' then the action can be - * enabled if a single entity passes the test. Only meaningful if testEnabled + * enabled if a single entity passes the test. Only meaningful if checkEnabled * is also provided. Default is 'every' */ enabledMode?: 'some' | 'every'; @@ -109,16 +109,16 @@ export function createEntityActionRegistry(): EntityActionRegistry { type: EntityActionType, entities: EntityData | EntityData[] ): boolean => { - const { checkEnabled: testEnabled, enabledMode } = configs.get(type) ?? {}; - if (!testEnabled) return true; + const { checkEnabled, enabledMode } = configs.get(type) ?? {}; + if (!checkEnabled) return true; if (Array.isArray(entities)) { if (enabledMode === 'some') { - return entities.some(testEnabled); + return entities.some(checkEnabled); } else { - return entities.every(testEnabled); + return entities.every(checkEnabled); } } else if (isEntityData(entities)) { - return testEnabled(entities); + return checkEnabled(entities); } return false; }; From 2a378f19cebd04a2dee59527640c886947e199b7 Mon Sep 17 00:00:00 2001 From: Caleb Taylor Date: Tue, 9 Dec 2025 10:13:33 -0500 Subject: [PATCH 3/3] update --- js/app/packages/app/component/SoupContext.tsx | 12 +++++------ .../app/component/UnifiedEntityActions.tsx | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx index 585b27345fa..98593290883 100644 --- a/js/app/packages/app/component/SoupContext.tsx +++ b/js/app/packages/app/component/SoupContext.tsx @@ -315,7 +315,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - checkEnabled: (entity) => { + canExecute: (entity) => { if (entity.type === 'email' || entity.type === 'channel') return true; if (entityHasUnreadNotifications(notificationSource, entity)) return true; @@ -381,7 +381,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - checkEnabled: (entity) => { + canExecute: (entity) => { // can't delete these bad boys yet. if (entity.type === 'channel' || entity.type === 'email') return false; // only delete what you own. @@ -389,7 +389,7 @@ export function createNavigationEntityListShortcut({ }, // TODO (seamus): fix the handler from the modal so that we can delete // some of the items. Then switch this to some. - enabledMode: 'every', + mode: 'every', } ); @@ -449,7 +449,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - checkEnabled: (entity) => { + canExecute: (entity) => { if (entity.type === 'channel') { if (entity.channelType === 'direct_message') return false; @@ -531,7 +531,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - checkEnabled: (entity) => { + canExecute: (entity) => { if (entity.type === 'channel' || entity.type === 'email') return false; return true; }, @@ -587,7 +587,7 @@ export function createNavigationEntityListShortcut({ return { success: true }; }, { - checkEnabled: (entity) => { + canExecute: (entity) => { if (entity.type === 'channel' || entity.type === 'email') return false; return true; }, diff --git a/js/app/packages/app/component/UnifiedEntityActions.tsx b/js/app/packages/app/component/UnifiedEntityActions.tsx index a80f86a908c..ea85903beae 100644 --- a/js/app/packages/app/component/UnifiedEntityActions.tsx +++ b/js/app/packages/app/component/UnifiedEntityActions.tsx @@ -27,14 +27,14 @@ export type EntityActionConfig = { * Optional condition to run over an entity to see if the action can be performed * on that entity. */ - checkEnabled?: (entity: EntityData) => boolean; + canExecute?: (entity: EntityData) => boolean; /** - * Enabled mode for bulk version of action. If 'every' then all entities must pass + * Mode for bulk version of action. If 'every' then all entities must pass * for the action to register as enabled. If 'some' then the action can be - * enabled if a single entity passes the test. Only meaningful if checkEnabled + * enabled if a single entity passes the test. Only meaningful if canExecute * is also provided. Default is 'every' */ - enabledMode?: 'some' | 'every'; + mode?: 'some' | 'every'; }; export type EntityActionRegistry = { @@ -109,16 +109,16 @@ export function createEntityActionRegistry(): EntityActionRegistry { type: EntityActionType, entities: EntityData | EntityData[] ): boolean => { - const { checkEnabled, enabledMode } = configs.get(type) ?? {}; - if (!checkEnabled) return true; + const { canExecute, mode } = configs.get(type) ?? {}; + if (!canExecute) return true; if (Array.isArray(entities)) { - if (enabledMode === 'some') { - return entities.some(checkEnabled); + if (mode === 'some') { + return entities.some(canExecute); } else { - return entities.every(checkEnabled); + return entities.every(canExecute); } } else if (isEntityData(entities)) { - return checkEnabled(entities); + return canExecute(entities); } return false; };