Skip to content

Commit

Permalink
Merge pull request #890 from weni-ai/feature/show-chat-help-v1
Browse files Browse the repository at this point in the history
Adding show_chat_help to OrganizationSerializer to V1 API
  • Loading branch information
ericosta-dev authored Aug 28, 2024
2 parents 87756c4 + 865bb86 commit d534a58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion connect/api/v1/organization/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class Meta:
"created_at",
"is_suspended",
"extra_integration",
"enforce_2fa"
"enforce_2fa",
"show_chat_help",
]
ref_name = None

Expand Down Expand Up @@ -145,6 +146,8 @@ class Meta:
help_text=_("if this field is true, only users with 2fa activated can access the org")
)

show_chat_help = serializers.SerializerMethodField()

def create_organization(self, validated_data): # pragma: no cover
organization = {"id": 0}
if not settings.TESTING:
Expand Down Expand Up @@ -236,6 +239,11 @@ def get_authorization(self, obj):
).data
return data

def get_show_chat_help(self, obj):
if obj.config.get("show_chat_help"):
return True
return obj.authorizations.order_by("created_at").first().user.number_people == 4


class OrganizationAuthorizationSerializer(serializers.ModelSerializer):
class Meta:
Expand Down

0 comments on commit d534a58

Please sign in to comment.