♻️(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:
@@ -12,6 +12,7 @@ from logging import getLogger
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import models as auth_models
|
from django.contrib.auth import models as auth_models
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
|
from django.contrib.sites.models import Site
|
||||||
from django.core import exceptions, mail, validators
|
from django.core import exceptions, mail, validators
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
@@ -660,6 +661,7 @@ class Invitation(BaseModel):
|
|||||||
with override(self.issuer.language):
|
with override(self.issuer.language):
|
||||||
template_vars = {
|
template_vars = {
|
||||||
"title": _("Invitation to join Desk!"),
|
"title": _("Invitation to join Desk!"),
|
||||||
|
"site": Site.objects.get_current(),
|
||||||
}
|
}
|
||||||
msg_html = render_to_string("mail/html/invitation.html", template_vars)
|
msg_html = render_to_string("mail/html/invitation.html", template_vars)
|
||||||
msg_plain = render_to_string("mail/text/invitation.txt", template_vars)
|
msg_plain = render_to_string("mail/text/invitation.txt", template_vars)
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ def test_models_team_invitations_email():
|
|||||||
|
|
||||||
email_content = " ".join(email.body.split())
|
email_content = " ".join(email.body.split())
|
||||||
assert "Invitation to join Desk!" in email_content
|
assert "Invitation to join Desk!" in email_content
|
||||||
|
assert "[//example.com]" in email_content
|
||||||
|
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<li>{% trans "Facilitate exchanges and communication with our messaging and group discussion tools."%}</li>
|
<li>{% trans "Facilitate exchanges and communication with our messaging and group discussion tools."%}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</mj-text>
|
</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"%}
|
{% trans "Visit Equipes"%}
|
||||||
</mj-button>
|
</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>
|
<mj-text>{% trans "We are confident that Equipes will help you increase efficiency and productivity while strengthening the bond among members." %}</mj-text>
|
||||||
|
|||||||
Reference in New Issue
Block a user