Conversation
- Set datarooms limit to 1 for trial plans in limits server (was 0 for free+drtrial) - Show Delete Dataroom button in settings for trial users - Show Create New Dataroom button for trial users with 0 datarooms - Add free+drtrial to allowed plans in dataroom creation endpoints - Skip upgrade modal in AddDataroomModal for trial users Co-authored-by: Marc Seitz <mfts@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe PR extends dataroom trial support by introducing Changes
Possibly Related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pages/api/teams/[teamId]/datarooms/index.ts (1)
231-246:⚠️ Potential issue | 🟠 Major
pro+drtrialis missing from the POST allowlist.The modal is now intentionally reachable for
isPro && isTrial, but this exact-match plan filter still rejects that state. Result: “Create from scratch” fails for Pro trial teams, and behavior diverges frompages/api/teams/[teamId]/datarooms/generate-ai.ts, which already accepts any*+drtrialplan.Minimal fix
"datarooms-plus+old", "datarooms-premium+old", "free+drtrial", + "pro+drtrial", "datarooms+drtrial", "business+drtrial", "datarooms-plus+drtrial",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pages/api/teams/`[teamId]/datarooms/index.ts around lines 231 - 246, The POST request's plan allowlist (the "plan: { in: [...] }" validation) is missing "pro+drtrial", causing Pro trial teams to be rejected; update that validation in pages/api/teams/[teamId]/datarooms/index.ts by adding "pro+drtrial" to the array (or broaden the check to accept any "*+drtrial" like the generate-ai handler) so the isPro && isTrial combination is allowed and matches pages/api/teams/[teamId]/datarooms/generate-ai.ts behavior.ee/features/templates/api/datarooms/generate.ts (1)
51-66:⚠️ Potential issue | 🟠 Major
pro+drtrialis still blocked here.
components/datarooms/add-dataroom-modal.tsxnow skips the upgrade wall forisPro && isTrial, but this exact allowlist still excludespro+drtrial. That means the “Create from template” path can still 401 for Pro trial teams, whilepages/api/teams/[teamId]/datarooms/generate-ai.tsalready accepts any*+drtrialplan.Minimal fix
"datarooms-plus+old", "datarooms-premium+old", "free+drtrial", + "pro+drtrial", "datarooms+drtrial", "business+drtrial", "datarooms-plus+drtrial",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ee/features/templates/api/datarooms/generate.ts` around lines 51 - 66, The allowlist in the plan array inside ee/features/templates/api/datarooms/generate.ts is missing "pro+drtrial", causing Pro trial teams to be blocked; update that plan allowlist (the plan array in this file) to include "pro+drtrial" (or expand the matching logic to accept any "*+drtrial" like pages/api/teams/[teamId]/datarooms/generate-ai.ts does) so the frontend path used by components/datarooms/add-dataroom-modal.tsx (which bypasses the upgrade wall for isPro && isTrial) will not 401.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pages/datarooms/index.tsx`:
- Around line 138-160: The CTA currently checks the filtered list length
(datarooms.length) which can be zero due to search/tags; change the gating logic
to use the unfiltered counts (totalDatarooms and limitDatarooms) so the
AddDataroomModal is shown only when the team is under its dataroom limit and
UpgradePlanModal is shown when at/exceeding the limit; update the conditional
around AddDataroomModal / UpgradePlanModal (where datarooms.length is used) to
compare totalDatarooms < limitDatarooms (or the appropriate limit check) and
keep the existing props like clickedPlan={PlanEnum.DataRooms} and
trigger="datarooms" intact.
---
Outside diff comments:
In `@ee/features/templates/api/datarooms/generate.ts`:
- Around line 51-66: The allowlist in the plan array inside
ee/features/templates/api/datarooms/generate.ts is missing "pro+drtrial",
causing Pro trial teams to be blocked; update that plan allowlist (the plan
array in this file) to include "pro+drtrial" (or expand the matching logic to
accept any "*+drtrial" like pages/api/teams/[teamId]/datarooms/generate-ai.ts
does) so the frontend path used by components/datarooms/add-dataroom-modal.tsx
(which bypasses the upgrade wall for isPro && isTrial) will not 401.
In `@pages/api/teams/`[teamId]/datarooms/index.ts:
- Around line 231-246: The POST request's plan allowlist (the "plan: { in: [...]
}" validation) is missing "pro+drtrial", causing Pro trial teams to be rejected;
update that validation in pages/api/teams/[teamId]/datarooms/index.ts by adding
"pro+drtrial" to the array (or broaden the check to accept any "*+drtrial" like
the generate-ai handler) so the isPro && isTrial combination is allowed and
matches pages/api/teams/[teamId]/datarooms/generate-ai.ts behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf818767-d984-4ead-8ee4-26ebb136ee27
📒 Files selected for processing (6)
components/datarooms/add-dataroom-modal.tsxee/features/templates/api/datarooms/generate.tsee/limits/server.tspages/api/teams/[teamId]/datarooms/index.tspages/datarooms/[id]/settings/index.tsxpages/datarooms/index.tsx
| {datarooms.length === 0 ? ( | ||
| <AddDataroomModal> | ||
| <Button | ||
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | ||
| title="Create New Dataroom" | ||
| > | ||
| <PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" /> | ||
| <span>Create New Dataroom</span> | ||
| </Button> | ||
| </AddDataroomModal> | ||
| ) : ( | ||
| <UpgradePlanModal | ||
| clickedPlan={PlanEnum.DataRooms} | ||
| trigger="datarooms" | ||
| > | ||
| <span>Upgrade to Add Data Room</span> | ||
| </Button> | ||
| </UpgradePlanModal> | ||
| <Button | ||
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | ||
| title="Upgrade to Add Data Room" | ||
| > | ||
| <span>Upgrade to Add Data Room</span> | ||
| </Button> | ||
| </UpgradePlanModal> | ||
| )} |
There was a problem hiding this comment.
Use the unfiltered count for this trial CTA.
datarooms.length is the filtered list on the page, so a search/tag combination that matches nothing will show “Create New Dataroom” even when the team already owns its single trial dataroom. Gate this on totalDatarooms/limitDatarooms instead, otherwise the CTA leads straight to the 403 limit error.
Suggested fix
- {datarooms.length === 0 ? (
+ {totalDatarooms < limitDatarooms ? (
<AddDataroomModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Create New Dataroom"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {datarooms.length === 0 ? ( | |
| <AddDataroomModal> | |
| <Button | |
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | |
| title="Create New Dataroom" | |
| > | |
| <PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" /> | |
| <span>Create New Dataroom</span> | |
| </Button> | |
| </AddDataroomModal> | |
| ) : ( | |
| <UpgradePlanModal | |
| clickedPlan={PlanEnum.DataRooms} | |
| trigger="datarooms" | |
| > | |
| <span>Upgrade to Add Data Room</span> | |
| </Button> | |
| </UpgradePlanModal> | |
| <Button | |
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | |
| title="Upgrade to Add Data Room" | |
| > | |
| <span>Upgrade to Add Data Room</span> | |
| </Button> | |
| </UpgradePlanModal> | |
| )} | |
| {totalDatarooms < limitDatarooms ? ( | |
| <AddDataroomModal> | |
| <Button | |
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | |
| title="Create New Dataroom" | |
| > | |
| <PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" /> | |
| <span>Create New Dataroom</span> | |
| </Button> | |
| </AddDataroomModal> | |
| ) : ( | |
| <UpgradePlanModal | |
| clickedPlan={PlanEnum.DataRooms} | |
| trigger="datarooms" | |
| > | |
| <Button | |
| className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left" | |
| title="Upgrade to Add Data Room" | |
| > | |
| <span>Upgrade to Add Data Room</span> | |
| </Button> | |
| </UpgradePlanModal> | |
| )} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@pages/datarooms/index.tsx` around lines 138 - 160, The CTA currently checks
the filtered list length (datarooms.length) which can be zero due to
search/tags; change the gating logic to use the unfiltered counts
(totalDatarooms and limitDatarooms) so the AddDataroomModal is shown only when
the team is under its dataroom limit and UpgradePlanModal is shown when
at/exceeding the limit; update the conditional around AddDataroomModal /
UpgradePlanModal (where datarooms.length is used) to compare totalDatarooms <
limitDatarooms (or the appropriate limit check) and keep the existing props like
clickedPlan={PlanEnum.DataRooms} and trigger="datarooms" intact.
Allow trial users to delete their single dataroom and create a new one, maintaining the limit of one dataroom.
Summary by CodeRabbit
Release Notes