SMS workflow actions only for Teams#6003
Merged
kodiakhq[bot] merged 14 commits intomainfrom Dec 15, 2022
Merged
Conversation
added 9 commits
December 9, 2022 13:22
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
CarinaWolli
commented
Dec 13, 2022
| } else if (JSON.stringify(oldStep) !== JSON.stringify(newStep)) { | ||
| if ( | ||
| !userWorkflow.user.teams.length && | ||
| !isSMSAction(oldStep.action) && |
Member
Author
There was a problem hiding this comment.
We still allow to edited already existing SMS workflow actions for users that don't belong to a team
zomars
reviewed
Dec 14, 2022
Comment on lines
+37
to
+39
| if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) { | ||
| return true; | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) { | |
| return true; | |
| } | |
| return action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER; |
Contributor
There was a problem hiding this comment.
So we return false instead of undefined
zomars
suggested changes
Dec 14, 2022
Contributor
zomars
left a comment
There was a problem hiding this comment.
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; | ||
| } |
Contributor
There was a problem hiding this comment.
So we return false instead of undefined
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; |
Contributor
There was a problem hiding this comment.
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); |
Contributor
There was a problem hiding this comment.
How about instead of prop-drilling we get this from the backend directly?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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)