PostHog / plugin-server

Service to process and save PostHog events, supporting JS/TS plugins at that
https://posthog.com
8 stars 5 forks source link

Set isIdentified only when aliasing actually occurs #591

Closed macobo closed 3 years ago

macobo commented 3 years ago

Changes

Closes https://github.com/PostHog/posthog/issues/6116 by not setting is_identified when not updating identities (e.g. when updating properties)

This was causing issues after https://github.com/PostHog/plugin-server/pull/576 as users who updated props on anonymous users would run into issues when logging in/signing up creating new users.

Checklist

macobo commented 3 years ago

We only rely on this in the app and it seems we just change the UI a bit based on is_identified in person view. I think this is fine - we expect distinct_id to change when people log in/sign in posthog-js, but not 100% sure on e.g. server-side libraries. But it's a minor enough thing we can remedy later if needed.

yakkomajuri commented 3 years ago

Yeah it's not a very important setting

macobo commented 3 years ago

Sorry @hazzadous for not waiting for your review

Looks ok, does this introduce a race between merging and setting not happening atomically?

No more than it did previously - note the call happens in the same place in most of the cases, except not when no anon_distinct_id or the two distinct_ids are the same.