-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update project tree scroll to current ID context menu, top bar #29423
Changes from all commits
18103b6
e98bf56
8198f60
3a81328
5abfc00
cc79757
8d1e2e0
9340d45
cbf1dee
2e97be3
5c74fb1
64b9474
a2981fc
b0c1aef
927aba1
002a107
6c5c9d0
0fdd29e
8952e19
dace418
33d8f87
de0dba1
005228b
bac971d
6c3b927
794e744
ad944ae
2ccee35
b43ef5f
5d6dbf5
0ff6166
b6c35c4
ddbeff7
a49c128
50a63d2
597b0d9
9fc4f6b
c75f927
532ee7d
1750e4d
5a33e1b
1500053
6ba261f
ee0a11f
286dd4c
6ed32f5
858260d
b5f04ba
e7b7e0d
a6c73d8
e14e4c7
803ff79
6858459
0fdf8e6
e5ef48b
710b742
be66600
3c9bbad
5cffe67
3574c64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,7 @@ one | |
true false | ||
true false | ||
true bcd | ||
bcdef | ||
firstNonNull notNull | ||
|
||
-- date -- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
from rest_framework import serializers | ||
from django.utils import timezone | ||
from loginas.utils import is_impersonated_session | ||
from rest_framework import serializers | ||
|
||
from ee.models.property_definition import EnterprisePropertyDefinition | ||
from posthog.api.shared import UserBasicSerializer | ||
from posthog.api.tagged_item import TaggedItemSerializerMixin | ||
from posthog.models import PropertyDefinition | ||
from posthog.models.activity_logging.activity_log import ( | ||
Detail, | ||
dict_changes_between, | ||
log_activity, | ||
Detail, | ||
) | ||
from loginas.utils import is_impersonated_session | ||
|
||
|
||
class EnterprisePropertyDefinitionSerializer(TaggedItemSerializerMixin, serializers.ModelSerializer): | ||
|
@@ -31,6 +32,7 @@ class Meta: | |
"verified", | ||
"verified_at", | ||
"verified_by", | ||
"hidden", | ||
) | ||
read_only_fields = [ | ||
"id", | ||
|
@@ -41,7 +43,32 @@ class Meta: | |
"verified_by", | ||
] | ||
|
||
def update(self, property_definition: EnterprisePropertyDefinition, validated_data): | ||
def validate(self, data): | ||
validated_data = super().validate(data) | ||
|
||
if "hidden" in validated_data and "verified" in validated_data: | ||
if validated_data["hidden"] and validated_data["verified"]: | ||
raise serializers.ValidationError("A property cannot be both hidden and verified") | ||
|
||
# If setting hidden=True, ensure verified becomes false | ||
if validated_data.get("hidden", False): | ||
validated_data["verified"] = False | ||
# If setting verified=True, ensure hidden becomes false | ||
elif validated_data.get("verified", False): | ||
validated_data["hidden"] = False | ||
|
||
return validated_data | ||
|
||
def update(self, property_definition: EnterprisePropertyDefinition, validated_data: dict): | ||
# If setting hidden=True, ensure verified becomes false | ||
if validated_data.get("hidden", False): | ||
validated_data["verified"] = False | ||
validated_data["verified_by"] = None | ||
validated_data["verified_at"] = None | ||
# If setting verified=True, ensure hidden becomes false | ||
elif validated_data.get("verified", False): | ||
validated_data["hidden"] = False | ||
|
||
Comment on lines
+63
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: This logic duplicates what's already done in the validate method. Since validate is called before update, this code may be redundant and could be removed. |
||
validated_data["updated_by"] = self.context["request"].user | ||
if "property_type" in validated_data: | ||
if validated_data["property_type"] == "Numeric": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,14 @@ class PublicIntegrationViewSet(viewsets.GenericViewSet): | |
authentication_classes = [] | ||
permission_classes = [] | ||
|
||
@action(methods=["POST"], detail=False, url_path="slack/interactivity-callback") | ||
def slack_interactivity_callback(self, request: Request, *args: Any, **kwargs: Any) -> Response: | ||
# This is an empty endpoint for the Slack interactivity callback. | ||
# We don't verify the request, as we don't do anything with the submitted data. | ||
# We only use it to supress the warnings when users press buttons in Slack messages. | ||
# In case we decide to do something with it, please add the verification process here. | ||
Comment on lines
+27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding request validation for security, even if you're not using the data. Without validation, this endpoint could potentially be abused. |
||
return Response({"status": "ok"}) | ||
|
||
@action(methods=["POST"], detail=False, url_path="slack/events") | ||
def slack_events(self, request: Request, *args: Any, **kwargs: Any) -> Response: | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The validation logic here is duplicated in the update method. Consider extracting this logic to a helper method to avoid inconsistencies if one part is updated but not the other.