Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

FIX: ajout d'un tracking Matomo manquant #242

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dora/notifications/tasks/invitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def process(cls, notification: Notification):
send_invitation_reminder(
notification.owner_structureputativemember.user,
notification.owner_structureputativemember.structure,
notification=True,
)
except Exception as ex:
raise TaskError(
Expand Down
11 changes: 10 additions & 1 deletion dora/users/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@
from dora.core.emails import send_mail


def send_invitation_reminder(user, structure):
def send_invitation_reminder(user, structure, notification=False):
cta_link = furl(settings.FRONTEND_URL) / "auth" / "invitation"
cta_link.add({"login_hint": iri_to_uri(user.email), "structure": structure.slug})

if notification:
cta_link.add(
{
"mtm_campaign": "MailsTransactionnels",
"mtm_keyword": "InvitationaConfirmer",
}
)

context = {
"user": user,
"structure": structure,
Expand Down
12 changes: 10 additions & 2 deletions dora/users/tests/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
)


def test_send_invitation_reminder():
@pytest.mark.parametrize("with_notification", (True, False))
def test_send_invitation_reminder(with_notification):
user = make_user()
structure = make_structure(putative_member=user)

send_invitation_reminder(user, structure)
send_invitation_reminder(user, structure, notification=with_notification)

assert len(mail.outbox) == 1
assert mail.outbox[0].to == [user.email]
Expand All @@ -23,6 +24,13 @@ def test_send_invitation_reminder():
assert structure.name in mail.outbox[0].body
assert "/auth/invitation" in mail.outbox[0].body

if with_notification:
assert "MailsTransactionnels" in mail.outbox[0].body
assert "InvitationaConfirmer" in mail.outbox[0].body
else:
assert "MailsTransactionnels" not in mail.outbox[0].body
assert "InvitationaConfirmer" not in mail.outbox[0].body


@pytest.mark.parametrize(
"deletion,subject",
Expand Down