Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(crm): allow all team members to use CRM entity context menu actions (#4886)

Evan Hutnik1fb875095eb5
diff --git a/apps/web/src/features/next-soup/actions/make-hide-company-action.ts b/apps/web/src/features/next-soup/actions/make-hide-company-action.ts
index 9b97f3df70..d62f936866 100644
--- a/apps/web/src/features/next-soup/actions/make-hide-company-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-hide-company-action.ts
@@ -5,17 +5,16 @@ import type { SoupState } from '../create-soup-state';
import { restoreSoupFocus } from '../utils';
type MakeHideCompanyOptions = {
- // Admin/owner-only on the FE; the backend independently enforces
+ // Available to all team members; the backend enforces
// EditAccessLevel on PUT /crm/companies/{id}/hidden.
- isTeamAdmin: () => boolean;
setHidden: (companyId: string, hidden: boolean) => Promise<unknown>;
};
export const makeHideCompanyAction = (options: MakeHideCompanyOptions) => {
- const { isTeamAdmin, setHidden } = options;
+ const { setHidden } = options;
const canExecute = (entity: EntityData): boolean =>
- entity.type === 'crm_company' && isTeamAdmin();
+ entity.type === 'crm_company';
const previewPanel = useMaybePreviewPanel();
diff --git a/apps/web/src/features/next-soup/actions/make-set-company-property-action.ts b/apps/web/src/features/next-soup/actions/make-set-company-property-action.ts
index dc81177289..32b05bbe2f 100644
--- a/apps/web/src/features/next-soup/actions/make-set-company-property-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-set-company-property-action.ts
@@ -8,24 +8,18 @@ import type { Property } from '@property/types';
/** Builtin CRM company fields settable from entity action menus. */
export type CompanyCrmField = 'stage' | 'owner' | 'revenue';
-type MakeSetCompanyPropertyOptions = {
- // Admin/owner-only on the FE, matching row-level CRM editing; the
- // backend independently enforces write access on property saves.
- isTeamAdmin: () => boolean;
-};
-
/**
* "Set stage / owner / revenue" for CRM company rows: opens the global
* property editor (the same one task status/priority/assignee commands
* use) targeting the builtin CRM property, editing the whole selection.
+ * Available to all team members; the backend enforces write access on
+ * property saves.
*/
-export const makeSetCompanyPropertyAction = (
- options: MakeSetCompanyPropertyOptions
-) => {
+export const makeSetCompanyPropertyAction = () => {
const dealStages = useDealStages();
const canExecute = (entity: EntityData): boolean =>
- entity.type === 'crm_company' && options.isTeamAdmin();
+ entity.type === 'crm_company';
const propertyFor = (field: CompanyCrmField): Property | undefined => {
// Stage resolves through the active deal-stage set (the team's own
diff --git a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
index 5ac9f1f7b9..99cd0bd002 100644
--- a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
+++ b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
@@ -13,7 +13,6 @@ import { TOKENS } from '@core/hotkey/tokens';
import { type EntityData, isTaskEntity } from '@entity';
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import type { Property, PropertyDefinitionDomain } from '@property/types';
-import { useIsTeamAdmin } from '@queries/team/teams';
import { onCleanup } from 'solid-js';
import type { SoupState } from '../create-soup-state';
import {
@@ -78,10 +77,7 @@ export const useEntityActionHotkeys = (
const favoriteAction = makeFavoriteAction();
- const isTeamAdmin = useIsTeamAdmin();
- const setCompanyPropertyAction = makeSetCompanyPropertyAction({
- isTeamAdmin: () => isTeamAdmin(),
- });
+ const setCompanyPropertyAction = makeSetCompanyPropertyAction();
const getEntitiesForAction = (): EntityData[] => {
if (
diff --git a/apps/web/src/features/next-soup/soup-view/create-soup-entity-actions.ts b/apps/web/src/features/next-soup/soup-view/create-soup-entity-actions.ts
index 01026c48e9..fe955de6fd 100644
--- a/apps/web/src/features/next-soup/soup-view/create-soup-entity-actions.ts
+++ b/apps/web/src/features/next-soup/soup-view/create-soup-entity-actions.ts
@@ -13,7 +13,6 @@ import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
import { isMobile } from '@core/mobile/isMobile';
import type { EntityData } from '@entity';
import { useSetCompanyHiddenMutation } from '@queries/crm/companies';
-import { useIsTeamAdmin } from '@queries/team/teams';
import type { Component, JSX } from 'solid-js';
import {
makeBlockSenderAction,
@@ -86,7 +85,6 @@ export function createSoupEntityActions(): {
const analytics = useAnalytics();
const userId = useUserId();
const notificationSource = useGlobalNotificationSource();
- const isTeamAdmin = useIsTeamAdmin();
const hiddenMutation = useSetCompanyHiddenMutation();
const markDone = makeMarkDoneAction({
@@ -114,13 +112,10 @@ export function createSoupEntityActions(): {
const markSenderSignalAction = makeMarkSenderSignalAction();
const markSenderNoiseAction = makeMarkSenderNoiseAction();
const hideCompanyAction = makeHideCompanyAction({
- isTeamAdmin: () => isTeamAdmin(),
setHidden: (companyId, hidden) =>
hiddenMutation.mutateAsync({ companyId, hidden }),
});
- const setCompanyPropertyAction = makeSetCompanyPropertyAction({
- isTeamAdmin: () => isTeamAdmin(),
- });
+ const setCompanyPropertyAction = makeSetCompanyPropertyAction();
const buildActionGroups: BuildActionGroups = (
soup,
@@ -377,8 +372,8 @@ export function createSoupEntityActions(): {
});
}
- // CRM group (admin/owner only): Set stage/owner/revenue on the whole
- // company selection, Hide / Unhide for a single company.
+ // CRM group: Set stage/owner/revenue on the whole company
+ // selection, Hide / Unhide for a single company.
const crmItems: SoupEntityActionItem[] = [];
if (canExecuteAll(setCompanyPropertyAction.canExecute)) {