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.

feat(email): open Settings > Account after connecting an inbox (#3982)

gbirmancbe2ee4397b6
diff --git a/js/app/packages/app/component/EmailAuth.tsx b/js/app/packages/app/component/EmailAuth.tsx
index 1df104a70f..a1836bfa3e 100644
--- a/js/app/packages/app/component/EmailAuth.tsx
+++ b/js/app/packages/app/component/EmailAuth.tsx
@@ -3,6 +3,7 @@ import { updateUserAuth } from '@core/auth';
import { redirectToEmailAuth } from '@core/auth/email';
import { LoadingBlock } from '@core/component/LoadingBlock';
import { toast } from '@core/component/Toast/Toast';
+import { useSettingsState } from '@core/constant/SettingsState';
import { useEmailLinks } from '@core/email-link';
import { whenSettled } from '@core/util/whenSettled';
import { invalidateAllAfterLogin } from '@queries/auth/user-info';
@@ -99,6 +100,7 @@ function EmailLinkCallback(props: Pick<EmailAuthParams, 'successPath'>) {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const { query, initEmailLink } = useEmailLinks();
+ const { setActiveTabId } = useSettingsState();
const [conflict, setConflict] = createSignal<{
linkId: string;
emailAddress: string;
@@ -109,6 +111,11 @@ function EmailLinkCallback(props: Pick<EmailAuthParams, 'successPath'>) {
navigate(props.successPath, { replace: true });
};
+ const navigateToAccountSettings = () => {
+ setActiveTabId('Account');
+ navigate('/component/mail/component/settings', { replace: true });
+ };
+
const runInit = async (linkId: string, forceShare: boolean) => {
await initEmailLink({ linkId, forceShare }).match(
async () => {
@@ -116,12 +123,15 @@ function EmailLinkCallback(props: Pick<EmailAuthParams, 'successPath'>) {
// callback so the inbox panel shows it immediately on return rather
// than flashing a stale list until its own refetch lands.
await query.refetch();
- toast.success('Inbox connected');
- navigateToSuccess();
+ toast.success('Inbox connected', {
+ subtext: 'Syncing emails — refresh to see them',
+ });
+ navigateToAccountSettings();
},
- (err) => {
+ async (err) => {
if (err.tag === 'AlreadyInitialized') {
- navigateToSuccess();
+ await query.refetch();
+ navigateToAccountSettings();
return;
}
// The mailbox is already connected by someone else. Hold the callback open