Skip to content
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

Adding show_chat_help to OrganizationSerializer to V1 API #890

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading