[PB-5978]: feat(mail)/frozen account state#53
Conversation
… downgrade messages
… mail account status handling in Sidenav
Deploying mail-web with
|
| Latest commit: |
05bbaea
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://33c4d3d3.mail-web-ea0.pages.dev |
| Branch Preview URL: | https://feat-disabled-account-state.mail-web-ea0.pages.dev |
…to version 0.1.16
65b05ed to
99d313d
Compare
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR implements mail account suspension detection and UI handling. It fetches the current mail account status via a new service method, calculates days until account deletion, displays a suspension notification in the sidenav with the countdown, and provides translated messages across four languages. The sidenav disables the compose button when mail is suspended. ChangesMail Account Status & Suspension Handling
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested Reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/Sidenav/index.tsx`:
- Around line 24-27: Extract the data fetching and derived UI state from Sidenav
into a hook (e.g., create useMailAccountState or useSidenavData) so the
component remains presentational: move the useGetMailMeQuery() call and derived
values isMailDisabled, daysUntilDeletion (derived via
getDaysUntil(mailMe?.deletionAt)), and storagePercentage (derived from planUsage
and planLimit) into that hook, have the hook return plain values/booleans
(mailMe, isMailDisabled, daysUntilDeletion, storagePercentage, planUsage,
planLimit) and any callbacks, then replace the in-component logic in Sidenav
with a single call to the new hook and pass the returned values as props to the
render layer; update any other similar logic around lines 76-85 into the same or
another focused use... hook following the same pattern.
- Around line 79-82: The CTA's onAction is currently a no-op and should invoke
the real upgrade flow; replace the empty handler assigned to onAction with a
call that opens your app's upgrade UI (for example call an existing helper like
openUpgradeModal(), openBillingPortal(), or dispatch a navigation such as
router.push('/settings/billing')), ensuring you import or access that function
inside the Sidenav component and pass any required params; update the onAction
reference (the handler on the message created with
translate('mailDowngraded.message'...)) to invoke that real upgrade function
instead of () => {} so the warning button actually starts the upgrade flow.
In `@src/utils/days-until/index.ts`:
- Around line 3-4: The getDaysUntil function currently computes days for any
string and can return NaN for unparseable dates; update getDaysUntil to first
parse the input (e.g., const ts = Date.parse(date) or new Date(date).getTime()),
check Number.isFinite(ts) or !Number.isNaN(ts), and if the parse fails return
undefined; otherwise use ts and MS_PER_DAY in the Math.max/Math.ceil calculation
so invalid date strings do not propagate NaN to callers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b187cb78-a03d-40ee-b0cf-5170ddddf4e1
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (15)
package.jsonsrc/components/Sidenav/index.tsxsrc/errors/mail/index.tssrc/hooks/navigation/useSidenavNavigation.tsxsrc/i18n/locales/en.jsonsrc/i18n/locales/es.jsonsrc/i18n/locales/fr.jsonsrc/i18n/locales/it.jsonsrc/services/sdk/mail/index.tssrc/services/sdk/mail/mail.service.test.tssrc/store/api/base.tssrc/store/api/mail/index.tssrc/store/api/mail/mail.api.test.tssrc/utils/days-until/daysUntil.test.tssrc/utils/days-until/index.ts
…enhance date handling
|
| isLoadingPlanLimit, | ||
| isLoadingPlanUsage, | ||
| storagePercentage, | ||
| } = useSidenavData(); |
| expect(mockMailClient.getMailAccount).toHaveBeenCalledOnce(); | ||
| }); | ||
|
|
||
| test('When fetching the mail account and it is suspended, then suspendedAt and deletionAt should be present', async () => { |
There was a problem hiding this comment.
Avoid using technical descriptions. When fetching the mail account and it is suspended, then the date when it was suspended and it will be deleted are present
| expect(result.data).toStrictEqual(mockAccount); | ||
| }); | ||
|
|
||
| test('When fetching the mail account fails, then a FetchMailMeError should be returned', async () => { |
There was a problem hiding this comment.
We can use an error indicating so is thrown


Added account suspended notification to the sidebar. Locked some actions when account status is suspended