Skip to content

Commit

Permalink
perf: Default to persons on events for new teams
Browse files Browse the repository at this point in the history
  • Loading branch information
timgl committed Oct 18, 2024
1 parent b9313b8 commit 25eaf1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions posthog/models/team/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def create_with_data(self, *, initiating_user: Optional["User"], **kwargs) -> "T
kwargs.get("organization_id") or kwargs["organization"].id
)

# Use properties on events by default
team.modifiers = {"personsOnEventsMode": PersonsOnEventsMode.PERSON_ID_OVERRIDE_PROPERTIES_ON_EVENTS}

# Create default dashboards
dashboard = Dashboard.objects.db_manager(self.db).create(name="My App Dashboard", pinned=True, team=team)
create_dashboard_from_template("DEFAULT_APP", dashboard)
Expand Down Expand Up @@ -345,6 +348,9 @@ def person_on_events_mode_flag_based_default(self) -> PersonsOnEventsMode:
if self._person_on_events_person_id_no_override_properties_on_events:
return PersonsOnEventsMode.PERSON_ID_NO_OVERRIDE_PROPERTIES_ON_EVENTS

if self.organization.created_at >= "2024-06-14":

Check failure on line 351 in posthog/models/team/team.py

View workflow job for this annotation

GitHub Actions / Python code quality checks

Unsupported operand types for >= ("datetime" and "str")
return PersonsOnEventsMode.PERSON_ID_OVERRIDE_PROPERTIES_ON_EVENTS

return PersonsOnEventsMode.PERSON_ID_OVERRIDE_PROPERTIES_JOINED

# KLUDGE: DO NOT REFERENCE IN THE BACKEND!
Expand Down

0 comments on commit 25eaf1b

Please sign in to comment.