From 8ff6dd410cc0d705727f5b04669ec4e753b397b7 Mon Sep 17 00:00:00 2001 From: rvveber Date: Mon, 4 Nov 2024 14:49:03 +0100 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=F0=9F=90=9B=20email=20invite?= =?UTF-8?q?=20in=20receivers=20language?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/core/api/serializers.py | 2 +- src/backend/core/api/viewsets.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/core/api/serializers.py b/src/backend/core/api/serializers.py index 2947e3b8f..8967b6e27 100644 --- a/src/backend/core/api/serializers.py +++ b/src/backend/core/api/serializers.py @@ -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"] diff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.py index 98560eb84..3ac02b612 100644 --- a/src/backend/core/api/viewsets.py +++ b/src/backend/core/api/viewsets.py @@ -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, @@ -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