Skip to content

Commit

Permalink
Merge branch 'master' into feat/dropdown-min-width
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/src/lib/lemon-ui/LemonInputSelect/LemonInputSelect.tsx
  • Loading branch information
benjackwhite committed Mar 25, 2024
2 parents f6891df + 064f175 commit aed88b9
Show file tree
Hide file tree
Showing 204 changed files with 5,414 additions and 2,431 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/ci-backend-depot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
name: Backend CI (depot)

on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
clickhouseServerVersion:
description: ClickHouse server version. Leave blank for default
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -39,9 +31,9 @@ jobs:
# Job to decide if we should run backend ci
# See https://github.com/dorny/paths-filter#conditional-execution for more details
changes:
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-depot') }}
name: Determine need to run backend checks
# Set job outputs to values from filter step
outputs:
Expand Down Expand Up @@ -90,7 +82,7 @@ jobs:
timeout-minutes: 30

name: Python code quality checks
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4

steps:
# If this run wasn't initiated by the bot (meaning: snapshot update) and we've determined
Expand Down Expand Up @@ -174,7 +166,7 @@ jobs:
timeout-minutes: 10

name: Validate Django migrations
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -237,7 +229,7 @@ jobs:
timeout-minutes: 30

name: Django tests – ${{ matrix.segment }} (persons-on-events ${{ matrix.person-on-events && 'on' || 'off' }}), Py ${{ matrix.python-version }}, ${{ matrix.clickhouse-server-image }} (${{matrix.group}}/${{ matrix.concurrency }}) (depot)
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4

strategy:
fail-fast: false
Expand Down Expand Up @@ -318,7 +310,7 @@ jobs:
matrix:
clickhouse-server-image: ['clickhouse/clickhouse-server:23.11.2.11-alpine']
if: needs.changes.outputs.backend == 'true'
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-e2e-depot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ concurrency:

jobs:
changes:
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-depot') }}
name: Determine need to run E2E checks
# Set job outputs to values from filter step
outputs:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
chunks:
needs: changes
name: Cypress preparation
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
timeout-minutes: 5
outputs:
chunks: ${{ steps.chunk.outputs.chunks }}
Expand All @@ -70,7 +70,7 @@ jobs:

container:
name: Build and cache container image
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
timeout-minutes: 60
needs: [changes]
permissions:
Expand All @@ -94,7 +94,7 @@ jobs:

cypress:
name: Cypress E2E tests (${{ strategy.job-index }}) (depot)
runs-on: depot-ubuntu-latest
runs-on: depot-ubuntu-latest-4
timeout-minutes: 60
needs: [chunks, changes, container]
permissions:
Expand Down
46 changes: 8 additions & 38 deletions ee/api/test/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from rest_framework import status

from ee.api.test.base import APILicensedTest
from ee.api.test.fixtures.available_product_features import AVAILABLE_PRODUCT_FEATURES
from ee.models.explicit_team_membership import ExplicitTeamMembership
from ee.models.license import License
from posthog.constants import AvailableFeature
from posthog.models import OrganizationMembership
from posthog.models.dashboard import Dashboard
from posthog.models.sharing_configuration import SharingConfiguration
Expand Down Expand Up @@ -269,7 +267,12 @@ def test_sharing_edits_limited_to_collaborators(self):
self.permission_denied_response("You don't have edit permissions for this dashboard."),
)

def test_cannot_edit_dashboard_description_when_collaboration_not_available(self):
def test_can_edit_dashboard_description_when_collaboration_not_available(self):
"""
Team collaboration feature is only available on some plans, but if the feature is
not available, the user should still be able to read/write for migration purposes.
The access to the feature is blocked in the UI, so this is unlikely to be truly abused.
"""
self.client.logout()

self.organization.available_features = []
Expand All @@ -288,49 +291,16 @@ def test_cannot_edit_dashboard_description_when_collaboration_not_available(self
name="example dashboard",
)

response = self.client.patch(
f"/api/projects/{self.team.id}/dashboards/{dashboard.id}",
{
"description": "i should not be allowed to edit this",
"name": "even though I am allowed to edit this",
},
)

self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)

dashboard.refresh_from_db()
self.assertEqual(dashboard.description, "")
self.assertEqual(dashboard.name, "example dashboard")

def test_can_edit_dashboard_description_when_collaboration_is_available(self):
self.client.logout()

self.organization.available_features = [AvailableFeature.TEAM_COLLABORATION]
self.organization.available_product_features = AVAILABLE_PRODUCT_FEATURES
self.organization.save()
self.team.access_control = True
self.team.save()

user_with_collaboration = User.objects.create_and_join(
self.organization, "[email protected]", None
)
self.client.force_login(user_with_collaboration)

dashboard: Dashboard = Dashboard.objects.create(
team=self.team,
name="example dashboard",
)

response = self.client.patch(
f"/api/projects/{self.team.id}/dashboards/{dashboard.id}",
{
"description": "i should be allowed to edit this",
"name": "and so also to edit this",
"name": "as well as this",
},
)

self.assertEqual(response.status_code, status.HTTP_200_OK)

dashboard.refresh_from_db()
self.assertEqual(dashboard.description, "i should be allowed to edit this")
self.assertEqual(dashboard.name, "and so also to edit this")
self.assertEqual(dashboard.name, "as well as this")
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# serializer version: 1
# name: ClickhouseTestExperimentSecondaryResults.test_basic_secondary_metric_results
'''
/* user_id:108 celery:posthog.tasks.tasks.sync_insight_caching_state */
/* user_id:107 celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@
"x": 66,
"y": 556
}
},
{
"parentId": 209272202,
"wireframe": {
"id": 52129787123,
"type": "text"
}
}
],
"removes": [
Expand Down
Loading

0 comments on commit aed88b9

Please sign in to comment.