Skip to content

Commit

Permalink
Add current project to app context
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Aug 1, 2024
1 parent e1f0341 commit 3855e30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion posthog/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def render_template(
if not request.GET.get("no-preloaded-app-context"):
from posthog.api.shared import TeamPublicSerializer
from posthog.api.team import TeamSerializer
from posthog.api.project import ProjectSerializer
from posthog.api.user import UserSerializer
from posthog.user_permissions import UserPermissions
from posthog.views import preflight_check
Expand Down Expand Up @@ -389,9 +390,14 @@ def render_template(
many=False,
)
posthog_app_context["current_team"] = team_serialized.data
project_serialized = ProjectSerializer(
user.team.project,
context={"request": request, "user_permissions": user_permissions},
many=False,
)
posthog_app_context["current_project"] = project_serialized.data
posthog_app_context["frontend_apps"] = get_frontend_apps(user.team.pk)
posthog_app_context["default_event_name"] = get_default_event_name(user.team)
# project_serialized = ProjectSerializer

context["posthog_app_context"] = json.dumps(posthog_app_context, default=json_uuid_convert)

Expand Down

0 comments on commit 3855e30

Please sign in to comment.