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

feat: Ability to send team invitation in bulk #930

Merged
merged 8 commits into from
Apr 4, 2024

Conversation

anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Feb 14, 2024

fixes #923

Documenso.and.5.more.pages.-.Personal.-.Microsoft_.Edge.2024-02-14.09-49-37.mp4

Copy link

vercel bot commented Feb 14, 2024

@anikdhabal is attempting to deploy a commit to the Documenso Team Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Feb 14, 2024

Important

Auto Review Skipped

Auto reviews are limited to the following labels: coderabbit. Please add one of these labels to enable auto reviews.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the apps: web Issues related to the webapp label Feb 14, 2024
@ElTimuro
Copy link
Member

  • @anikdhabal neat
  • What happends with invalid email?
  • A toast informing how many were successfully invite would be good, so the user does not have to count the resulting row in the memebers table

@anikdhabal
Copy link
Contributor Author

  • @anikdhabal neat
  • What happends with invalid email?
  • A toast informing how many were successfully invite would be good, so the user does not have to count the resulting row in the memebers table

Thanks for your review and suggestion.

Yeah, the code handles invalid email addresses. It simply shows the error message 'invalid email' in both cases.


if (file) {
const reader = new FileReader();
const emailRegex = /^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we not use zod here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we are also using Zod here. We can remove this.

if (file) {
const reader = new FileReader();
const emailRegex = /^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i;
reader.onload = (e) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit scary, things like papaparse and such exist for handling the reading of CSV files in a safe manner since the format itself is prone to weirdness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Papaparse would be good for handling csv file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider the bundle size implications as well there may be smaller and just as good options 😄 Papaparse was the most popular last I messed with CSV's but I'm unsure as to what current recommendations are.

https://bundlephobia.com/ is a fantastic website for seeing how big something might be!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay😄. Let me check this out.

role: TeamMemberRole.MEMBER,
},
],
email: '' || [''],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems it would be easier to always make this an array of emails so we don't have to deal with unions. I assume in the UI you would have an option to "Add another member" within the form.

@dguyen
Copy link
Collaborator

dguyen commented Feb 15, 2024

Some thoughts just by looking at the loom (haven't looked at the code)

  1. The default tab should be individual
  2. Keep the old functionality prior to this PR where multiple users can be invited as the 'individual' tab
  3. Instead of directly inviting bulk bulk team members, I think we should also allow the user to "Review" it (optional) by loading it into the individual section so they can review and change selected roles

@anikdhabal
Copy link
Contributor Author

Documenso.and.8.more.pages.-.Personal.-.Microsoft_.Edge.2024-02-16.02-50-11.mp4

Thoughts on this? Instead of sending invites from the bulk import section, we use it for importing emails and then redirect to the invite member page, where we can change the selected role before sending the invite.

Or,

Users can send invitations from both sides, just like the current changes.

@@ -151,80 +175,123 @@ export const InviteTeamMembersDialog = ({
An email containing an invitation will be sent to each member.
</DialogDescription>
</DialogHeader>

<div className="border-input ring-offset-background flex w-full justify-around rounded-md border">
Copy link
Contributor

Choose a reason for hiding this comment

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

We could have used the Tabs component here. 💭

@Mythie
Copy link
Collaborator

Mythie commented Feb 24, 2024

Documenso.and.8.more.pages.-.Personal.-.Microsoft_.Edge.2024-02-16.02-50-11.mp4
Thoughts on this? Instead of sending invites from the bulk import section, we use it for importing emails and then redirect to the invite member page, where we can change the selected role before sending the invite.

Or,

Users can send invitations from both sides, just like the current changes.

If we're doing this I'd avoid the text input and just have it only accept CSV where it'll be in email,role format so we can toss a bunch of ui elements.

We should also supply a template csv which would look like:

email,role
john@example.com,SIGNER

Seems crazy but in the past many clients have wanted the template to work off 😄

So to clarify:

  • For the bulk import tab, make it only two buttons. One for importing and one for downloading a template for the import.
  • Imported items can go to the other tab for modification as the user sees fit.

@anikdhabal
Copy link
Contributor Author

Screenshot 2024-04-04 010604

@anikdhabal anikdhabal requested a review from Mythie April 3, 2024 19:47
Copy link
Collaborator

@dguyen dguyen left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@dguyen dguyen merged commit b871540 into documenso:main Apr 4, 2024
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apps: web Issues related to the webapp version bump 👀
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Ability to bulk import (team members)
5 participants