Skip to content

Remember last email account selected#847

Merged
elie222 merged 2 commits intomainfrom
feat/remember-last-selected-account
Oct 14, 2025
Merged

Remember last email account selected#847
elie222 merged 2 commits intomainfrom
feat/remember-last-selected-account

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Oct 14, 2025

Summary by CodeRabbit

  • New Features

    • The app now remembers your last selected email account and automatically opens it when you return on the same browser.
    • Navigation has been updated to prefer your most recently accessed email account; if none is available, it will open the first available account.
  • Chores

    • Version updated to v2.16.6.

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Oct 14, 2025 6:59pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Implements cookie-based persistence of the last selected email account. Adds server actions to read/write a cookie, updates redirect logic to prefer the cookie value, and adds a provider effect to set the cookie when selection changes. Introduces a cookie constant and bumps version to v2.16.6.

Changes

Cohort / File(s) Summary
Cookie-based last email account selection
apps/web/utils/account.ts, apps/web/utils/actions/email-account-cookie.ts, apps/web/utils/cookies.ts
Adds LAST_EMAIL_ACCOUNT_COOKIE constant and server actions to get/set it. Updates redirect logic to read the cookie and use its emailAccountId if valid, otherwise fallback to the first account; adjusts notFound/redirect to operate on IDs.
Provider persists selection
apps/web/providers/EmailAccountProvider.tsx
Adds an effect to call setLastEmailAccountAction(emailAccountId) whenever emailAccountId changes, persisting the selection.
Version bump
version.txt
Updates version from v2.16.5 to v2.16.6.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant B as Browser
  participant S as Next.js Server
  participant A as account.ts
  participant C as Cookie Store

  U->>B: Navigate to /app
  B->>S: HTTP request
  S->>A: resolveAccountRedirect()
  A->>C: read LAST_EMAIL_ACCOUNT_COOKIE
  alt cookie present and valid
    A-->>S: redirect to /app/accounts/{emailAccountId}
  else cookie missing/invalid
    A-->>S: fallback to first account or notFound()
  end
  S-->>B: Redirect/Response
Loading
sequenceDiagram
  autonumber
  participant V as EmailAccountProvider
  participant SA as setLastEmailAccountAction
  participant C as Cookie Store

  Note over V: emailAccountId changes
  V->>SA: setLastEmailAccountAction(emailAccountId)
  SA->>C: Set LAST_EMAIL_ACCOUNT_COOKIE = emailAccountId<br/>(httpOnly, path=/, maxAge=1y, sameSite=lax, secure in prod)
  SA-->>V: done
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A whisk of code, a cookie crumb,
I hop between accounts—thump-thump!
Last seen burrow, safely kept,
In headers’ hush, the secret slept.
Now every jump lands soft and bright—
v2.16.6 takes flight! 🥕✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/remember-last-selected-account

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3da37a and 6f1caef.

📒 Files selected for processing (5)
  • apps/web/providers/EmailAccountProvider.tsx (2 hunks)
  • apps/web/utils/account.ts (2 hunks)
  • apps/web/utils/actions/email-account-cookie.ts (1 hunks)
  • apps/web/utils/cookies.ts (1 hunks)
  • version.txt (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="apps/web/utils/account.ts">

<violation number="1" location="apps/web/utils/account.ts:123">
Ensure the cookie-sourced emailAccountId is validated against the authenticated user&#39;s accounts before using it; otherwise fall back to the first account.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@elie222 elie222 changed the base branch from fix/onboarding-conversation-rules to main October 14, 2025 18:54
@elie222 elie222 merged commit d004582 into main Oct 14, 2025
4 of 6 checks passed
@elie222 elie222 deleted the feat/remember-last-selected-account branch December 18, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments