Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
soup: rename unified entity action parameter (#512)
Caleb Taylor291754728acd
diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsxindex 094bca8dcf..9859329088 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) => {+ 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 };},{- testEnabled: (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 };},{- testEnabled: (entity) => {+ canExecute: (entity) => {if (entity.type === 'channel') {if (entity.channelType === 'direct_message') return false;@@ -531,7 +531,7 @@ export function createNavigationEntityListShortcut({return { success: true };},{- testEnabled: (entity) => {+ canExecute: (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) => {+ 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.tsxindex a6dc3a06ca..ea85903bea 100644--- a/js/app/packages/app/component/UnifiedEntityActions.tsx+++ b/js/app/packages/app/component/UnifiedEntityActions.tsx@@ -24,17 +24,17 @@ 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;+ 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 testEnabled+ * 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 { testEnabled, enabledMode } = configs.get(type) ?? {};- if (!testEnabled) return true;+ const { canExecute, mode } = configs.get(type) ?? {};+ if (!canExecute) return true;if (Array.isArray(entities)) {- if (enabledMode === 'some') {- return entities.some(testEnabled);+ if (mode === 'some') {+ return entities.some(canExecute);} else {- return entities.every(testEnabled);+ return entities.every(canExecute);}} else if (isEntityData(entities)) {- return testEnabled(entities);+ return canExecute(entities);}return false;};