Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable custom templates for trialing teams #18748

Merged
merged 9 commits into from
Jan 20, 2025

Conversation

joeauyeung
Copy link
Contributor

@joeauyeung joeauyeung commented Jan 19, 2025

What does this PR do?

Builds off of #18635

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

https://www.loom.com/share/3701b3a6ab5f4632b2420072f00b0c7d

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

@keithwillcode keithwillcode added consumer core area: core, team members only labels Jan 19, 2025
Copy link
Contributor Author

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

useHasPaidPlan is used in other parts of the app that don't require an active team subscription so let's create a new hook to only check for an active team plan

Copy link

vercel bot commented Jan 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 20, 2025 2:28pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 20, 2025 2:28pm

@joeauyeung joeauyeung marked this pull request as ready for review January 19, 2025 01:06
@graphite-app graphite-app bot requested a review from a team January 19, 2025 01:06
@dosubot dosubot bot added billing area: billing, stripe, payments, paypal, get paid teams area: teams, round robin, collective, managed event-types labels Jan 19, 2025
Copy link

graphite-app bot commented Jan 19, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (01/19/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

github-actions bot commented Jan 19, 2025

E2E results are ready!

id: input.teamId,
members: {
some: {
userId: userId,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also add accepted: true

@emrysal
Copy link
Contributor

emrysal commented Jan 20, 2025

My main concern with this approach is that we're introducing a Stripe overhead in the check. I'd recommend an alternative approach where we check the pendingPayment (or something similar, or even something new) instead so we don't have to do any external call to confirm an active team.

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Let's merge 👍

@emrysal emrysal enabled auto-merge (squash) January 20, 2025 14:45
@emrysal emrysal merged commit d6306dc into main Jan 20, 2025
40 checks passed
@emrysal emrysal deleted the disable-custom-workflows-for-trials branch January 20, 2025 14:48
iharsh02 pushed a commit to iharsh02/cal.com that referenced this pull request Jan 20, 2025
* Create `checkIfTeamHasActivePlan` method on `stripe-billing-service`

* Add `checkIfTeamPlanIsActive` to `InternalTeamBilling`

* Create `hasActiveTeamPlan` trpc endpoint

* Check for active team plan when updating workflows

* Create `useHasActiveTeamPlan` hook

* Use `useHasActiveTeamPlan` on workflow edit page

* Type fixes

* Type fix

* Add `accepted` to team query
const { step, form, reload, setReload, teamId } = props;
const { data: _verifiedNumbers } = trpc.viewer.workflows.getVerifiedNumbers.useQuery(
{ teamId },
{ enabled: !!teamId }
);

const { hasActiveTeamPlan } = useHasActiveTeamPlan(teamId);
Copy link
Member

Choose a reason for hiding this comment

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

@joeauyeung Now we only allow custom templates on team workflows but not on User workflows for user's that are part of a team or org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
billing area: billing, stripe, payments, paypal, get paid consumer core area: core, team members only ready-for-e2e teams area: teams, round robin, collective, managed event-types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants