Skip to content

SMS workflow actions only for Teams#6003

Merged
kodiakhq[bot] merged 14 commits intomainfrom
feat/is-teams-plan
Dec 15, 2022
Merged

SMS workflow actions only for Teams#6003
kodiakhq[bot] merged 14 commits intomainfrom
feat/is-teams-plan

Conversation

@CarinaWolli
Copy link
Copy Markdown
Member

What does this PR do?

Makes SMS workflow actions only available for paying users (users that belong to a team). For all other users, the SMS actions are disabled in the dropdown.

Fixes #5916

Loom Video: https://www.loom.com/share/52e13c89ebd2441a9b9ca7519c0d4c5a

Environment: Staging(main branch)

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 13, 2022

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

Name Status Preview Updated
cal ✅ Ready (Inspect) Visit Preview Dec 15, 2022 at 0:11AM (UTC)

} else if (JSON.stringify(oldStep) !== JSON.stringify(newStep)) {
if (
!userWorkflow.user.teams.length &&
!isSMSAction(oldStep.action) &&
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We still allow to edited already existing SMS workflow actions for users that don't belong to a team

Comment on lines +37 to +39
if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) {
return true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) {
return true;
}
return action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we return false instead of undefined

Copy link
Copy Markdown
Contributor

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Nice work @CarinaWolli. Blocking to make some adjustments. 🙏🏽

Comment on lines +37 to +39
if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) {
return true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we return false instead of undefined

Comment thread packages/trpc/server/routers/viewer.tsx Outdated
Comment on lines +1146 to +1154
const user = await ctx.prisma.user.findFirst({
where: {
id: ctx.user.id,
},
select: {
teams: true,
},
});
return (user && user.teams.length > 0) as boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const user = await ctx.prisma.user.findFirst({
where: {
id: ctx.user.id,
},
select: {
teams: true,
},
});
return (user && user.teams.length > 0) as boolean;
const membershipCount = await ctx.prisma.membership.count({
where: { userId: ctx.user.id },
});
return membershipCount > 0;

We only need to count memberships

);

const actionOptions = getWorkflowActionOptions(t);
const actionOptions = getWorkflowActionOptions(t, isTeamsPlan);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about instead of prop-drilling we get this from the backend directly?

Copy link
Copy Markdown
Contributor

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Ship it

@kodiakhq kodiakhq Bot merged commit 7b18272 into main Dec 15, 2022
@kodiakhq kodiakhq Bot deleted the feat/is-teams-plan branch December 15, 2022 00:11
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge ♻️ autoupdate tells kodiak to keep this branch up-to-date core area: core, team members only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-556] SMS reminders only for paying customers

3 participants