Skip to content

Find message id from rfc822 id#892

Merged
elie222 merged 7 commits intomainfrom
feat/admin-find-message-id
Nov 3, 2025
Merged

Find message id from rfc822 id#892
elie222 merged 7 commits intomainfrom
feat/admin-find-message-id

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 2, 2025

Note

Adds an admin tool to find thread/message IDs from an RFC822 Message-ID with backend action and provider support (Google/Outlook), plus minor UI and pagination key refactor.

  • Admin UI
    • Add GmailUrlConverter card for RFC822 Message-ID lookup in admin/page.tsx.
    • Wrap AdminHashEmail form in a Card layout.
  • Backend Actions
    • New adminConvertGmailUrlAction to resolve RFC822 Message-ID to threadId and messageIds with validation in admin.validation.ts.
  • Email Providers
    • Extend EmailProvider interface with getMessageByRfc822MessageId.
    • Implement in google.ts (uses getMessageByRfc822Id) and microsoft.ts (Graph filter on internetMessageId).
  • Mail List
    • Refactor query construction into getKey for useSWRInfinite in mail/page.tsx.
  • Utilities
    • Add utils/gmail/gmail-id.ts for extracting Gmail IDs from URLs.
  • Version
    • Bump version.txt to v2.17.26.

Written by Cursor Bugbot for commit e21cbac. Configure here.

Summary by CodeRabbit

  • New Features

    • Added a Gmail URL Converter tool in the admin panel to extract thread and message info.
  • Improvements

    • Admin email-hash UI refreshed into a card-based layout.
    • Pagination/query handling optimized for more reliable page fetching.
    • Navigation updated: new Premium item added to user menu and removed from sidebar footer.
  • Chores

    • Bumped version to v2.17.26.

@vercel
Copy link

vercel bot commented Nov 2, 2025

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

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 3, 2025 0:12am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 2, 2025

Warning

Rate limit exceeded

@elie222 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 72eb58c and 2d0dc3b.

📒 Files selected for processing (1)
  • apps/web/utils/actions/user.ts (3 hunks)

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

Adds a Gmail URL conversion admin feature (UI + server action), extends email providers to lookup messages by RFC822 Message-ID, refactors mail page query key construction, adjusts admin hash UI, centralizes cookie clearing, updates mocks, and bumps version.

Changes

