diff --git a/ee/session_recordings/session_recording_playlist.py b/ee/session_recordings/session_recording_playlist.py index 7b1a962b187b7..c95c274e893dc 100644 --- a/ee/session_recordings/session_recording_playlist.py +++ b/ee/session_recordings/session_recording_playlist.py @@ -7,17 +7,14 @@ from loginas.utils import is_impersonated_session from rest_framework import request, response, serializers, viewsets from posthog.api.utils import action -from rest_framework.exceptions import PermissionDenied from posthog.api.forbid_destroy_model import ForbidDestroyModel from posthog.api.routing import TeamAndOrgViewSetMixin from posthog.api.shared import UserBasicSerializer -from posthog.constants import AvailableFeature from posthog.models import ( SessionRecording, SessionRecordingPlaylist, SessionRecordingPlaylistItem, - Team, User, ) from posthog.models.activity_logging.activity_log import ( @@ -26,7 +23,6 @@ changes_between, log_activity, ) -from posthog.models.team.team import check_is_feature_available_for_team from posthog.models.utils import UUIDT from posthog.rate_limit import ( ClickHouseBurstRateThrottle, @@ -108,8 +104,6 @@ def create(self, validated_data: dict, *args, **kwargs) -> SessionRecordingPlayl request = self.context["request"] team = self.context["get_team"]() - self._check_can_create_playlist(team) - created_by = validated_data.pop("created_by", request.user) playlist = SessionRecordingPlaylist.objects.create( team=team, @@ -158,12 +152,6 @@ def update(self, instance: SessionRecordingPlaylist, validated_data: dict, **kwa return updated_playlist - def _check_can_create_playlist(self, team: Team) -> bool: - playlist_count = SessionRecordingPlaylist.objects.filter(deleted=False, team=team).count() - if not check_is_feature_available_for_team(team.pk, AvailableFeature.RECORDINGS_PLAYLISTS, playlist_count): - raise PermissionDenied("You have hit the limit for playlists for this team.") - return True - class SessionRecordingPlaylistViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): scope_object = "session_recording_playlist" diff --git a/ee/session_recordings/test/test_session_recording_playlist.py b/ee/session_recordings/test/test_session_recording_playlist.py index 0ec14e0decb15..2d26d96aab928 100644 --- a/ee/session_recordings/test/test_session_recording_playlist.py +++ b/ee/session_recordings/test/test_session_recording_playlist.py @@ -10,7 +10,6 @@ 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 posthog.models import SessionRecording, SessionRecordingPlaylistItem from posthog.models.user import User from posthog.session_recordings.models.session_recording_playlist import ( @@ -77,24 +76,13 @@ def test_creates_playlist(self): "last_modified_by": response.json()["last_modified_by"], } - def test_creates_too_many_playlists(self): - limit = 0 - self.organization.available_product_features = AVAILABLE_PRODUCT_FEATURES - self.organization.save() - for feature in AVAILABLE_PRODUCT_FEATURES: - if "key" in feature and feature["key"] == "recordings_playlists": - limit = int(feature["limit"]) - for _ in range(limit): + def test_can_create_many_playlists(self): + for i in range(100): response = self.client.post( f"/api/projects/{self.team.id}/session_recording_playlists", - data={"name": "test"}, + data={"name": f"test-{i}"}, ) assert response.status_code == status.HTTP_201_CREATED - response = self.client.post( - f"/api/projects/{self.team.id}/session_recording_playlists", - data={"name": "test"}, - ) - assert response.status_code == status.HTTP_403_FORBIDDEN def test_gets_individual_playlist_by_shortid(self): create_response = self.client.post(f"/api/projects/{self.team.id}/session_recording_playlists") diff --git a/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--dark.png b/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--dark.png index 31efe3fd3cace..8bde340c5c487 100644 Binary files a/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--dark.png and b/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--dark.png differ diff --git a/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--light.png b/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--light.png index d59c88dfedec4..f2e2030e5ea36 100644 Binary files a/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--light.png and b/frontend/__snapshots__/components-pay-gate-mini--pay-gate-mini-limit-feature-other--light.png differ diff --git a/frontend/src/lib/components/PayGateMini/PayGateMini.stories.tsx b/frontend/src/lib/components/PayGateMini/PayGateMini.stories.tsx index 94c76b9d303a4..120ce98c85b42 100644 --- a/frontend/src/lib/components/PayGateMini/PayGateMini.stories.tsx +++ b/frontend/src/lib/components/PayGateMini/PayGateMini.stories.tsx @@ -83,8 +83,8 @@ export const PayGateMiniLimitFeatureOther = (): JSX.Element => { ...meCurrent.organization, available_product_features: [ { - key: 'recordings_playlists', - name: 'Recordings Playlists', + key: 'advanced_permissions', + name: 'Advanced Permissions', limit: 3, }, ], @@ -93,7 +93,7 @@ export const PayGateMiniLimitFeatureOther = (): JSX.Element => { ], }, }) - return