From 5a6b51bccf0e3a68825b683f31861fccadeaa3dd Mon Sep 17 00:00:00 2001 From: Bill DeRusha Date: Thu, 10 Oct 2019 16:49:15 -0400 Subject: [PATCH] remove mailchimp tracking --- common/djangoapps/student/models.py | 25 ----------- .../student/tests/test_activate_account.py | 43 ------------------- lms/envs/production.py | 3 -- .../djangoapps/user_authn/views/register.py | 8 ---- 4 files changed, 79 deletions(-) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index a47b608eda..b2397be7d0 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -773,34 +773,9 @@ class Registration(models.Model): def activate(self): self.user.is_active = True - self._track_activation() self.user.save(update_fields=['is_active']) log.info(u'User %s (%s) account is successfully activated.', self.user.username, self.user.email) - def _track_activation(self): - """ - Update the isActive flag in mailchimp for activated users. - """ - has_segment_key = getattr(settings, 'LMS_SEGMENT_KEY', None) - has_mailchimp_id = hasattr(settings, 'MAILCHIMP_NEW_USER_LIST_ID') - if has_segment_key and has_mailchimp_id: - # .. pii: Username and email are sent to Segment here. Retired directly through Segment API call in Tubular. - # .. pii_types: email_address, username - # .. pii_retirement: third_party - segment.identify( - self.user.id, # pylint: disable=no-member - { - 'email': self.user.email, - 'username': self.user.username, - 'activated': 1, - }, - { - "MailChimp": { - "listId": settings.MAILCHIMP_NEW_USER_LIST_ID - } - } - ) - class PendingNameChange(DeletableByUserValue, models.Model): """ diff --git a/common/djangoapps/student/tests/test_activate_account.py b/common/djangoapps/student/tests/test_activate_account.py index 9131a98bbf..7db4e674ac 100644 --- a/common/djangoapps/student/tests/test_activate_account.py +++ b/common/djangoapps/student/tests/test_activate_account.py @@ -70,49 +70,6 @@ class TestActivateAccount(TestCase): self.assertTrue(self.user.is_active) self.assertFalse(mock_segment_identify.called) - @override_settings( - LMS_SEGMENT_KEY="testkey", - MAILCHIMP_NEW_USER_LIST_ID="listid" - ) - @patch('student.models.segment.identify') - def test_activation_with_keys(self, mock_segment_identify): - expected_segment_payload = { - 'email': self.email, - 'username': self.username, - 'activated': 1, - } - expected_segment_mailchimp_list = { - "MailChimp": { - "listId": settings.MAILCHIMP_NEW_USER_LIST_ID - } - } - - # Ensure that the user starts inactive - self.assertFalse(self.user.is_active) - - # Until you explicitly activate it - self.registration.activate() - self.assertTrue(self.user.is_active) - mock_segment_identify.assert_called_with( - self.user.id, - expected_segment_payload, - expected_segment_mailchimp_list - ) - - @override_settings(LMS_SEGMENT_KEY="testkey") - @patch('student.models.segment.identify') - def test_activation_without_mailchimp_key(self, mock_segment_identify): - self.assert_no_tracking(mock_segment_identify) - - @override_settings(MAILCHIMP_NEW_USER_LIST_ID="listid") - @patch('student.models.segment.identify') - def test_activation_without_segment_key(self, mock_segment_identify): - self.assert_no_tracking(mock_segment_identify) - - @patch('student.models.segment.identify') - def test_activation_without_keys(self, mock_segment_identify): - self.assert_no_tracking(mock_segment_identify) - def test_account_activation_message(self): """ Verify that account correct activation message is displayed. diff --git a/lms/envs/production.py b/lms/envs/production.py index ad69fc733d..0b9d41c363 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -588,9 +588,6 @@ if 'DATADOG_API' in AUTH_TOKENS: ANALYTICS_API_KEY = AUTH_TOKENS.get("ANALYTICS_API_KEY", ANALYTICS_API_KEY) ANALYTICS_API_URL = ENV_TOKENS.get("ANALYTICS_API_URL", ANALYTICS_API_URL) -# Mailchimp New User List -MAILCHIMP_NEW_USER_LIST_ID = ENV_TOKENS.get("MAILCHIMP_NEW_USER_LIST_ID") - # Zendesk ZENDESK_USER = AUTH_TOKENS.get("ZENDESK_USER") ZENDESK_API_KEY = AUTH_TOKENS.get("ZENDESK_API_KEY") diff --git a/openedx/core/djangoapps/user_authn/views/register.py b/openedx/core/djangoapps/user_authn/views/register.py index 215426f64a..f3b4f33ee8 100644 --- a/openedx/core/djangoapps/user_authn/views/register.py +++ b/openedx/core/djangoapps/user_authn/views/register.py @@ -266,14 +266,6 @@ def _track_user_registration(user, profile, params, third_party_provider): 'country': text_type(profile.country), } ] - # Provide additional context only if needed. - if hasattr(settings, 'MAILCHIMP_NEW_USER_LIST_ID'): - identity_args.append({ - "MailChimp": { - "listId": settings.MAILCHIMP_NEW_USER_LIST_ID - } - }) - # .. pii: Many pieces of PII are sent to Segment here. Retired directly through Segment API call in Tubular. # .. pii_types: email_address, username, name, birth_date, location, gender # .. pii_retirement: third_party