Cohort / File(s) Summary
Gmail URL Converter
apps/web/app/(app)/admin/GmailUrlConverter.tsx, apps/web/app/(app)/admin/page.tsx, apps/web/utils/actions/admin.ts, apps/web/utils/actions/admin.validation.ts
New client component for submitting RFC822 Message-ID + email; new server action adminConvertGmailUrlAction and validation schema convertGmailUrlBody. Action resolves account, initializes provider, fetches message by RFC822 ID, fetches thread, and returns { threadId, messageIds, rfc822MessageId }. Admin page now renders the new component.
Email provider surface & implementations
apps/web/utils/email/types.ts, apps/web/utils/email/google.ts, apps/web/utils/email/microsoft.ts
Adds `getMessageByRfc822MessageId(rfc822MessageId: string): Promise<ParsedMessage
Admin Hash UI
apps/web/app/(app)/admin/AdminHashEmail.tsx
Reworked form UI to use Card, CardHeader, CardTitle, CardContent; relocated inputs, submit button, and hashed-value display into Card layout; adjusted container sizing and spacing.
Mail page query refactor
apps/web/app/(app)/[emailAccountId]/mail/page.tsx
Moved per-page query construction into getKey so query is built per-invocation based on searchParams and augmented with nextPageToken when present.
Cookie handling & user actions
apps/web/utils/cookies.server.ts, apps/web/utils/actions/email-account-cookie.ts, apps/web/utils/actions/user.ts
Adds exported clearLastEmailAccountCookie() that deletes LAST_EMAIL_ACCOUNT_COOKIE via Next cookies; replaced direct cookie clearing with the new helper in clear-last-email actions and updated deleteAccountAction to clear cookie before sign-out using per-call error handling.
Mocks & version
apps/web/utils/__mocks__/email-provider.ts, version.txt
Added mock methods getMessageByRfc822MessageId (resolves null) and getFolders (resolves []); bumped version from v2.17.25 to v2.17.26.
Nav / Sidebar adjustments
apps/web/components/NavUser.tsx, apps/web/components/SideNav.tsx
Added a "Premium" menu entry with CrownIcon to NavUser dropdown; removed the Premium item from SideNav footer.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as GmailUrlConverter
    participant Action as adminConvertGmailUrlAction
    participant DB as Database/Repo
    participant Provider as EmailProvider

    User->>UI: enter RFC822 Message-ID + email
    User->>UI: submit
    UI->>Action: call adminConvertGmailUrlAction(data)
    Action->>DB: resolve email account by address
    alt account found
        Action->>Provider: init provider for account
        Action->>Provider: getMessageByRfc822MessageId(id)
        alt message found
            Provider-->>Action: ParsedMessage (may include threadId)
            Action->>Provider: getThread(parsed.threadId)
            alt thread found
                Provider-->>Action: thread with messageIds
                Action-->>UI: { threadId, messageIds, rfc822MessageId }
                UI->>User: display results
            else thread not found
                Action-->>UI: error (thread missing)
            end
        else message not found
            Action-->>UI: error (message missing)
        end
    else account not found
        Action-->>UI: error (account missing)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review adminConvertGmailUrlAction for account resolution, provider initialization, and error paths.
  • Verify RFC822 ID normalization and lookup logic in google.ts and microsoft.ts.
  • Confirm form validation, submission, and toast handling in GmailUrlConverter.
  • Ensure mail page getKey refactor preserves pagination and searchParams behavior.
  • Check cookie clearing interactions in deleteAccountAction and related actions.

Possibly related PRs

Poem

🐰 I found the thread with a hop and a twitch,
RFC822 made sense in a stitch.
Cards and converters, cookies made clean,
Threads now revealed — what a clever machine! ✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Find message id from rfc822 id" directly describes the primary feature being added in this PR. The changeset's core objective is to introduce functionality that resolves RFC822 Message-IDs to message and thread IDs, which is accomplished through the new GmailUrlConverter admin component, the adminConvertGmailUrlAction backend handler, and the getMessageByRfc822MessageId method implementations across email providers. The title is concise, specific, and clearly communicates this main change, though it does not cover supporting changes like the pagination refactor or UI layout adjustments that are also included.

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

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 31

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

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.

2 issues found across 11 files

Prompt for AI agents (all 2 issues)

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


<file name="apps/web/utils/actions/admin.validation.ts">

<violation number="1" location="apps/web/utils/actions/admin.validation.ts:9">
Whitespace-only RFC822 Message-IDs pass validation because the schema never trims before enforcing the minimum length. Please trim the value in the schema so empty-but-spaces inputs are rejected up front.</violation>
</file>

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

<violation number="1" location="apps/web/utils/email/microsoft.ts:164">
Escape user-derived values or use parameterization when constructing the OData filter to prevent injection/syntax errors</violation>
</file>

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 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 3f46878 and 72eb58c.

📒 Files selected for processing (7)
  • apps/web/components/NavUser.tsx (2 hunks)
  • apps/web/components/SideNav.tsx (0 hunks)
  • apps/web/utils/actions/admin.validation.ts (1 hunks)
  • apps/web/utils/actions/email-account-cookie.ts (2 hunks)
  • apps/web/utils/actions/user.ts (2 hunks)
  • apps/web/utils/cookies.server.ts (1 hunks)
  • apps/web/utils/email/microsoft.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/components/SideNav.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/utils/actions/admin.validation.ts
  • apps/web/utils/email/microsoft.ts
🧰 Additional context used
📓 Path-based instructions (15)
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Path aliases: Use @/ for imports from project root
Use proper error handling with try/catch blocks
Format code with Prettier
Leverage TypeScript inference for better DX

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/components/NavUser.tsx
  • apps/web/utils/actions/email-account-cookie.ts
!{.cursor/rules/*.mdc}

📄 CodeRabbit inference engine (.cursor/rules/cursor-rules.mdc)

Never place rule files in the project root, in subdirectories outside .cursor/rules, or in any other location

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/components/NavUser.tsx
  • apps/web/utils/actions/email-account-cookie.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)

**/*.ts: The same validation should be done in the server action too
Define validation schemas using Zod

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)

**/*.{ts,tsx}: Use createScopedLogger for logging in backend TypeScript files
Typically add the logger initialization at the top of the file when using createScopedLogger
Only use .with() on a logger instance within a specific function, not for a global logger

Import Prisma in the project using import prisma from "@/utils/prisma";

**/*.{ts,tsx}: Don't use TypeScript enums.
Don't use TypeScript const enum.
Don't use the TypeScript directive @ts-ignore.
Don't use primitive type aliases or misleading types.
Don't use empty type parameters in type aliases and interfaces.
Don't use any or unknown as type constraints.
Don't use implicit any type on variable declarations.
Don't let variables evolve into any type through reassignments.
Don't use non-null assertions with the ! postfix operator.
Don't misuse the non-null assertion operator (!) in TypeScript files.
Don't use user-defined types.
Use as const instead of literal types and type annotations.
Use export type for types.
Use import type for types.
Don't declare empty interfaces.
Don't merge interfaces and classes unsafely.
Don't use overload signatures that aren't next to each other.
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces.
Don't use TypeScript namespaces.
Don't export imported variables.
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.
Don't use parameter properties in class constructors.
Use either T[] or Array consistently.
Initialize each enum member value explicitly.
Make sure all enum members are literal values.

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/components/NavUser.tsx
  • apps/web/utils/actions/email-account-cookie.ts
apps/web/utils/**

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Create utility functions in utils/ folder for reusable logic

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
apps/web/utils/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

apps/web/utils/**/*.ts: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{js,jsx,ts,tsx}: Don't use elements in Next.js projects.
Don't use elements in Next.js projects.
Don't use namespace imports.
Don't access namespace imports dynamically.
Don't use global eval().
Don't use console.
Don't use debugger.
Don't use var.
Don't use with statements in non-strict contexts.
Don't use the arguments object.
Don't use consecutive spaces in regular expression literals.
Don't use the comma operator.
Don't use unnecessary boolean casts.
Don't use unnecessary callbacks with flatMap.
Use for...of statements instead of Array.forEach.
Don't create classes that only have static members (like a static namespace).
Don't use this and super in static contexts.
Don't use unnecessary catch clauses.
Don't use unnecessary constructors.
Don't use unnecessary continue statements.
Don't export empty modules that don't change anything.
Don't use unnecessary escape sequences in regular expression literals.
Don't use unnecessary labels.
Don't use unnecessary nested block statements.
Don't rename imports, exports, and destructured assignments to the same name.
Don't use unnecessary string or template literal concatenation.
Don't use String.raw in template literals when there are no escape sequences.
Don't use useless case statements in switch statements.
Don't use ternary operators when simpler alternatives exist.
Don't use useless this aliasing.
Don't initialize variables to undefined.
Don't use the void operators (they're not familiar).
Use arrow functions instead of function expressions.
Use Date.now() to get milliseconds since the Unix Epoch.
Use .flatMap() instead of map().flat() when possible.
Use literal property access instead of computed property access.
Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
Use concise optional chaining instead of chained logical expressions.
Use regular expression literals instead of the RegExp constructor when possible.
Don't use number literal object member names th...

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/components/NavUser.tsx
  • apps/web/utils/actions/email-account-cookie.ts
!pages/_document.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

!pages/_document.{js,jsx,ts,tsx}: Don't import next/document outside of pages/_document.jsx in Next.js projects.
Don't import next/document outside of pages/_document.jsx in Next.js projects.

Files:

  • apps/web/utils/cookies.server.ts
  • apps/web/utils/actions/user.ts
  • apps/web/components/NavUser.tsx
  • apps/web/utils/actions/email-account-cookie.ts
apps/web/utils/actions/**/*.ts

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/utils/actions/**/*.ts: Use server actions for all mutations (create/update/delete operations)
next-safe-action provides centralized error handling
Use Zod schemas for validation on both client and server
Use revalidatePath in server actions for cache invalidation

apps/web/utils/actions/**/*.ts: Use server actions (with next-safe-action) for all mutations (create/update/delete operations); do NOT use POST API routes for mutations.
Use revalidatePath in server actions to invalidate cache after mutations.

Files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
apps/web/utils/actions/*.ts

📄 CodeRabbit inference engine (.cursor/rules/server-actions.mdc)

apps/web/utils/actions/*.ts: Implement all server actions using the next-safe-action library for type safety, input validation, context management, and error handling. Refer to apps/web/utils/actions/safe-action.ts for client definitions (actionClient, actionClientUser, adminActionClient).
Use actionClientUser when only authenticated user context (userId) is needed.
Use actionClient when both authenticated user context and a specific emailAccountId are needed. The emailAccountId must be bound when calling the action from the client.
Use adminActionClient for actions restricted to admin users.
Access necessary context (like userId, emailAccountId, etc.) provided by the safe action client via the ctx object in the .action() handler.
Server Actions are strictly for mutations (operations that change data, e.g., creating, updating, deleting). Do NOT use Server Actions for data fetching (GET operations). For data fetching, use dedicated GET API Routes combined with SWR Hooks.
Use SafeError for expected/handled errors within actions if needed. next-safe-action provides centralized error handling.
Use the .metadata({ name: "actionName" }) method to provide a meaningful name for monitoring. Sentry instrumentation is automatically applied via withServerActionInstrumentation within the safe action clients.
If an action modifies data displayed elsewhere, use revalidatePath or revalidateTag from next/cache within the action handler as needed.

Server action files must start with use server

Files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
apps/web/**/*.tsx

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.tsx: Follow tailwindcss patterns with prettier-plugin-tailwindcss
Prefer functional components with hooks
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach
Follow consistent naming conventions (PascalCase for components)
Use LoadingContent component for async data
Use result?.serverError with toastError and toastSuccess
Use LoadingContent component to handle loading and error states consistently
Pass loading, error, and children props to LoadingContent

Files:

  • apps/web/components/NavUser.tsx
apps/web/components/**/*.tsx

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Use React Hook Form with Zod validation for form handling

Use the LoadingContent component to handle loading and error states consistently in data-fetching components.

Use PascalCase for components (e.g. components/Button.tsx)

Files:

  • apps/web/components/NavUser.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)

**/*.tsx: Use React Hook Form with Zod for validation
Validate form inputs before submission
Show validation errors inline next to form fields

Files:

  • apps/web/components/NavUser.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{jsx,tsx}: Don't destructure props inside JSX components in Solid projects.
Don't use both children and dangerouslySetInnerHTML props on the same element.
Don't use Array index in keys.
Don't assign to React component props.
Don't define React components inside other components.
Don't use event handlers on non-interactive elements.
Don't assign JSX properties multiple times.
Don't add extra closing tags for components without children.
Use <>...</> instead of ....
Don't insert comments as text nodes.
Don't use the return value of React.render.
Make sure all dependencies are correctly specified in React hooks.
Make sure all React hooks are called from the top level of component functions.
Don't use unnecessary fragments.
Don't pass children as props.
Use semantic elements instead of role attributes in JSX.

Files:

  • apps/web/components/NavUser.tsx
**/*.{html,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{html,jsx,tsx}: Don't use or elements.
Don't use accessKey attribute on any HTML element.
Don't set aria-hidden="true" on focusable elements.
Don't add ARIA roles, states, and properties to elements that don't support them.
Only use the scope prop on elements.
Don't assign non-interactive ARIA roles to interactive HTML elements.
Make sure label elements have text content and are associated with an input.
Don't assign interactive ARIA roles to non-interactive HTML elements.
Don't assign tabIndex to non-interactive HTML elements.
Don't use positive integers for tabIndex property.
Don't include "image", "picture", or "photo" in img alt prop.
Don't use explicit role property that's the same as the implicit/default role.
Make static elements with click handlers use a valid role attribute.
Always include a title element for SVG elements.
Give all elements requiring alt text meaningful information for screen readers.
Make sure anchors have content that's accessible to screen readers.
Assign tabIndex to non-interactive HTML elements with aria-activedescendant.
Include all required ARIA attributes for elements with ARIA roles.
Make sure ARIA properties are valid for the element's supported roles.
Always include a type attribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden).
Always include a lang attribute on the html element.
Always include a title attribute for iframe elements.
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress.
Accompany onMouseOver/onMouseOut with onFocus/onBlur.
Include caption tracks for audio and video elements.
Make sure all anchors are valid and navigable.
Ensure all ARIA properties (aria-*) are valid.
Use valid, non-abstract ARIA roles for elements with ARIA roles.
Use valid ARIA state and property values.
Use valid values for the autocomplete attribute on input eleme...

Files:

  • apps/web/components/NavUser.tsx
🧠 Learnings (10)
📚 Learning: 2025-09-17T22:05:28.646Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-09-17T22:05:28.646Z
Learning: Applies to apps/web/utils/{ai,llms}/**/*.{ts,tsx} : Keep related AI functions co-located and extract common patterns into utilities; document complex AI logic with clear comments

Applied to files:

  • apps/web/utils/cookies.server.ts
📚 Learning: 2025-07-18T17:27:58.249Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-07-18T17:27:58.249Z
Learning: Applies to apps/web/utils/actions/*.ts : Use `actionClient` when both authenticated user context and a specific `emailAccountId` are needed. The `emailAccountId` must be bound when calling the action from the client.

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-18T15:04:30.467Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-07-18T15:04:30.467Z
Learning: Applies to apps/web/app/api/**/route.ts : Use `withEmailAccount` for email-account-level operations

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-08T13:14:07.449Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 537
File: apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx:30-34
Timestamp: 2025-07-08T13:14:07.449Z
Learning: The clean onboarding page in apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx is intentionally Gmail-specific and should show an error for non-Google email accounts rather than attempting to support multiple providers.

Applied to files:

  • apps/web/utils/actions/user.ts
📚 Learning: 2025-10-02T23:23:48.064Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm-test.mdc:0-0
Timestamp: 2025-10-02T23:23:48.064Z
Learning: Applies to apps/web/__tests__/**/*.test.ts : Prefer existing helpers from @/__tests__/helpers.ts (getEmailAccount, getEmail, getRule, getMockMessage, getMockExecutedRule) over custom helpers

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-18T17:27:46.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2025-07-18T17:27:46.389Z
Learning: Applies to **/api/**/route.ts : Use `withEmailAccount` middleware for API routes that operate on a specific email account (i.e., use or require `emailAccountId`).

Applied to files:

  • apps/web/utils/actions/user.ts
📚 Learning: 2025-07-18T17:27:58.249Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-07-18T17:27:58.249Z
Learning: Applies to apps/web/utils/actions/*.ts : Implement all server actions using the `next-safe-action` library for type safety, input validation, context management, and error handling. Refer to `apps/web/utils/actions/safe-action.ts` for client definitions (`actionClient`, `actionClientUser`, `adminActionClient`).

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-18T17:27:58.249Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-07-18T17:27:58.249Z
Learning: Applies to apps/web/utils/actions/*.ts : Use `actionClientUser` when only authenticated user context (`userId`) is needed.

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-18T17:27:58.249Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-07-18T17:27:58.249Z
Learning: Applies to apps/web/utils/actions/*.ts : Access necessary context (like `userId`, `emailAccountId`, etc.) provided by the safe action client via the `ctx` object in the `.action()` handler.

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
📚 Learning: 2025-07-18T17:27:58.249Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-07-18T17:27:58.249Z
Learning: Applies to apps/web/utils/actions/*.ts : Use `adminActionClient` for actions restricted to admin users.

Applied to files:

  • apps/web/utils/actions/user.ts
  • apps/web/utils/actions/email-account-cookie.ts
🧬 Code graph analysis (3)
apps/web/utils/cookies.server.ts (1)
apps/web/utils/cookies.ts (1)
  • LAST_EMAIL_ACCOUNT_COOKIE (4-4)
apps/web/utils/actions/user.ts (2)
apps/web/utils/cookies.server.ts (1)
  • clearLastEmailAccountCookie (4-7)
apps/web/utils/auth.ts (1)
  • betterAuthConfig (30-139)
apps/web/utils/actions/email-account-cookie.ts (1)
apps/web/utils/cookies.server.ts (1)
  • clearLastEmailAccountCookie (4-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: test
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/web/components/NavUser.tsx (2)

14-14: LGTM: Icon import added correctly.

The CrownIcon import follows the established pattern and is used appropriately in the Premium menu item below.


179-184: The code is correct—no changes needed.

The Premium link uses /premium without prefixPath() because it's intentionally a global route, not account-scoped. The route structure confirms this:

  • Account-scoped routes are nested under [emailAccountId]/ (Usage, Reply Zero, Cold Email Blocker, Organization)
  • Global routes are at the (app) level: early-access/, premium/, admin/, organization/, etc.

Premium follows the exact same pattern as Early Access—both are global features accessible without an email account ID in the URL. The premium/page.tsx file is a simple page with no account parameters, confirming the design is intentional.

apps/web/utils/actions/user.ts (1)

16-16: LGTM: Import added for centralized cookie clearing.

The new import consolidates cookie management into a reusable utility.

apps/web/utils/cookies.server.ts (1)

1-7: LGTM: Clean utility for centralized cookie management.

The function correctly awaits the Next.js cookies() call and provides a reusable way to clear the last email account cookie. This centralizes the logic and makes it easier to maintain.

apps/web/utils/actions/email-account-cookie.ts (2)

9-9: LGTM: Import added for centralized utility.


44-44: LGTM: Clean refactoring to use centralized cookie clearing.

The action now properly delegates to the utility function while correctly awaiting the result. This improves code organization and maintainability.

@elie222 elie222 merged commit c502d44 into main Nov 3, 2025
8 of 9 checks passed
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.

No issues found across 7 files

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.

No issues found across 7 files

@elie222 elie222 deleted the feat/admin-find-message-id branch December 18, 2025 23:01
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