♻️(mails) link email from current site

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.
This commit is contained in:
Anthony LC
2024-06-05 09:42:05 +02:00
committed by Anthony LC
parent fbec4af261
commit 4b80b288f9
3 changed files with 4 additions and 1 deletions

View File

@@ -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)

View File

@@ -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(

View File

@@ -35,7 +35,7 @@
<li>{% trans "Facilitate exchanges and communication with our messaging and group discussion tools."%}</li>
</ul>
</mj-text>
<mj-button href="https://desk-staging.beta.numerique.gouv.fr/" background-color="#000091" color="white" padding-bottom="30px">
<mj-button href="//{{site.domain}}" background-color="#000091" color="white" padding-bottom="30px">
{% trans "Visit Equipes"%}
</mj-button>
<mj-text>{% trans "We are confident that Equipes will help you increase efficiency and productivity while strengthening the bond among members." %}</mj-text>