Skip to content

fix(outlook): Force consent prompt for Microsoft OAuth to ensure refresh token is returned#1206

Merged
elie222 merged 4 commits intomainfrom
fix/microsoft-oauth-refresh-token
Jan 5, 2026
Merged

fix(outlook): Force consent prompt for Microsoft OAuth to ensure refresh token is returned#1206
elie222 merged 4 commits intomainfrom
fix/microsoft-oauth-refresh-token

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jan 5, 2026

User description

outlook: Force consent prompt for Microsoft OAuth

Ensures Microsoft returns a refresh token on re-authentication by combining select_account and consent prompts.

  • Changed prompt from 'select_account' to 'select_account consent' in getLinkingOAuth2Url
  • Fixes issue where users re-authenticating after password changes would not get a new refresh token

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Modifies the getLinkingOAuth2Url function to include a consent prompt, ensuring Microsoft returns a refresh token during re-authentication for Outlook users. This resolves issues where users re-authenticating after password changes would not receive a new refresh token.

Latest Contributors(2)
UserCommitDate
elie222fix-add-unified-error-...January 04, 2026
eduardoleliss@gmail.comFix-expiration-typeAugust 05, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@vercel
Copy link

vercel bot commented Jan 5, 2026

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

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Jan 5, 2026 11:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

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

Walkthrough

A new AllRulesDisabledBanner component is introduced to alert users when automation rules are disabled, integrated into the automation page. The ActionCard component is expanded with blue and red variants and enhanced description support, while Alert components are deprecated in favor of ActionCard. New card variant components (CardBlue, CardRed) provide additional styling options, and the Outlook OAuth prompt is updated to include explicit consent flow.

Changes

Cohort / File(s) Summary
AllRulesDisabledBanner Feature
apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx, apps/web/app/(app)/[emailAccountId]/automation/page.tsx
New client component that conditionally renders a banner when all automation rules are disabled. Fetches rule and account data via hooks, displays ActionCard with navigation link to onboarding flow. Integrated into automation page layout.
ActionCard & Card Variants
apps/web/components/ui/card.tsx, apps/web/app/(landing)/components/page.tsx
ActionCard refactored to support dynamic variants (green/blue/destructive) with updated prop signature. New exported components CardBlue and CardRed provide colored card containers with gradient and dark-mode styling. Landing components page demonstrates all three variants with examples.
Component Deprecation
apps/web/components/ui/alert.tsx
Deprecation notices added to Alert, AlertTitle, and AlertDescription components, directing users to ActionCard as replacement. No functional changes to component behavior.
OAuth Configuration
apps/web/utils/outlook/client.ts
OAuth2 authorization prompt parameter updated from "select_account" to "select_account consent" in Outlook account linking flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Banners bloom when rules sleep deep,
Cards in blue their vigil keep,
Alert cards retire with grace,
ActionCard takes their place!
Consent flows smooth through Outlook's door,
The automation page loves more! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to fix Microsoft OAuth consent for refresh tokens, but the main changes involve adding a new AllRulesDisabledBanner component and ActionCard variants, with only a minor OAuth parameter change. Update the title to reflect the primary changes: adding AllRulesDisabledBanner component and ActionCard UI variants, or restructure the PR to focus on the OAuth fix separately.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 5, 2026

Set Microsoft OAuth prompt=consent in apps/web/utils/outlook/client.outlook.client.getLinkingOAuth2Url to force consent and return a refresh token

Update the authorization URL builder to use prompt=consent instead of select_account in client.ts.

📍Where to Start

Start with the outlook.client.getLinkingOAuth2Url utility in client.ts.


Macroscope summarized 19a5d67.

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 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/components/ui/card.tsx">

<violation number="1" location="apps/web/components/ui/card.tsx:185">
P2: Wrapping `description` in a `&lt;p&gt;` tag may produce invalid HTML when `ReactNode` contains block-level elements. Consider using a `&lt;div&gt;` instead to safely accept any ReactNode, or document that only inline content should be passed.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a 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

Fix all issues with AI Agents 🤖
In @apps/web/components/ui/alert.tsx:
- Line 25: The deprecation note is incorrect because Alert (and its wrappers
AlertBasic, AlertWithButton, AlertError) are not compatible with ActionCard;
remove or revise the comment on Alert.tsx so it no longer claims ActionCard as a
drop-in replacement, and either (a) implement an ActionCard-compatible wrapper
that maps Alert variants (including "success") and optional icon/composition to
ActionCard's props (title/description and "green"/"blue"/"destructive" variants)
or (b) add a clear migration guide explaining the structural differences and
required refactor steps for AlertBasic/AlertWithButton/AlertError before marking
Alert deprecated.
🧹 Nitpick comments (1)
apps/web/components/ui/card.tsx (1)

