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

Refactor & extend backend user identify #2937

Merged
merged 9 commits into from Jan 14, 2021
Merged

Conversation

paolodamico
Copy link
Contributor

Changes

Previously we had the $identify logic for the backend all over the place. This PR refactors the logic so that:
a) it's kept in a single place.
b) it's called only in one place.
c) it's called asynchronously every time the user hits /api/user/. This was motivated because a ton of users are outdated and make it impossible to work on certain analyses.

The only exception is that we kept a identify call that sets the is_first_user & is_organization_first_user once.

The PR also adds more metadata to the request.

Checklist

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

@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 13, 2021 23:20 Inactive
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 13, 2021 23:22 Inactive
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 13, 2021 23:23 Inactive
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 14, 2021 00:08 Inactive
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 14, 2021 00:13 Inactive
posthog/models/user.py Outdated Show resolved Hide resolved
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.

Few small notes, LGTM otherwise.

posthog/models/user.py Outdated Show resolved Hide resolved
posthog/api/test/test_user.py Outdated Show resolved Hide resolved
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 14, 2021 13:30 Inactive
@timgl timgl temporarily deployed to posthog-improve-identif-npycqz January 14, 2021 13:38 Inactive
@paolodamico
Copy link
Contributor Author

Merging now as cloud tests are fixed on https://github.com/PostHog/posthog-production/pull/61

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.

None yet

3 participants