Skip to content

Commit

Permalink
fix(backend): 🐛 email invite in receivers language
Browse files Browse the repository at this point in the history
  • Loading branch information
rvveber committed Nov 4, 2024
1 parent 50891af commit 8ff6dd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/backend/core/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UserSerializer(serializers.ModelSerializer):

class Meta:
model = models.User
fields = ["id", "email", "full_name", "short_name"]
fields = ["id", "email", "full_name", "short_name", "language"]
read_only_fields = ["id", "email", "full_name", "short_name"]


Expand Down
5 changes: 2 additions & 3 deletions src/backend/core/api/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,9 @@ class DocumentAccessViewSet(
def perform_create(self, serializer):
"""Add a new access to the document and send an email to the new added user."""
access = serializer.save()
language = self.request.headers.get("Content-Language", "en-us")

access.document.email_invitation(
language,
access.user.language,
access.user.email,
access.role,
self.request.user,
Expand Down Expand Up @@ -867,7 +866,7 @@ def perform_create(self, serializer):
"""Save invitation to a document then send an email to the invited user."""
invitation = serializer.save()

language = self.request.headers.get("Content-Language", "en-us")
language = settings.LANGUAGE_CODE

invitation.document.email_invitation(
language, invitation.email, invitation.role, self.request.user
Expand Down

0 comments on commit 8ff6dd4

Please sign in to comment.