161-172: Consider using a mapping object for better maintainability.

The nested ternary operators work correctly, but a mapping object would improve scalability if more variants are added in the future.

🔎 Optional refactor using mapping objects
-    const CardVariant =
-      variant === "blue"
-        ? CardBlue
-        : variant === "destructive"
-          ? CardRed
-          : CardGreen;
-    const iconColor =
-      variant === "blue"
-        ? "text-blue-600 dark:text-blue-400"
-        : variant === "destructive"
-          ? "text-red-600 dark:text-red-400"
-          : "text-green-600 dark:text-green-400";
+    const variantConfig = {
+      green: {
+        Card: CardGreen,
+        iconColor: "text-green-600 dark:text-green-400",
+      },
+      blue: {
+        Card: CardBlue,
+        iconColor: "text-blue-600 dark:text-blue-400",
+      },
+      destructive: {
+        Card: CardRed,
+        iconColor: "text-red-600 dark:text-red-400",
+      },
+    };
+    const { Card: CardVariant, iconColor } = variantConfig[variant];
📜 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 0933b17 and cbc3adf.

📒 Files selected for processing (6)
  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
  • apps/web/utils/outlook/client.ts
🧰 Additional context used
📓 Path-based instructions (21)
**/*.{ts,tsx}

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

**/*.{ts,tsx}: For API GET requests to server, use the swr package
Use result?.serverError with toastError from @/components/Toast for error handling in async operations

**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls

**/*.{ts,tsx}: For early access feature flags, create hooks using the naming convention use[FeatureName]Enabled that return a boolean from useFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming convention use[FeatureName]Variant that define variant types, use useFeatureFlagVariantKey() with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g., inbox-cleaner, pricing-options-2)
Always define types for A/B test variant flags (e.g., type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
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 TypeScript namespaces
Don't use non-null assertions with the ! postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Use as const instead of literal types and type annotations
Use either T[] or Array<T> consistently
Initialize each enum member value explicitly
Use export type for types
Use `impo...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/app/(app)/**/*.{ts,tsx}

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

apps/web/app/(app)/**/*.{ts,tsx}: Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
If we're in a deeply nested component we will use swr to fetch via API
If you need to use onClick in a component, that component is a client component and file must start with use client

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{ts,tsx,js,jsx}

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

Always import Prisma enums from @/generated/prisma/enums instead of @/generated/prisma/client to avoid Next.js bundling errors in client components

Import Prisma using the project's centralized utility: import prisma from '@/utils/prisma'

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/**/*.{ts,tsx}

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

Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Do not export types/interfaces that are only used within the same file. Export later if needed

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{tsx,ts}

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

**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Use next/image package for images
For API GET requests to server, use the swr package with hooks like useSWR to fetch data
For text inputs, use the Input component with registerProps for form integration and error handling

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{tsx,ts,css}

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

Implement responsive design with Tailwind CSS using a mobile-first approach

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.tsx

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

**/*.tsx: Use the LoadingContent component to handle loading states instead of manual loading state management
For text areas, use the Input component with type='text', autosizeTextarea prop set to true, and registerProps for form integration

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{js,jsx,ts,tsx}

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

**/*.{js,jsx,ts,tsx}: 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
Don't use distracting elements like <marquee> or <blink>
Only use the scope prop on <th> 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
Use semantic elements instead of role attributes in JSX
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 AR...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{jsx,tsx}

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

**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
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 forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use both children and dangerouslySetInnerHTML props on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use <>...</> instead of <Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't use target="_blank" without rel="noopener"
Don't use <img> elements in Next.js projects
Don't use <head> elements in Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
!(pages/_document).{jsx,tsx}

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

Don't use the next/head module in pages/_document.js on Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{js,ts,jsx,tsx}

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

**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/**/*.{ts,tsx,js,jsx}

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

apps/web/**/*.{ts,tsx,js,jsx}: Use @/ path aliases for imports from project root
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/app/**/*.{ts,tsx}

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

Follow NextJS app router structure with (app) directory

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/**/*.{tsx,jsx}

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

apps/web/**/*.{tsx,jsx}: Follow tailwindcss patterns with prettier-plugin-tailwindcss for class sorting
Prefer functional components with hooks in React
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach in components
Follow consistent naming conventions using PascalCase for components
Use LoadingContent component for async data with loading and error states
Use React Hook Form with Zod validation for form handling
Use result?.serverError with toastError and toastSuccess for error handling in forms

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/**/*.{ts,tsx,js,jsx,json,css}

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

Format code with Prettier

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
  • apps/web/components/ui/alert.tsx
  • apps/web/utils/outlook/client.ts
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/components/**/*.tsx

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

Use LoadingContent component to consistently handle loading and error states, passing loading, error, and children props

Use PascalCase for component file names (e.g., components/Button.tsx)

Files:

  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
**/{pages,routes,components}/**/*.{ts,tsx}

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

Never call Gmail API directly from routes or components - always use wrapper functions from the utils folder

Files:

  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
  • apps/web/app/(landing)/components/page.tsx
apps/web/components/ui/**/*.tsx

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

Shadcn UI components are located in components/ui directory

Files:

  • apps/web/components/ui/alert.tsx
  • apps/web/components/ui/card.tsx
**/*.ts

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

**/*.ts: ALL database queries MUST be scoped to the authenticated user/account by including user/account filtering in WHERE clauses to prevent unauthorized data access
Always validate that resources belong to the authenticated user before performing operations, using ownership checks in WHERE clauses or relationships
Always validate all input parameters for type, format, and length before using them in database queries
Use SafeError for error responses to prevent information disclosure. Generic error messages should not reveal internal IDs, logic, or resource ownership details
Only return necessary fields in API responses using Prisma's select option. Never expose sensitive data such as password hashes, private keys, or system flags
Prevent Insecure Direct Object References (IDOR) by validating resource ownership before operations. All findUnique/findFirst calls MUST include ownership filters
Prevent mass assignment vulnerabilities by explicitly whitelisting allowed fields in update operations instead of accepting all user-provided data
Prevent privilege escalation by never allowing users to modify system fields, ownership fields, or admin-only attributes through user input
All findMany queries MUST be scoped to the user's data by including appropriate WHERE filters to prevent returning data from other users
Use Prisma relationships for access control by leveraging nested where clauses (e.g., emailAccount: { id: emailAccountId }) to validate ownership

Files:

  • apps/web/utils/outlook/client.ts
**/{utils,helpers,lib}/**/*.{ts,tsx}

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

Logger should be passed as a parameter to helper functions instead of creating their own logger instances

Files:

  • apps/web/utils/outlook/client.ts
apps/web/**/*.{example,ts,json}

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

Add environment variables to .env.example, env.ts, and turbo.json

Files:

  • apps/web/utils/outlook/client.ts
🧠 Learnings (11)
📚 Learning: 2025-12-17T02:38:41.499Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1103
File: apps/web/utils/actions/rule.ts:447-457
Timestamp: 2025-12-17T02:38:41.499Z
Learning: In apps/web/utils/actions/rule.ts, revalidatePath is not needed for toggleAllRulesAction because rules data is fetched client-side using SWR, not server-side. Server-side cache revalidation is only needed when using Next.js server components or server-side data fetching.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use shadcn/ui components when available

Applied to files:

  • apps/web/components/ui/alert.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Applies to apps/web/components/ui/**/*.tsx : Shadcn UI components are located in `components/ui` directory

Applied to files:

  • apps/web/components/ui/alert.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Prefer functional components with hooks in React

Applied to files:

  • apps/web/components/ui/alert.tsx
📚 Learning: 2025-11-25T14:42:08.869Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ultracite.mdc:0-0
Timestamp: 2025-11-25T14:42:08.869Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Use semantic elements instead of role attributes in JSX

Applied to files:

  • apps/web/components/ui/alert.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Applies to apps/web/app/(app)/*/page.tsx : Create new pages at `apps/web/app/(app)/PAGE_NAME/page.tsx` with components either colocated in the same folder or in `page.tsx`

Applied to files:

  • apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:40:15.063Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:15.063Z
Learning: Applies to **/*.{tsx,ts} : Use Shadcn UI and Tailwind for components and styling

Applied to files:

  • apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : Use Shadcn UI and Tailwind for components and styling

Applied to files:

  • apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:36:36.276Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/data-fetching.mdc:0-0
