From 4b80b288f9e268371d822d40e50613c4f6dfc7e9 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 5 Jun 2024 09:42:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(mails)=20link=20email=20from?= =?UTF-8?q?=20current=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The link in the email was pointing on the staging website. We now use a variable to target the current site setup in the database. --- src/backend/core/models.py | 2 ++ src/backend/core/tests/test_models_invitations.py | 1 + src/mail/mjml/invitation.mjml | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/core/models.py b/src/backend/core/models.py index 18941b2..94b7a2e 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -12,6 +12,7 @@ from logging import getLogger from django.conf import settings from django.contrib.auth import models as auth_models from django.contrib.auth.base_user import AbstractBaseUser +from django.contrib.sites.models import Site from django.core import exceptions, mail, validators from django.db import models, transaction from django.template.loader import render_to_string @@ -660,6 +661,7 @@ class Invitation(BaseModel): with override(self.issuer.language): template_vars = { "title": _("Invitation to join Desk!"), + "site": Site.objects.get_current(), } msg_html = render_to_string("mail/html/invitation.html", template_vars) msg_plain = render_to_string("mail/text/invitation.txt", template_vars) diff --git a/src/backend/core/tests/test_models_invitations.py b/src/backend/core/tests/test_models_invitations.py index a3f9626..663b9be 100644 --- a/src/backend/core/tests/test_models_invitations.py +++ b/src/backend/core/tests/test_models_invitations.py @@ -264,6 +264,7 @@ def test_models_team_invitations_email(): email_content = " ".join(email.body.split()) assert "Invitation to join Desk!" in email_content + assert "[//example.com]" in email_content @mock.patch( diff --git a/src/mail/mjml/invitation.mjml b/src/mail/mjml/invitation.mjml index 1252460..2a999c3 100644 --- a/src/mail/mjml/invitation.mjml +++ b/src/mail/mjml/invitation.mjml @@ -35,7 +35,7 @@
  • {% trans "Facilitate exchanges and communication with our messaging and group discussion tools."%}
  • - + {% trans "Visit Equipes"%} {% trans "We are confident that Equipes will help you increase efficiency and productivity while strengthening the bond among members." %}