diff --git a/lemarche/conversations/constants.py b/lemarche/conversations/constants.py index cf4f48de2..f30ed27c9 100644 --- a/lemarche/conversations/constants.py +++ b/lemarche/conversations/constants.py @@ -1,5 +1,5 @@ ATTRIBUTES_TO_SAVE_FOR_INBOUND = ["From", "To", "CC", "ReplyTo", "SentAtDate", "Attachments"] -ATTRIBUTES_TO_KEEP_FOR_INBOUND = ["SentAtDate", "Attachments"] +ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND = ["SentAtDate", "Attachments"] SOURCE_MAILJET = "MAILJET" SOURCE_BREVO = "BREVO" diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 64424414f..796f53d4c 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -2,14 +2,14 @@ from django.conf import settings from django.utils import timezone -from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND +from lemarche.conversations.constants import ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND from lemarche.conversations.models import Conversation from lemarche.utils.commands import BaseCommand def clean_inbound_data(inbound_data: dict) -> dict: """Keep only allowed data once anonymized""" - return {key: inbound_data[key] for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + return {key: inbound_data[key] for key in ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND} class Command(BaseCommand): diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index 8f88608e8..ffb109dd8 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -8,7 +8,7 @@ from django.utils import timezone from lemarche.conversations import constants as conversation_constants -from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND, ATTRIBUTES_TO_SAVE_FOR_INBOUND +from lemarche.conversations.constants import ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND, ATTRIBUTES_TO_SAVE_FOR_INBOUND from lemarche.conversations.factories import ConversationFactory, TemplateTransactionalFactory from lemarche.conversations.models import Conversation, TemplateTransactional from lemarche.siaes.factories import SiaeFactory @@ -86,7 +86,7 @@ class ConversationAnonymizationTestCase(TestCase): def setUp(self): inbound_data = {key: "something" for key in ATTRIBUTES_TO_SAVE_FOR_INBOUND} - self.anonymized_inbound_data = {key: "something" for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + self.anonymized_inbound_data = {key: "something" for key in ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND} ConversationFactory( title="anonymized",