Timestamp: 2025-11-25T14:36:36.276Z
Learning: Applies to **/*.{ts,tsx} : Import error and success toast utilities from '@/components/Toast' for displaying notifications

Applied to files:

  • apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*.tsx : Use `LoadingContent` component to consistently handle loading and error states, passing `loading`, `error`, and `children` props

Applied to files:

  • apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : LLM feature functions must import from `zod` for schema validation, use `createScopedLogger` from `@/utils/logger`, `chatCompletionObject` and `createGenerateObject` from `@/utils/llms`, and import `EmailAccountWithAI` type from `@/utils/llms/types`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx
🧬 Code graph analysis (1)
apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx (4)
apps/web/providers/EmailAccountProvider.tsx (1)
  • useAccount (79-89)
apps/web/components/ui/card.tsx (1)
  • ActionCard (209-209)
apps/web/utils/path.ts (1)
  • prefixPath (1-4)
apps/web/app/(app)/[emailAccountId]/onboarding/steps.ts (2)
  • getStepNumber (23-28)
  • STEP_KEYS (1-10)
⏰ 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: Baz Reviewer
  • GitHub Check: test
🔇 Additional comments (9)
apps/web/app/(landing)/components/page.tsx (1)

76-97: LGTM! Good demonstration of ActionCard variants.

The ActionCard usage correctly demonstrates all three variants (green, blue, destructive) with consistent props structure. This effectively showcases the new variant API for developers.

apps/web/components/ui/card.tsx (3)

109-122: LGTM! CardBlue follows the established pattern.

The implementation is consistent with CardGreen, using appropriate blue color schemes for both light and dark modes.


124-137: LGTM! CardRed follows the established pattern.

The implementation is consistent with CardGreen and CardBlue, using appropriate red color schemes for destructive actions in both light and dark modes.


139-196: LGTM! ActionCard refactor correctly implements variant support.

The refactored ActionCard properly supports the three variants (green, blue, destructive) with appropriate card components and icon colors. The type change for description from string to string | React.ReactNode is a backward-compatible widening that adds flexibility.

apps/web/app/(app)/[emailAccountId]/automation/page.tsx (1)

18-18: LGTM! Clean integration of the AllRulesDisabledBanner component.

The banner is correctly imported and positioned prominently between the page header and tab navigation, making it highly visible when all rules are disabled. The component handles its own loading states and conditional rendering internally.

Also applies to: 108-108

apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx (3)

1-14: LGTM! Imports are well-organized and follow project conventions.

The component correctly uses the "use client" directive and imports follow the project's path alias conventions.


15-24: Component logic correctly handles the "all rules disabled" state.

The logic at Line 22 specifically checks for rules.length > 0 && rules.every((rule) => !rule.enabled), which means the banner will only appear when:

  • Rules exist (length > 0)
  • All existing rules are disabled

This is the expected behavior—users with zero rules won't see this banner (they'll see other onboarding flows). The early returns efficiently prevent unnecessary rendering.


26-46: The force=true parameter is properly handled in the onboarding flow.

The ActionCard rendering correctly uses force=true to bypass the briefmymeeting redirect in the onboarding page. The parameter is defined in searchParams and used to skip the redirect condition when set, allowing normal onboarding to proceed. Navigation to the LABELS step is appropriate for rule configuration.

apps/web/utils/outlook/client.ts (1)

247-247: Clarify that the prompt parameter controls user interaction, not refresh token issuance.

The change to "select_account consent" does force the consent screen to display, creating a UX trade-off where users see the consent screen on every authentication attempt. However, this prompt parameter does not ensure refresh token issuance. Refresh tokens are only issued when using flows that support them (e.g., Authorization Code) and when the offline_access scope is explicitly requested. The prompt value affects user interaction, not token issuance mechanism.

Likely an incorrect or invalid review comment.

Comment on lines 15 to 24
export function AllRulesDisabledBanner() {
const { data: rules, isLoading } = useRules();
const { emailAccountId } = useAccount();

if (isLoading || !rules) return null;

const allRulesDisabled =
rules.length > 0 && rules.every((rule) => !rule.enabled);

if (!allRulesDisabled) return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

AllRulesDisabledBanner now returns null while useRules is loading or when the API error prevents data from resolving, so there is no LoadingContent wrapper or error feedback. Per apps/web/CLAUDE.md (Loading & Error States), components that rely on SWR must surface explicit loading/error states via LoadingContent instead of silently hiding the UI, meaning users see nothing if the rules fetch fails.

Prompt for AI Agents:

In apps/web/app/(app)/[emailAccountId]/assistant/AllRulesDisabledBanner.tsx around lines
15-24, the AllRulesDisabledBanner component currently returns null when useRules is
loading or when rules failed to resolve, which silently hides the UI. Import and use the
shared LoadingContent component (or the app's standard loading/error UI) and refactor
the early-return logic: show LoadingContent while isLoading, show a LoadingContent or
explicit error message when !isLoading and rules is null/undefined (indicating a fetch
error), and only continue with the existing allRulesDisabled check/render when rules is
a resolved array. Ensure to preserve the existing behavior once rules are available.

Fix in Cursor


Finding type: AI Coding Guidelines

@elie222 elie222 merged commit 405af78 into main Jan 5, 2026
17 of 18 checks passed
@elie222 elie222 deleted the fix/microsoft-oauth-refresh-token branch January 5, 2026 22:57
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