Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOTIFICATION] correction de l'url d'accès aux questions non répondues dans l'email de notification #370

Merged
merged 1 commit into from
Jul 27, 2023
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
8 changes: 5 additions & 3 deletions lacommunaute/notification/tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.urls import reverse

from lacommunaute.forum.models import Forum
from lacommunaute.forum_conversation.models import Topic
Expand Down Expand Up @@ -59,11 +60,12 @@ def send_notifs_on_unanswered_topics(list_id: int) -> None:
if contacts:
count = Topic.objects.unanswered().filter(forum__in=Forum.objects.public()).count()
link = (
f"{settings.COMMU_PROTOCOL}://{settings.COMMU_FQDN}/"
"?filter=NEW&mtm_campaign=unsanswered&mtm_medium=email#community"
f"{settings.COMMU_PROTOCOL}://{settings.COMMU_FQDN}",
reverse("forum_conversation_extension:topics"),
"?filter=NEW&mtm_campaign=unsanswered&mtm_medium=email#community",
)

params = {"count": count, "link": link}
params = {"count": count, "link": "".join(link)}

if count > 0:
send_email(
Expand Down
8 changes: 5 additions & 3 deletions lacommunaute/notification/tests/tests_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import respx
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from faker import Faker

from config.settings.base import (
Expand Down Expand Up @@ -158,11 +159,12 @@ def test_send_notifs_on_unanswered_topics(self):
]

url = (
f"{settings.COMMU_PROTOCOL}://{settings.COMMU_FQDN}/"
"?filter=NEW&mtm_campaign=unsanswered&mtm_medium=email#community"
f"{settings.COMMU_PROTOCOL}://{settings.COMMU_FQDN}",
reverse("forum_conversation_extension:topics"),
"?filter=NEW&mtm_campaign=unsanswered&mtm_medium=email#community",
)

params = {"count": 1, "link": url}
params = {"count": 1, "link": "".join(url)}
payload = {
"sender": {"name": "La Communauté", "email": DEFAULT_FROM_EMAIL},
"to": to,
Expand Down