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

Bulk invite team members (setup section II) #3143

Merged
merged 24 commits into from
Feb 3, 2021
Merged

Conversation

paolodamico
Copy link
Contributor

@paolodamico paolodamico commented Feb 1, 2021

Changes

Builds up on #3129 to introduce the last step of setup's Section II.

  • Fixes an important security bug in which any user, whether they belonged to an organization or not, could invite members to a given organization (additional context).
  • Updates the serializer (and types) for OrganizationInvite to use the UserSerializer instead of fetching every property individually. Plus, some cleanup to the serializer.
  • Introduces the ability (API & front-end) to bulk invite up to 20 team members in a single go.

image
Tagging @jamesefhawkins, for feedback on inviting multiple team members on onboarding experience.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests

@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 11:54 Inactive
@paolodamico paolodamico changed the base branch from master to setup-section-ii February 1, 2021 11:56
@paolodamico paolodamico mentioned this pull request Feb 1, 2021
4 tasks
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 12:48 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 12:49 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 15:50 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 15:56 Inactive
@paolodamico paolodamico requested review from Twixes and macobo February 1, 2021 15:57
@paolodamico paolodamico force-pushed the setup-2-invite-members branch from a34fb2e to ea2677f Compare February 1, 2021 16:00
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 16:00 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 16:56 Inactive
@paolodamico paolodamico marked this pull request as ready for review February 1, 2021 17:43
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 17:44 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 1, 2021 18:58 Inactive
@paolodamico paolodamico marked this pull request as draft February 1, 2021 19:08
@paolodamico paolodamico marked this pull request as ready for review February 2, 2021 07:48
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 2, 2021 07:48 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 2, 2021 08:46 Inactive
@paolodamico
Copy link
Contributor Author

FYI @Twixes too ready for review.

@Twixes Twixes temporarily deployed to posthog-setup-2-invite--2pypj9 February 2, 2021 12:13 Inactive
@Twixes Twixes temporarily deployed to posthog-setup-2-invite--2pypj9 February 2, 2021 12:19 Inactive
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Just took a quick glance at the code!

)
target_email: models.EmailField = models.EmailField(null=True, db_index=True)
first_name: models.CharField = models.CharField(max_length=30, blank=True, default="")
Copy link
Member

Choose a reason for hiding this comment

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

Field name is first_name, but is this actually intended for first name explicitly? If this is only a holdover from User.first_name (which is kind of a legacy issue), then it should probably be just name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it is indeed to match User.first_name, but I thought we were just using first name, not full name everywhere else too (e.g. the signup form says first name and the placeholder says "Jane"). So first_name sounds appropriate even then, thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm pretty sure we're using full names, just using a single field, as we don't use User.last_name anywhere. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Hm, actually we are kind of using it… accidentally, as social auth fills it in on registration. We should get this straight either way. Thoughts @paolodamico?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I'm not sure what most users did before we revamped the signup page, but for recent users not doing social auth, I think it's pretty straightforward to just type your first name. I would just do first name everywhere, it has easier backwards support, it's nicer to receive emails addressed like "Hey John! instead of "Hey John Doe!" and I don't think we really need the last name for anything.

The only reason I can think for this is for very large teams, but in that case maybe the email address is enough, or they could just do full name by their own decision?

@Twixes Twixes temporarily deployed to posthog-setup-2-invite--2pypj9 February 2, 2021 12:34 Inactive
@Twixes
Copy link
Member

Twixes commented Feb 2, 2021

The See suggestion and save Cy test is again failing 🤔 Not sure if related to this PR

@paolodamico
Copy link
Contributor Author

Thanks for the review @Twixes! As this introduces quite a few changes to the onboarding process I'll wait until tomorrow to merge to see if @macobo has more input.

The not passing test seems like a flaky issue, tests were running before and doesn't look like any relevant front-end code was altered. Running again 👍

As a bit of feedback on the review if its helpful, I think stuff like ae7fc1e just causes us to spend more time on re-reviews and doesn't really provide a lot of value (purely stylistic).

@Twixes
Copy link
Member

Twixes commented Feb 2, 2021

Oh, I just took a look because of the organization-related fix, but @macobo will definitely have valuable input, especially given previous reviews around this project.

@paolodamico
Copy link
Contributor Author

Definitely, super helpful you reviewed that stuff too, thanks! Would've loved to do this in two separate PRs but it ended up being too intertwined to be worth it.

Base automatically changed from setup-section-ii to master February 2, 2021 16:04
@paolodamico paolodamico force-pushed the setup-2-invite-members branch from e0772be to e097813 Compare February 3, 2021 09:28
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 3, 2021 09:28 Inactive
Copy link
Contributor

@macobo macobo left a comment

Choose a reason for hiding this comment

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

Some smaller comments again! Otherwise lgtm

@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 3, 2021 11:26 Inactive
@timgl timgl temporarily deployed to posthog-setup-2-invite--2pypj9 February 3, 2021 11:39 Inactive
Copy link
Contributor

@macobo macobo left a comment

Choose a reason for hiding this comment

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

Did not dig deeply into permissions stuff but solid work ❤️

@paolodamico paolodamico merged commit de317c8 into master Feb 3, 2021
@paolodamico paolodamico deleted the setup-2-invite-members branch February 3, 2021 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants