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
refactor(notifications): drop Hide from the notification permission prompt (#9344)
Peter Chinman723138bea486
diff --git a/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsx b/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsxindex 220172cb4e..af92a743de 100644--- a/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsx+++ b/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsx@@ -2,13 +2,21 @@* @vitest-environment jsdom*/+import type { CustomToastConfig } from '@core/component/Toast/Toast';import { cleanup, render } from '@solidjs/testing-library';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { BrowserNotificationModal } from './BrowserNotificationModal';+type PromptOptions = {+ persistent?: boolean;+ region?: string;+ onUserDismiss?: () => void;+};+const mocks = vi.hoisted(() => ({- custom: vi.fn(() => 1),+ custom: vi.fn((_config: CustomToastConfig, _options?: PromptOptions) => 1),mobile: false,+ dismissPrompt: vi.fn(),}));vi.mock('@core/component/Toast/Toast', () => ({@@ -24,7 +32,7 @@ vi.mock('../notification-settings', () => ({useNotificationSettings: () => ({isSupported: true,shouldPrompt: () => true,- dismissPrompt: vi.fn(),+ dismissPrompt: mocks.dismissPrompt,toggle: vi.fn(),}),}));@@ -43,7 +51,10 @@ describe('browser notification prompt', () => {expect(mocks.custom).toHaveBeenCalledWith(expect.objectContaining({ title: 'Enable Browser Notifications' }),- { persistent: true, region: 'mobile-prompt-region' }+ expect.objectContaining({+ persistent: true,+ region: 'mobile-prompt-region',+ }));});@@ -51,9 +62,25 @@ describe('browser notification prompt', () => {mocks.mobile = false;render(() => <BrowserNotificationModal />);- expect(mocks.custom).toHaveBeenCalledWith(expect.anything(), {- persistent: true,- region: 'prompt-region',- });+ expect(mocks.custom).toHaveBeenCalledWith(+ expect.anything(),+ expect.objectContaining({ persistent: true, region: 'prompt-region' })+ );+ });++ it('offers Enable as its only action', () => {+ render(() => <BrowserNotificationModal />);++ const [config] = mocks.custom.mock.calls[0]!;+ expect(config.actions?.map((action) => action.label)).toEqual(['Enable']);+ });++ it('stops asking once the user closes it', () => {+ render(() => <BrowserNotificationModal />);++ const [, options] = mocks.custom.mock.calls[0]!;+ options?.onUserDismiss?.();++ expect(mocks.dismissPrompt).toHaveBeenCalledOnce();});});diff --git a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsxindex dfcd61ab31..3d394cd2f9 100644--- a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx+++ b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx@@ -56,13 +56,6 @@ function NotificationToastTrigger(props: {</div>),actions: [- {- label: 'Hide',- onClick: () => {- props.settings.dismissPrompt();- toast.dismiss(toastId);- },- },{label: 'Enable',onClick: async () => {@@ -82,6 +75,8 @@ function NotificationToastTrigger(props: {{persistent: true,region: isMobile() ? 'mobile-prompt-region' : 'prompt-region',+ // Closing the prompt is a decline, so don't ask again on the next load.+ onUserDismiss: () => props.settings.dismissPrompt(),});});diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 5de67f5e97..62e4baa661 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -119,9 +119,10 @@ notification provider; macOS uses its system permission dialog. The Android appsays **Enable Notifications** and requests the Android notification permissionthrough the same native provider. The web prompt says **Enable BrowserNotifications** and uses browser permissions.-Select **Hide** to dismiss the prompt. It waits in the same region as other-prompts, one card at a time. On phones it stays under open sheets and their-pickers.+**Enable** is its only action; closing the prompt (its corner **Close** on+desktop, a swipe on phones) counts as a decline and stops it returning on the+next load. It waits in the same region as other prompts, one card at a time. On+phones it stays under open sheets and their pickers.### Notification snoozes